DeviceManagementsImpl.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.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.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 DeviceManagements. */
public final class DeviceManagementsImpl {
    /** The proxy service used to perform REST calls. */
    private final DeviceManagementsService service;

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

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

    /**
     * The interface defining all the services for DeviceUpdateClientDeviceManagements to be used by the proxy service
     * to perform REST calls.
     */
    @Host("https://{endpoint}")
    @ServiceInterface(name = "DeviceUpdateClientDe")
    private interface DeviceManagementsService {
        @Get("/deviceupdate/{instanceId}/management/deviceclasses")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listDeviceClasses(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

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

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

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

        @Post("/deviceupdate/{instanceId}/management/devices")
        @ExpectedResponses({202})
        Mono<Response<Void>> importDevices(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") BinaryData importType,
                RequestOptions requestOptions,
                Context context);

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

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

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

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

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

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

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

        @Put("/deviceupdate/{instanceId}/management/groups/{groupId}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> createOrUpdateGroup(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("groupId") String groupId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") BinaryData group,
                RequestOptions requestOptions,
                Context context);

        @Delete("/deviceupdate/{instanceId}/management/groups/{groupId}")
        @ExpectedResponses({204})
        Mono<Response<Void>> deleteGroup(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("groupId") String groupId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

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

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

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

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

        @Put("/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> createOrUpdateDeployment(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("deploymentId") String deploymentId,
                @PathParam("groupId") String groupId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") BinaryData deployment,
                RequestOptions requestOptions,
                Context context);

        @Delete("/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}")
        @ExpectedResponses({204})
        Mono<Response<Void>> deleteDeployment(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("groupId") String groupId,
                @PathParam("deploymentId") String deploymentId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

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

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

        @Get("/deviceupdate/{instanceId}/management/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("/deviceupdate/{instanceId}/management/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);

        @Put("/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}")
        @ExpectedResponses({201})
        Mono<Response<BinaryData>> collectLogs(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("operationId") String operationId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") BinaryData logCollectionRequest,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> getLogCollectionOperation(
                @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("/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listLogCollectionOperations(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

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

        @Post("/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> stopDeployment(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("groupId") String groupId,
                @PathParam("deploymentId") String deploymentId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Post("/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> retryDeployment(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("groupId") String groupId,
                @PathParam("deploymentId") String deploymentId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

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

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

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

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

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

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

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

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listDeploymentDevicesNext(
                @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);

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

    /**
     * Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices
     * connected 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: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes (unique combinations of device manufacturer and model) for all devices
     *     connected to Device Update for IoT Hub along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceClassesSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeviceClasses(
                                        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));
    }

    /**
     * Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices
     * connected 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: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes (unique combinations of device manufacturer and model) for all devices
     *     connected to Device Update for IoT Hub along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceClassesSinglePageAsync(
            RequestOptions requestOptions, Context context) {
        return service.listDeviceClasses(
                        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));
    }

    /**
     * Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices
     * connected 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: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes (unique combinations of device manufacturer and model) for all devices
     *     connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeviceClassesAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listDeviceClassesSinglePageAsync(requestOptions),
                nextLink -> listDeviceClassesNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices
     * connected 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: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes (unique combinations of device manufacturer and model) for all devices
     *     connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeviceClassesAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listDeviceClassesSinglePageAsync(requestOptions, context),
                nextLink -> listDeviceClassesNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices
     * connected 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: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes (unique combinations of device manufacturer and model) for all devices
     *     connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listDeviceClasses(RequestOptions requestOptions) {
        return new PagedIterable<>(listDeviceClassesAsync(requestOptions));
    }

    /**
     * Gets the properties of a device class.
     *
     * <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
     * {
     *     deviceClassId: String
     *     compatProperties: {
     *         String: String
     *     }
     *     bestCompatibleUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 the properties of a device class along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceClassWithResponseAsync(
            String deviceClassId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getDeviceClass(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                deviceClassId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the properties of a device class.
     *
     * <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
     * {
     *     deviceClassId: String
     *     compatProperties: {
     *         String: String
     *     }
     *     bestCompatibleUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 the properties of a device class along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceClassWithResponseAsync(
            String deviceClassId, RequestOptions requestOptions, Context context) {
        return service.getDeviceClass(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                deviceClassId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the properties of a device class.
     *
     * <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
     * {
     *     deviceClassId: String
     *     compatProperties: {
     *         String: String
     *     }
     *     bestCompatibleUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 the properties of a device class along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getDeviceClassWithResponse(String deviceClassId, RequestOptions requestOptions) {
        return getDeviceClassWithResponseAsync(deviceClassId, requestOptions).block();
    }

    /**
     * Gets a list of installable updates for a device class.
     *
     * <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: [
     *         {
     *             provider: String
     *             name: String
     *             version: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 list of installable updates for a device class along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listInstallableUpdatesForDeviceClassSinglePageAsync(
            String deviceClassId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listInstallableUpdatesForDeviceClass(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        deviceClassId,
                                        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));
    }

    /**
     * Gets a list of installable updates for a device class.
     *
     * <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: [
     *         {
     *             provider: String
     *             name: String
     *             version: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 list of installable updates for a device class along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listInstallableUpdatesForDeviceClassSinglePageAsync(
            String deviceClassId, RequestOptions requestOptions, Context context) {
        return service.listInstallableUpdatesForDeviceClass(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        deviceClassId,
                        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));
    }

    /**
     * Gets a list of installable updates for a device class.
     *
     * <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: [
     *         {
     *             provider: String
     *             name: String
     *             version: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 list of installable updates for a device class.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listInstallableUpdatesForDeviceClassAsync(
            String deviceClassId, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listInstallableUpdatesForDeviceClassSinglePageAsync(deviceClassId, requestOptions),
                nextLink -> listInstallableUpdatesForDeviceClassNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of installable updates for a device class.
     *
     * <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: [
     *         {
     *             provider: String
     *             name: String
     *             version: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 list of installable updates for a device class.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listInstallableUpdatesForDeviceClassAsync(
            String deviceClassId, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listInstallableUpdatesForDeviceClassSinglePageAsync(deviceClassId, requestOptions, context),
                nextLink -> listInstallableUpdatesForDeviceClassNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of installable updates for a device class.
     *
     * <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: [
     *         {
     *             provider: String
     *             name: String
     *             version: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param deviceClassId Device class 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 list of installable updates for a device class.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listInstallableUpdatesForDeviceClass(
            String deviceClassId, RequestOptions requestOptions) {
        return new PagedIterable<>(listInstallableUpdatesForDeviceClassAsync(deviceClassId, requestOptions));
    }

    /**
     * Gets a list of devices connected 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>filter</td><td>String</td><td>No</td><td>Restricts the set of devices returned. You can filter on device GroupId or DeviceClassId.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices connected to Device Update for IoT Hub along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDevicesSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDevices(
                                        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));
    }

    /**
     * Gets a list of devices connected 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>filter</td><td>String</td><td>No</td><td>Restricts the set of devices returned. You can filter on device GroupId or DeviceClassId.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices connected to Device Update for IoT Hub along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDevicesSinglePageAsync(RequestOptions requestOptions, Context context) {
        return service.listDevices(
                        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));
    }

    /**
     * Gets a list of devices connected 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>filter</td><td>String</td><td>No</td><td>Restricts the set of devices returned. You can filter on device GroupId or DeviceClassId.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDevicesAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listDevicesSinglePageAsync(requestOptions),
                nextLink -> listDevicesNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of devices connected 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>filter</td><td>String</td><td>No</td><td>Restricts the set of devices returned. You can filter on device GroupId or DeviceClassId.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDevicesAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listDevicesSinglePageAsync(requestOptions, context),
                nextLink -> listDevicesNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of devices connected 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>filter</td><td>String</td><td>No</td><td>Restricts the set of devices returned. You can filter on device GroupId or DeviceClassId.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listDevices(RequestOptions requestOptions) {
        return new PagedIterable<>(listDevicesAsync(requestOptions));
    }

    /**
     * Import existing devices from 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>action</td><td>String</td><td>Yes</td><td>Devices action.</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * String(Devices/Modules/All)
     * }</pre>
     *
     * @param importType The types of devices to import.
     * @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>> importDevicesWithResponseAsync(BinaryData importType, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.importDevices(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                this.client.getServiceVersion().getVersion(),
                                importType,
                                requestOptions,
                                context));
    }

    /**
     * Import existing devices from 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>action</td><td>String</td><td>Yes</td><td>Devices action.</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * String(Devices/Modules/All)
     * }</pre>
     *
     * @param importType The types of devices to import.
     * @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>> importDevicesWithResponseAsync(
            BinaryData importType, RequestOptions requestOptions, Context context) {
        return service.importDevices(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                this.client.getServiceVersion().getVersion(),
                importType,
                requestOptions,
                context);
    }

    /**
     * Import existing devices from 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>action</td><td>String</td><td>Yes</td><td>Devices action.</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * String(Devices/Modules/All)
     * }</pre>
     *
     * @param importType The types of devices to import.
     * @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> beginImportDevicesAsync(
            BinaryData importType, RequestOptions requestOptions) {
        return PollerFlux.create(
                Duration.ofSeconds(1),
                () -> this.importDevicesWithResponseAsync(importType, requestOptions),
                new DefaultPollingStrategy<>(this.client.getHttpPipeline()),
                new TypeReferenceBinaryData(),
                new TypeReferenceBinaryData());
    }

    /**
     * Import existing devices from 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>action</td><td>String</td><td>Yes</td><td>Devices action.</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * String(Devices/Modules/All)
     * }</pre>
     *
     * @param importType The types of devices to import.
     * @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> beginImportDevicesAsync(
            BinaryData importType, RequestOptions requestOptions, Context context) {
        return PollerFlux.create(
                Duration.ofSeconds(1),
                () -> this.importDevicesWithResponseAsync(importType, requestOptions, context),
                new DefaultPollingStrategy<>(this.client.getHttpPipeline()),
                new TypeReferenceBinaryData(),
                new TypeReferenceBinaryData());
    }

    /**
     * Import existing devices from 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>action</td><td>String</td><td>Yes</td><td>Devices action.</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * String(Devices/Modules/All)
     * }</pre>
     *
     * @param importType The types of devices to import.
     * @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> beginImportDevices(BinaryData importType, RequestOptions requestOptions) {
        return this.beginImportDevicesAsync(importType, requestOptions).getSyncPoller();
    }

    /**
     * Gets the device properties and latest deployment status for a device connected 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
     * {
     *     deviceId: String
     *     moduleId: String
     *     deviceClassId: String
     *     manufacturer: String
     *     model: String
     *     groupId: String
     *     lastAttemptedUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *     installedUpdateId: (recursive schema, see installedUpdateId above)
     *     onLatestUpdate: boolean
     *     lastDeploymentId: String
     *     lastInstallResult: {
     *         resultCode: int
     *         extendedResultCode: int
     *         resultDetails: String
     *         stepResults: [
     *             {
     *                 updateId: (recursive schema, see updateId above)
     *                 description: String
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *             }
     *         ]
     *     }
     * }
     * }</pre>
     *
     * @param deviceId Device identifier in Azure IoT Hub.
     * @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 device properties and latest deployment status for a device connected to Device Update for IoT Hub
     *     along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceWithResponseAsync(String deviceId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getDevice(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                deviceId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the device properties and latest deployment status for a device connected 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
     * {
     *     deviceId: String
     *     moduleId: String
     *     deviceClassId: String
     *     manufacturer: String
     *     model: String
     *     groupId: String
     *     lastAttemptedUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *     installedUpdateId: (recursive schema, see installedUpdateId above)
     *     onLatestUpdate: boolean
     *     lastDeploymentId: String
     *     lastInstallResult: {
     *         resultCode: int
     *         extendedResultCode: int
     *         resultDetails: String
     *         stepResults: [
     *             {
     *                 updateId: (recursive schema, see updateId above)
     *                 description: String
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *             }
     *         ]
     *     }
     * }
     * }</pre>
     *
     * @param deviceId Device identifier in Azure IoT Hub.
     * @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 device properties and latest deployment status for a device connected to Device Update for IoT Hub
     *     along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceWithResponseAsync(
            String deviceId, RequestOptions requestOptions, Context context) {
        return service.getDevice(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                deviceId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the device properties and latest deployment status for a device connected 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
     * {
     *     deviceId: String
     *     moduleId: String
     *     deviceClassId: String
     *     manufacturer: String
     *     model: String
     *     groupId: String
     *     lastAttemptedUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *     installedUpdateId: (recursive schema, see installedUpdateId above)
     *     onLatestUpdate: boolean
     *     lastDeploymentId: String
     *     lastInstallResult: {
     *         resultCode: int
     *         extendedResultCode: int
     *         resultDetails: String
     *         stepResults: [
     *             {
     *                 updateId: (recursive schema, see updateId above)
     *                 description: String
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *             }
     *         ]
     *     }
     * }
     * }</pre>
     *
     * @param deviceId Device identifier in Azure IoT Hub.
     * @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 device properties and latest deployment status for a device connected to Device Update for IoT Hub
     *     along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getDeviceWithResponse(String deviceId, RequestOptions requestOptions) {
        return getDeviceWithResponseAsync(deviceId, requestOptions).block();
    }

    /**
     * Gets the device module properties and latest deployment status for a device module connected 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
     * {
     *     deviceId: String
     *     moduleId: String
     *     deviceClassId: String
     *     manufacturer: String
     *     model: String
     *     groupId: String
     *     lastAttemptedUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *     installedUpdateId: (recursive schema, see installedUpdateId above)
     *     onLatestUpdate: boolean
     *     lastDeploymentId: String
     *     lastInstallResult: {
     *         resultCode: int
     *         extendedResultCode: int
     *         resultDetails: String
     *         stepResults: [
     *             {
     *                 updateId: (recursive schema, see updateId above)
     *                 description: String
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *             }
     *         ]
     *     }
     * }
     * }</pre>
     *
     * @param deviceId Device identifier in Azure IoT Hub.
     * @param moduleId Device module identifier in Azure IoT Hub.
     * @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 device module properties and latest deployment status for a device module connected to Device Update
     *     for IoT Hub along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceModuleWithResponseAsync(
            String deviceId, String moduleId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getDeviceModule(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                deviceId,
                                moduleId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the device module properties and latest deployment status for a device module connected 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
     * {
     *     deviceId: String
     *     moduleId: String
     *     deviceClassId: String
     *     manufacturer: String
     *     model: String
     *     groupId: String
     *     lastAttemptedUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *     installedUpdateId: (recursive schema, see installedUpdateId above)
     *     onLatestUpdate: boolean
     *     lastDeploymentId: String
     *     lastInstallResult: {
     *         resultCode: int
     *         extendedResultCode: int
     *         resultDetails: String
     *         stepResults: [
     *             {
     *                 updateId: (recursive schema, see updateId above)
     *                 description: String
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *             }
     *         ]
     *     }
     * }
     * }</pre>
     *
     * @param deviceId Device identifier in Azure IoT Hub.
     * @param moduleId Device module identifier in Azure IoT Hub.
     * @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 device module properties and latest deployment status for a device module connected to Device Update
     *     for IoT Hub along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceModuleWithResponseAsync(
            String deviceId, String moduleId, RequestOptions requestOptions, Context context) {
        return service.getDeviceModule(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                deviceId,
                moduleId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the device module properties and latest deployment status for a device module connected 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
     * {
     *     deviceId: String
     *     moduleId: String
     *     deviceClassId: String
     *     manufacturer: String
     *     model: String
     *     groupId: String
     *     lastAttemptedUpdateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *     installedUpdateId: (recursive schema, see installedUpdateId above)
     *     onLatestUpdate: boolean
     *     lastDeploymentId: String
     *     lastInstallResult: {
     *         resultCode: int
     *         extendedResultCode: int
     *         resultDetails: String
     *         stepResults: [
     *             {
     *                 updateId: (recursive schema, see updateId above)
     *                 description: String
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *             }
     *         ]
     *     }
     * }
     * }</pre>
     *
     * @param deviceId Device identifier in Azure IoT Hub.
     * @param moduleId Device module identifier in Azure IoT Hub.
     * @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 device module properties and latest deployment status for a device module connected to Device Update
     *     for IoT Hub along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getDeviceModuleWithResponse(
            String deviceId, String moduleId, RequestOptions requestOptions) {
        return getDeviceModuleWithResponseAsync(deviceId, moduleId, requestOptions).block();
    }

    /**
     * Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress
     * receiving new updates.
     *
     * <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
     * {
     *     totalDeviceCount: int
     *     onLatestUpdateDeviceCount: int
     *     newUpdatesAvailableDeviceCount: int
     *     updatesInProgressDeviceCount: int
     * }
     * }</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 the breakdown of how many devices are on their latest update, have new updates available, or are in
     *     progress receiving new updates along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getUpdateComplianceWithResponseAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getUpdateCompliance(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress
     * receiving new updates.
     *
     * <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
     * {
     *     totalDeviceCount: int
     *     onLatestUpdateDeviceCount: int
     *     newUpdatesAvailableDeviceCount: int
     *     updatesInProgressDeviceCount: int
     * }
     * }</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 the breakdown of how many devices are on their latest update, have new updates available, or are in
     *     progress receiving new updates along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getUpdateComplianceWithResponseAsync(
            RequestOptions requestOptions, Context context) {
        return service.getUpdateCompliance(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress
     * receiving new updates.
     *
     * <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
     * {
     *     totalDeviceCount: int
     *     onLatestUpdateDeviceCount: int
     *     newUpdatesAvailableDeviceCount: int
     *     updatesInProgressDeviceCount: int
     * }
     * }</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 the breakdown of how many devices are on their latest update, have new updates available, or are in
     *     progress receiving new updates along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getUpdateComplianceWithResponse(RequestOptions requestOptions) {
        return getUpdateComplianceWithResponseAsync(requestOptions).block();
    }

    /**
     * Gets a list of available group device tags for all devices connected 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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 available group device tags for all devices connected to Device Update for IoT Hub along with
     *     {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceTagsSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeviceTags(
                                        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));
    }

    /**
     * Gets a list of available group device tags for all devices connected 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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 available group device tags for all devices connected to Device Update for IoT Hub along with
     *     {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceTagsSinglePageAsync(
            RequestOptions requestOptions, Context context) {
        return service.listDeviceTags(
                        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));
    }

    /**
     * Gets a list of available group device tags for all devices connected 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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 available group device tags for all devices connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeviceTagsAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listDeviceTagsSinglePageAsync(requestOptions),
                nextLink -> listDeviceTagsNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of available group device tags for all devices connected 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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 available group device tags for all devices connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeviceTagsAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listDeviceTagsSinglePageAsync(requestOptions, context),
                nextLink -> listDeviceTagsNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of available group device tags for all devices connected 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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 available group device tags for all devices connected to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listDeviceTags(RequestOptions requestOptions) {
        return new PagedIterable<>(listDeviceTagsAsync(requestOptions));
    }

    /**
     * Gets a count of how many devices have a device tag.
     *
     * <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
     * {
     *     tagName: String
     *     deviceCount: int
     * }
     * }</pre>
     *
     * @param tagName Tag 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 count of how many devices have a device tag along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceTagWithResponseAsync(String tagName, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getDeviceTag(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                tagName,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets a count of how many devices have a device tag.
     *
     * <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
     * {
     *     tagName: String
     *     deviceCount: int
     * }
     * }</pre>
     *
     * @param tagName Tag 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 count of how many devices have a device tag along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeviceTagWithResponseAsync(
            String tagName, RequestOptions requestOptions, Context context) {
        return service.getDeviceTag(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                tagName,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets a count of how many devices have a device tag.
     *
     * <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
     * {
     *     tagName: String
     *     deviceCount: int
     * }
     * }</pre>
     *
     * @param tagName Tag 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 count of how many devices have a device tag along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getDeviceTagWithResponse(String tagName, RequestOptions requestOptions) {
        return getDeviceTagWithResponseAsync(tagName, requestOptions).block();
    }

    /**
     * Gets a list of all device groups.
     *
     * <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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 device groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listGroupsSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listGroups(
                                        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));
    }

    /**
     * Gets a list of all device groups.
     *
     * <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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 device groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listGroupsSinglePageAsync(RequestOptions requestOptions, Context context) {
        return service.listGroups(
                        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));
    }

    /**
     * Gets a list of all device groups.
     *
     * <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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 device groups.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listGroupsAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listGroupsSinglePageAsync(requestOptions),
                nextLink -> listGroupsNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of all device groups.
     *
     * <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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 device groups.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listGroupsAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listGroupsSinglePageAsync(requestOptions, context),
                nextLink -> listGroupsNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of all device groups.
     *
     * <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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 device groups.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listGroups(RequestOptions requestOptions) {
        return new PagedIterable<>(listGroupsAsync(requestOptions));
    }

    /**
     * Gets the properties of a group.
     *
     * <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
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 properties of a group along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getGroupWithResponseAsync(String groupId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getGroup(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the properties of a group.
     *
     * <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
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 properties of a group along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getGroupWithResponseAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return service.getGroup(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the properties of a group.
     *
     * <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
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 properties of a group along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getGroupWithResponse(String groupId, RequestOptions requestOptions) {
        return getGroupWithResponseAsync(groupId, requestOptions).block();
    }

    /**
     * Create or update a device group.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param group The group properties.
     * @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 group details along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createOrUpdateGroupWithResponseAsync(
            String groupId, BinaryData group, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.createOrUpdateGroup(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                this.client.getServiceVersion().getVersion(),
                                group,
                                requestOptions,
                                context));
    }

    /**
     * Create or update a device group.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param group The group properties.
     * @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 group details along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createOrUpdateGroupWithResponseAsync(
            String groupId, BinaryData group, RequestOptions requestOptions, Context context) {
        return service.createOrUpdateGroup(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                this.client.getServiceVersion().getVersion(),
                group,
                requestOptions,
                context);
    }

    /**
     * Create or update a device group.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     groupId: String
     *     groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *     tags: [
     *         String
     *     ]
     *     createdDateTime: String
     *     deviceCount: Integer
     *     deploymentId: String
     *     deviceClassId: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param group The group properties.
     * @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 group details along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> createOrUpdateGroupWithResponse(
            String groupId, BinaryData group, RequestOptions requestOptions) {
        return createOrUpdateGroupWithResponseAsync(groupId, group, requestOptions).block();
    }

    /**
     * Deletes a device group.
     *
     * <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 groupId Group identity.
     * @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>> deleteGroupWithResponseAsync(String groupId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.deleteGroup(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Deletes a device group.
     *
     * <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 groupId Group identity.
     * @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>> deleteGroupWithResponseAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return service.deleteGroup(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Deletes a device group.
     *
     * <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 groupId Group identity.
     * @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}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> deleteGroupWithResponse(String groupId, RequestOptions requestOptions) {
        return deleteGroupWithResponseAsync(groupId, requestOptions).block();
    }

    /**
     * Get group update compliance information such as how many devices are on their latest update, how many need new
     * updates, and how many are in progress on receiving a new update.
     *
     * <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
     * {
     *     totalDeviceCount: int
     *     onLatestUpdateDeviceCount: int
     *     newUpdatesAvailableDeviceCount: int
     *     updatesInProgressDeviceCount: int
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 group update compliance information such as how many devices are on their latest update, how many need
     *     new updates, and how many are in progress on receiving a new update along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getGroupUpdateComplianceWithResponseAsync(
            String groupId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getGroupUpdateCompliance(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Get group update compliance information such as how many devices are on their latest update, how many need new
     * updates, and how many are in progress on receiving a new update.
     *
     * <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
     * {
     *     totalDeviceCount: int
     *     onLatestUpdateDeviceCount: int
     *     newUpdatesAvailableDeviceCount: int
     *     updatesInProgressDeviceCount: int
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 group update compliance information such as how many devices are on their latest update, how many need
     *     new updates, and how many are in progress on receiving a new update along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getGroupUpdateComplianceWithResponseAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return service.getGroupUpdateCompliance(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Get group update compliance information such as how many devices are on their latest update, how many need new
     * updates, and how many are in progress on receiving a new update.
     *
     * <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
     * {
     *     totalDeviceCount: int
     *     onLatestUpdateDeviceCount: int
     *     newUpdatesAvailableDeviceCount: int
     *     updatesInProgressDeviceCount: int
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 group update compliance information such as how many devices are on their latest update, how many need
     *     new updates, and how many are in progress on receiving a new update along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getGroupUpdateComplianceWithResponse(String groupId, RequestOptions requestOptions) {
        return getGroupUpdateComplianceWithResponseAsync(groupId, requestOptions).block();
    }

    /**
     * Get the best available updates for a group and a count of how many devices need each update.
     *
     * <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 bestUpdates returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 best available updates for a group and a count of how many devices need each update along with {@link
     *     PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listBestUpdatesForGroupSinglePageAsync(
            String groupId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listBestUpdatesForGroup(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        groupId,
                                        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 the best available updates for a group and a count of how many devices need each update.
     *
     * <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 bestUpdates returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 best available updates for a group and a count of how many devices need each update along with {@link
     *     PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listBestUpdatesForGroupSinglePageAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return service.listBestUpdatesForGroup(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        groupId,
                        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 the best available updates for a group and a count of how many devices need each update.
     *
     * <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 bestUpdates returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 best available updates for a group and a count of how many devices need each update.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listBestUpdatesForGroupAsync(String groupId, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listBestUpdatesForGroupSinglePageAsync(groupId, requestOptions),
                nextLink -> listBestUpdatesForGroupNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get the best available updates for a group and a count of how many devices need each update.
     *
     * <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 bestUpdates returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 best available updates for a group and a count of how many devices need each update.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listBestUpdatesForGroupAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listBestUpdatesForGroupSinglePageAsync(groupId, requestOptions, context),
                nextLink -> listBestUpdatesForGroupNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get the best available updates for a group and a count of how many devices need each update.
     *
     * <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 bestUpdates returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 best available updates for a group and a count of how many devices need each update.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listBestUpdatesForGroup(String groupId, RequestOptions requestOptions) {
        return new PagedIterable<>(listBestUpdatesForGroupAsync(groupId, requestOptions));
    }

    /**
     * Gets a list of deployments for a group.
     *
     * <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 deployments returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 deployments for a group along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentsForGroupSinglePageAsync(
            String groupId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeploymentsForGroup(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        groupId,
                                        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));
    }

    /**
     * Gets a list of deployments for a group.
     *
     * <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 deployments returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 deployments for a group along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentsForGroupSinglePageAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return service.listDeploymentsForGroup(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        groupId,
                        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));
    }

    /**
     * Gets a list of deployments for a group.
     *
     * <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 deployments returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 deployments for a group.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeploymentsForGroupAsync(String groupId, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listDeploymentsForGroupSinglePageAsync(groupId, requestOptions),
                nextLink -> listDeploymentsForGroupNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of deployments for a group.
     *
     * <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 deployments returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 deployments for a group.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeploymentsForGroupAsync(
            String groupId, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listDeploymentsForGroupSinglePageAsync(groupId, requestOptions, context),
                nextLink -> listDeploymentsForGroupNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of deployments for a group.
     *
     * <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 deployments returned. You can filter on update Provider, Name and Version property.</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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @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 deployments for a group.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listDeploymentsForGroup(String groupId, RequestOptions requestOptions) {
        return new PagedIterable<>(listDeploymentsForGroupAsync(groupId, requestOptions));
    }

    /**
     * Gets the properties of a deployment.
     *
     * <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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 the properties of a deployment along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getDeployment(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                deploymentId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the properties of a deployment.
     *
     * <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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 the properties of a deployment along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return service.getDeployment(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                deploymentId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the properties of a deployment.
     *
     * <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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 the properties of a deployment along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getDeploymentWithResponse(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return getDeploymentWithResponseAsync(groupId, deploymentId, requestOptions).block();
    }

    /**
     * Creates or updates a deployment.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param deploymentId Deployment identifier.
     * @param groupId Group identity.
     * @param deployment The deployment properties.
     * @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 deployment metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createOrUpdateDeploymentWithResponseAsync(
            String deploymentId, String groupId, BinaryData deployment, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.createOrUpdateDeployment(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                deploymentId,
                                groupId,
                                this.client.getServiceVersion().getVersion(),
                                deployment,
                                requestOptions,
                                context));
    }

    /**
     * Creates or updates a deployment.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param deploymentId Deployment identifier.
     * @param groupId Group identity.
     * @param deployment The deployment properties.
     * @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 deployment metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> createOrUpdateDeploymentWithResponseAsync(
            String deploymentId,
            String groupId,
            BinaryData deployment,
            RequestOptions requestOptions,
            Context context) {
        return service.createOrUpdateDeployment(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                deploymentId,
                groupId,
                this.client.getServiceVersion().getVersion(),
                deployment,
                requestOptions,
                context);
    }

    /**
     * Creates or updates a deployment.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param deploymentId Deployment identifier.
     * @param groupId Group identity.
     * @param deployment The deployment properties.
     * @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 deployment metadata along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> createOrUpdateDeploymentWithResponse(
            String deploymentId, String groupId, BinaryData deployment, RequestOptions requestOptions) {
        return createOrUpdateDeploymentWithResponseAsync(deploymentId, groupId, deployment, requestOptions).block();
    }

    /**
     * Deletes a deployment.
     *
     * <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 groupId Group identity.
     * @param deploymentId Deployment 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 the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> deleteDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.deleteDeployment(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                deploymentId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Deletes a deployment.
     *
     * <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 groupId Group identity.
     * @param deploymentId Deployment 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 the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> deleteDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return service.deleteDeployment(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                deploymentId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Deletes a deployment.
     *
     * <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 groupId Group identity.
     * @param deploymentId Deployment 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 the {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> deleteDeploymentWithResponse(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return deleteDeploymentWithResponseAsync(groupId, deploymentId, requestOptions).block();
    }

    /**
     * Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress,
     * completed, or failed.
     *
     * <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
     * {
     *     deploymentState: String(Active/Inactive/Canceled)
     *     totalDevices: Integer
     *     devicesInProgressCount: Integer
     *     devicesCompletedFailedCount: Integer
     *     devicesCompletedSucceededCount: Integer
     *     devicesCanceledCount: Integer
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 the status of a deployment including a breakdown of how many devices in the deployment are in progress,
     *     completed, or failed along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeploymentStatusWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getDeploymentStatus(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                deploymentId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress,
     * completed, or failed.
     *
     * <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
     * {
     *     deploymentState: String(Active/Inactive/Canceled)
     *     totalDevices: Integer
     *     devicesInProgressCount: Integer
     *     devicesCompletedFailedCount: Integer
     *     devicesCompletedSucceededCount: Integer
     *     devicesCanceledCount: Integer
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 the status of a deployment including a breakdown of how many devices in the deployment are in progress,
     *     completed, or failed along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getDeploymentStatusWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return service.getDeploymentStatus(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                deploymentId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress,
     * completed, or failed.
     *
     * <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
     * {
     *     deploymentState: String(Active/Inactive/Canceled)
     *     totalDevices: Integer
     *     devicesInProgressCount: Integer
     *     devicesCompletedFailedCount: Integer
     *     devicesCompletedSucceededCount: Integer
     *     devicesCanceledCount: Integer
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 the status of a deployment including a breakdown of how many devices in the deployment are in progress,
     *     completed, or failed along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getDeploymentStatusWithResponse(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return getDeploymentStatusWithResponseAsync(groupId, deploymentId, requestOptions).block();
    }

    /**
     * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices.
     *
     * <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 deployment device states returned. You can filter on deviceId and moduleId and/or deviceState.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 list of devices in a deployment along with their state along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentDevicesSinglePageAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeploymentDevices(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        groupId,
                                        deploymentId,
                                        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));
    }

    /**
     * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices.
     *
     * <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 deployment device states returned. You can filter on deviceId and moduleId and/or deviceState.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 list of devices in a deployment along with their state along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentDevicesSinglePageAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return service.listDeploymentDevices(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        groupId,
                        deploymentId,
                        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));
    }

    /**
     * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices.
     *
     * <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 deployment device states returned. You can filter on deviceId and moduleId and/or deviceState.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 list of devices in a deployment along with their state.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeploymentDevicesAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listDeploymentDevicesSinglePageAsync(groupId, deploymentId, requestOptions),
                nextLink -> listDeploymentDevicesNextSinglePageAsync(nextLink, null));
    }

    /**
     * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices.
     *
     * <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 deployment device states returned. You can filter on deviceId and moduleId and/or deviceState.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 list of devices in a deployment along with their state.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listDeploymentDevicesAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listDeploymentDevicesSinglePageAsync(groupId, deploymentId, requestOptions, context),
                nextLink -> listDeploymentDevicesNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices.
     *
     * <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 deployment device states returned. You can filter on deviceId and moduleId and/or deviceState.</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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 list of devices in a deployment along with their state.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listDeploymentDevices(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return new PagedIterable<>(listDeploymentDevicesAsync(groupId, deploymentId, 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)
     *     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)
     *     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)
     *     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 a list of all device import operations. Completed operations are kept for 7 days before auto-deleted.
     *
     * <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)
     *             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 device import 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 device import operations. Completed operations are kept for 7 days before auto-deleted.
     *
     * <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)
     *             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 device import 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 device import operations. Completed operations are kept for 7 days before auto-deleted.
     *
     * <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)
     *             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 device import 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 device import operations. Completed operations are kept for 7 days before auto-deleted.
     *
     * <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)
     *             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 device import 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 device import operations. Completed operations are kept for 7 days before auto-deleted.
     *
     * <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)
     *             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 device import operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listOperations(RequestOptions requestOptions) {
        return new PagedIterable<>(listOperationsAsync(requestOptions));
    }

    /**
     * Start the device diagnostics log collection operation on specified devices.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</pre>
     *
     * @param operationId Operation identifier.
     * @param logCollectionRequest The deployment properties.
     * @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 diagnostics request body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> collectLogsWithResponseAsync(
            String operationId, BinaryData logCollectionRequest, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.collectLogs(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                operationId,
                                this.client.getServiceVersion().getVersion(),
                                logCollectionRequest,
                                requestOptions,
                                context));
    }

    /**
     * Start the device diagnostics log collection operation on specified devices.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</pre>
     *
     * @param operationId Operation identifier.
     * @param logCollectionRequest The deployment properties.
     * @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 diagnostics request body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> collectLogsWithResponseAsync(
            String operationId, BinaryData logCollectionRequest, RequestOptions requestOptions, Context context) {
        return service.collectLogs(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                operationId,
                this.client.getServiceVersion().getVersion(),
                logCollectionRequest,
                requestOptions,
                context);
    }

    /**
     * Start the device diagnostics log collection operation on specified devices.
     *
     * <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>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</pre>
     *
     * @param operationId Operation identifier.
     * @param logCollectionRequest The deployment properties.
     * @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 diagnostics request body along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> collectLogsWithResponse(
            String operationId, BinaryData logCollectionRequest, RequestOptions requestOptions) {
        return collectLogsWithResponseAsync(operationId, logCollectionRequest, requestOptions).block();
    }

    /**
     * Get the device diagnostics log collection operation.
     *
     * <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
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</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 the device diagnostics log collection operation along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getLogCollectionOperationWithResponseAsync(
            String operationId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getLogCollectionOperation(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                operationId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Get the device diagnostics log collection operation.
     *
     * <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
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</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 the device diagnostics log collection operation along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getLogCollectionOperationWithResponseAsync(
            String operationId, RequestOptions requestOptions, Context context) {
        return service.getLogCollectionOperation(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                operationId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Get the device diagnostics log collection operation.
     *
     * <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
     * {
     *     operationId: String
     *     deviceList: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *         }
     *     ]
     *     description: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     * }
     * }</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 the device diagnostics log collection operation along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getLogCollectionOperationWithResponse(
            String operationId, RequestOptions requestOptions) {
        return getLogCollectionOperationWithResponseAsync(operationId, requestOptions).block();
    }

    /**
     * Get all device diagnostics log collection operations.
     *
     * <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: [
     *         {
     *             operationId: String
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 all device diagnostics log collection operations along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listLogCollectionOperationsSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listLogCollectionOperations(
                                        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 all device diagnostics log collection operations.
     *
     * <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: [
     *         {
     *             operationId: String
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 all device diagnostics log collection operations along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listLogCollectionOperationsSinglePageAsync(
            RequestOptions requestOptions, Context context) {
        return service.listLogCollectionOperations(
                        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 all device diagnostics log collection operations.
     *
     * <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: [
     *         {
     *             operationId: String
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 all device diagnostics log collection operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listLogCollectionOperationsAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listLogCollectionOperationsSinglePageAsync(requestOptions),
                nextLink -> listLogCollectionOperationsNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get all device diagnostics log collection operations.
     *
     * <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: [
     *         {
     *             operationId: String
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 all device diagnostics log collection operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listLogCollectionOperationsAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listLogCollectionOperationsSinglePageAsync(requestOptions, context),
                nextLink -> listLogCollectionOperationsNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get all device diagnostics log collection operations.
     *
     * <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: [
     *         {
     *             operationId: String
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 all device diagnostics log collection operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listLogCollectionOperations(RequestOptions requestOptions) {
        return new PagedIterable<>(listLogCollectionOperationsAsync(requestOptions));
    }

    /**
     * Get device diagnostics log collection operation with detailed 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>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *     deviceStatus: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             resultCode: String
     *             extendedResultCode: String
     *             logLocation: String
     *         }
     *     ]
     *     description: 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 device diagnostics log collection operation with detailed status along with {@link Response} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getLogCollectionOperationDetailedStatusWithResponseAsync(
            String operationId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getLogCollectionOperationDetailedStatus(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                operationId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Get device diagnostics log collection operation with detailed 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>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *     deviceStatus: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             resultCode: String
     *             extendedResultCode: String
     *             logLocation: String
     *         }
     *     ]
     *     description: 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 device diagnostics log collection operation with detailed status along with {@link Response} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getLogCollectionOperationDetailedStatusWithResponseAsync(
            String operationId, RequestOptions requestOptions, Context context) {
        return service.getLogCollectionOperationDetailedStatus(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                operationId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Get device diagnostics log collection operation with detailed 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>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     createdDateTime: String
     *     lastActionDateTime: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *     deviceStatus: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             resultCode: String
     *             extendedResultCode: String
     *             logLocation: String
     *         }
     *     ]
     *     description: 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 device diagnostics log collection operation with detailed status along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getLogCollectionOperationDetailedStatusWithResponse(
            String operationId, RequestOptions requestOptions) {
        return getLogCollectionOperationDetailedStatusWithResponseAsync(operationId, requestOptions).block();
    }

    /**
     * Stops a deployment.
     *
     * <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>Cancel deployment action.</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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 deployment metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> stopDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.stopDeployment(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                deploymentId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Stops a deployment.
     *
     * <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>Cancel deployment action.</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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 deployment metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> stopDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return service.stopDeployment(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                deploymentId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Stops a deployment.
     *
     * <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>Cancel deployment action.</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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 deployment metadata along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> stopDeploymentWithResponse(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return stopDeploymentWithResponseAsync(groupId, deploymentId, requestOptions).block();
    }

    /**
     * Retries a deployment with failed devices.
     *
     * <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>Retry deployment action.</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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 deployment metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> retryDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.retryDeployment(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                groupId,
                                deploymentId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Retries a deployment with failed devices.
     *
     * <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>Retry deployment action.</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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 deployment metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> retryDeploymentWithResponseAsync(
            String groupId, String deploymentId, RequestOptions requestOptions, Context context) {
        return service.retryDeployment(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                groupId,
                deploymentId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Retries a deployment with failed devices.
     *
     * <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>Retry deployment action.</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
     * {
     *     deploymentId: String
     *     startDateTime: String
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     groupId: String
     *     isCanceled: Boolean
     *     isRetried: Boolean
     * }
     * }</pre>
     *
     * @param groupId Group identity.
     * @param deploymentId Deployment 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 deployment metadata along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> retryDeploymentWithResponse(
            String groupId, String deploymentId, RequestOptions requestOptions) {
        return retryDeploymentWithResponseAsync(groupId, deploymentId, requestOptions).block();
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceClassesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeviceClassesNext(
                                        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: [
     *         {
     *             deviceClassId: String
     *             compatProperties: {
     *                 String: String
     *             }
     *             bestCompatibleUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: 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 device classes along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceClassesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listDeviceClassesNext(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: [
     *         {
     *             provider: String
     *             name: String
     *             version: 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 update identities along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listInstallableUpdatesForDeviceClassNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listInstallableUpdatesForDeviceClassNext(
                                        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: [
     *         {
     *             provider: String
     *             name: String
     *             version: 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 update identities along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listInstallableUpdatesForDeviceClassNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listInstallableUpdatesForDeviceClassNext(
                        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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDevicesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDevicesNext(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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             deviceClassId: String
     *             manufacturer: String
     *             model: String
     *             groupId: String
     *             lastAttemptedUpdateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             deploymentStatus: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *             installedUpdateId: (recursive schema, see installedUpdateId above)
     *             onLatestUpdate: boolean
     *             lastDeploymentId: String
     *             lastInstallResult: {
     *                 resultCode: int
     *                 extendedResultCode: int
     *                 resultDetails: String
     *                 stepResults: [
     *                     {
     *                         updateId: (recursive schema, see updateId above)
     *                         description: String
     *                         resultCode: int
     *                         extendedResultCode: int
     *                         resultDetails: 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 devices along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDevicesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listDevicesNext(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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 device tags along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceTagsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeviceTagsNext(
                                        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: [
     *         {
     *             tagName: String
     *             deviceCount: int
     *         }
     *     ]
     *     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 device tags along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeviceTagsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listDeviceTagsNext(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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listGroupsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context -> service.listGroupsNext(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: [
     *         {
     *             groupId: String
     *             groupType: String(DeviceClassIdAndIoTHubTag/InvalidDeviceClassIdAndIoTHubTag/DefaultDeviceClassId)
     *             tags: [
     *                 String
     *             ]
     *             createdDateTime: String
     *             deviceCount: Integer
     *             deploymentId: String
     *             deviceClassId: 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 groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listGroupsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listGroupsNext(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
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     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 updatable devices along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listBestUpdatesForGroupNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listBestUpdatesForGroupNext(
                                        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
     *             }
     *             deviceCount: int
     *         }
     *     ]
     *     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 updatable devices along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listBestUpdatesForGroupNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listBestUpdatesForGroupNext(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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     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 deployments along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentsForGroupNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeploymentsForGroupNext(
                                        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: [
     *         {
     *             deploymentId: String
     *             startDateTime: String
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             groupId: String
     *             isCanceled: Boolean
     *             isRetried: Boolean
     *         }
     *     ]
     *     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 deployments along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentsForGroupNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listDeploymentsForGroupNext(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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     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 deployment device states along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentDevicesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listDeploymentDevicesNext(
                                        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: [
     *         {
     *             deviceId: String
     *             moduleId: String
     *             retryCount: int
     *             movedOnToNewDeployment: boolean
     *             deviceState: String(Succeeded/InProgress/Failed/Canceled/Incompatible)
     *         }
     *     ]
     *     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 deployment device states along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listDeploymentDevicesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listDeploymentDevicesNext(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)
     *             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 device 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)
     *             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 device 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));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 diagnostics operations with server paging support along with {@link PagedResponse} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listLogCollectionOperationsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listLogCollectionOperationsNext(
                                        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
     *             deviceList: [
     *                 {
     *                     deviceId: String
     *                     moduleId: String
     *                 }
     *             ]
     *             description: String
     *             createdDateTime: String
     *             lastActionDateTime: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *         }
     *     ]
     *     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 diagnostics operations with server paging support along with {@link PagedResponse} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listLogCollectionOperationsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listLogCollectionOperationsNext(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;
        }
    }
}