/*
 * Copyright (c) Microsoft Corporation.
 * Licensed under the MIT License.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is regenerated.
 */

import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Diagnostics } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { WebSiteManagementClient } from "../webSiteManagementClient";
import {
  DetectorResponse,
  DiagnosticsListHostingEnvironmentDetectorResponsesNextOptionalParams,
  DiagnosticsListHostingEnvironmentDetectorResponsesOptionalParams,
  DiagnosticsListHostingEnvironmentDetectorResponsesResponse,
  DiagnosticsListSiteDetectorResponsesNextOptionalParams,
  DiagnosticsListSiteDetectorResponsesOptionalParams,
  DiagnosticsListSiteDetectorResponsesResponse,
  DiagnosticCategory,
  DiagnosticsListSiteDiagnosticCategoriesNextOptionalParams,
  DiagnosticsListSiteDiagnosticCategoriesOptionalParams,
  DiagnosticsListSiteDiagnosticCategoriesResponse,
  AnalysisDefinition,
  DiagnosticsListSiteAnalysesNextOptionalParams,
  DiagnosticsListSiteAnalysesOptionalParams,
  DiagnosticsListSiteAnalysesResponse,
  DetectorDefinitionResource,
  DiagnosticsListSiteDetectorsNextOptionalParams,
  DiagnosticsListSiteDetectorsOptionalParams,
  DiagnosticsListSiteDetectorsResponse,
  DiagnosticsListSiteDetectorResponsesSlotNextOptionalParams,
  DiagnosticsListSiteDetectorResponsesSlotOptionalParams,
  DiagnosticsListSiteDetectorResponsesSlotResponse,
  DiagnosticsListSiteDiagnosticCategoriesSlotNextOptionalParams,
  DiagnosticsListSiteDiagnosticCategoriesSlotOptionalParams,
  DiagnosticsListSiteDiagnosticCategoriesSlotResponse,
  DiagnosticsListSiteAnalysesSlotNextOptionalParams,
  DiagnosticsListSiteAnalysesSlotOptionalParams,
  DiagnosticsListSiteAnalysesSlotResponse,
  DiagnosticsListSiteDetectorsSlotNextOptionalParams,
  DiagnosticsListSiteDetectorsSlotOptionalParams,
  DiagnosticsListSiteDetectorsSlotResponse,
  DiagnosticsGetHostingEnvironmentDetectorResponseOptionalParams,
  DiagnosticsGetHostingEnvironmentDetectorResponseResponse,
  DiagnosticsGetSiteDetectorResponseOptionalParams,
  DiagnosticsGetSiteDetectorResponseResponse,
  DiagnosticsGetSiteDiagnosticCategoryOptionalParams,
  DiagnosticsGetSiteDiagnosticCategoryResponse,
  DiagnosticsGetSiteAnalysisOptionalParams,
  DiagnosticsGetSiteAnalysisResponse,
  DiagnosticsExecuteSiteAnalysisOptionalParams,
  DiagnosticsExecuteSiteAnalysisResponse,
  DiagnosticsGetSiteDetectorOptionalParams,
  DiagnosticsGetSiteDetectorResponse,
  DiagnosticsExecuteSiteDetectorOptionalParams,
  DiagnosticsExecuteSiteDetectorResponse,
  DiagnosticsGetSiteDetectorResponseSlotOptionalParams,
  DiagnosticsGetSiteDetectorResponseSlotResponse,
  DiagnosticsGetSiteDiagnosticCategorySlotOptionalParams,
  DiagnosticsGetSiteDiagnosticCategorySlotResponse,
  DiagnosticsGetSiteAnalysisSlotOptionalParams,
  DiagnosticsGetSiteAnalysisSlotResponse,
  DiagnosticsExecuteSiteAnalysisSlotOptionalParams,
  DiagnosticsExecuteSiteAnalysisSlotResponse,
  DiagnosticsGetSiteDetectorSlotOptionalParams,
  DiagnosticsGetSiteDetectorSlotResponse,
  DiagnosticsExecuteSiteDetectorSlotOptionalParams,
  DiagnosticsExecuteSiteDetectorSlotResponse,
  DiagnosticsListHostingEnvironmentDetectorResponsesNextResponse,
  DiagnosticsListSiteDetectorResponsesNextResponse,
  DiagnosticsListSiteDiagnosticCategoriesNextResponse,
  DiagnosticsListSiteAnalysesNextResponse,
  DiagnosticsListSiteDetectorsNextResponse,
  DiagnosticsListSiteDetectorResponsesSlotNextResponse,
  DiagnosticsListSiteDiagnosticCategoriesSlotNextResponse,
  DiagnosticsListSiteAnalysesSlotNextResponse,
  DiagnosticsListSiteDetectorsSlotNextResponse
} from "../models";

/// <reference lib="esnext.asynciterable" />
/** Class containing Diagnostics operations. */
export class DiagnosticsImpl implements Diagnostics {
  private readonly client: WebSiteManagementClient;

  /**
   * Initialize a new instance of the class Diagnostics class.
   * @param client Reference to the service client
   */
  constructor(client: WebSiteManagementClient) {
    this.client = client;
  }

  /**
   * Description for List Hosting Environment Detector Responses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param name Site Name
   * @param options The options parameters.
   */
  public listHostingEnvironmentDetectorResponses(
    resourceGroupName: string,
    name: string,
    options?: DiagnosticsListHostingEnvironmentDetectorResponsesOptionalParams
  ): PagedAsyncIterableIterator<DetectorResponse> {
    const iter = this.listHostingEnvironmentDetectorResponsesPagingAll(
      resourceGroupName,
      name,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listHostingEnvironmentDetectorResponsesPagingPage(
          resourceGroupName,
          name,
          options,
          settings
        );
      }
    };
  }

  private async *listHostingEnvironmentDetectorResponsesPagingPage(
    resourceGroupName: string,
    name: string,
    options?: DiagnosticsListHostingEnvironmentDetectorResponsesOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DetectorResponse[]> {
    let result: DiagnosticsListHostingEnvironmentDetectorResponsesResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listHostingEnvironmentDetectorResponses(
        resourceGroupName,
        name,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listHostingEnvironmentDetectorResponsesNext(
        resourceGroupName,
        name,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listHostingEnvironmentDetectorResponsesPagingAll(
    resourceGroupName: string,
    name: string,
    options?: DiagnosticsListHostingEnvironmentDetectorResponsesOptionalParams
  ): AsyncIterableIterator<DetectorResponse> {
    for await (const page of this.listHostingEnvironmentDetectorResponsesPagingPage(
      resourceGroupName,
      name,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for List Site Detector Responses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param options The options parameters.
   */
  public listSiteDetectorResponses(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDetectorResponsesOptionalParams
  ): PagedAsyncIterableIterator<DetectorResponse> {
    const iter = this.listSiteDetectorResponsesPagingAll(
      resourceGroupName,
      siteName,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteDetectorResponsesPagingPage(
          resourceGroupName,
          siteName,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteDetectorResponsesPagingPage(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDetectorResponsesOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DetectorResponse[]> {
    let result: DiagnosticsListSiteDetectorResponsesResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteDetectorResponses(
        resourceGroupName,
        siteName,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteDetectorResponsesNext(
        resourceGroupName,
        siteName,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteDetectorResponsesPagingAll(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDetectorResponsesOptionalParams
  ): AsyncIterableIterator<DetectorResponse> {
    for await (const page of this.listSiteDetectorResponsesPagingPage(
      resourceGroupName,
      siteName,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for Get Diagnostics Categories
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param options The options parameters.
   */
  public listSiteDiagnosticCategories(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesOptionalParams
  ): PagedAsyncIterableIterator<DiagnosticCategory> {
    const iter = this.listSiteDiagnosticCategoriesPagingAll(
      resourceGroupName,
      siteName,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteDiagnosticCategoriesPagingPage(
          resourceGroupName,
          siteName,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteDiagnosticCategoriesPagingPage(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DiagnosticCategory[]> {
    let result: DiagnosticsListSiteDiagnosticCategoriesResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteDiagnosticCategories(
        resourceGroupName,
        siteName,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteDiagnosticCategoriesNext(
        resourceGroupName,
        siteName,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteDiagnosticCategoriesPagingAll(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesOptionalParams
  ): AsyncIterableIterator<DiagnosticCategory> {
    for await (const page of this.listSiteDiagnosticCategoriesPagingPage(
      resourceGroupName,
      siteName,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for Get Site Analyses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param options The options parameters.
   */
  public listSiteAnalyses(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteAnalysesOptionalParams
  ): PagedAsyncIterableIterator<AnalysisDefinition> {
    const iter = this.listSiteAnalysesPagingAll(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteAnalysesPagingPage(
          resourceGroupName,
          siteName,
          diagnosticCategory,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteAnalysesPagingPage(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteAnalysesOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<AnalysisDefinition[]> {
    let result: DiagnosticsListSiteAnalysesResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteAnalyses(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteAnalysesNext(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteAnalysesPagingAll(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteAnalysesOptionalParams
  ): AsyncIterableIterator<AnalysisDefinition> {
    for await (const page of this.listSiteAnalysesPagingPage(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for Get Detectors
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param options The options parameters.
   */
  public listSiteDetectors(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteDetectorsOptionalParams
  ): PagedAsyncIterableIterator<DetectorDefinitionResource> {
    const iter = this.listSiteDetectorsPagingAll(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteDetectorsPagingPage(
          resourceGroupName,
          siteName,
          diagnosticCategory,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteDetectorsPagingPage(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteDetectorsOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DetectorDefinitionResource[]> {
    let result: DiagnosticsListSiteDetectorsResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteDetectors(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteDetectorsNext(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteDetectorsPagingAll(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteDetectorsOptionalParams
  ): AsyncIterableIterator<DetectorDefinitionResource> {
    for await (const page of this.listSiteDetectorsPagingPage(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for List Site Detector Responses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  public listSiteDetectorResponsesSlot(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorResponsesSlotOptionalParams
  ): PagedAsyncIterableIterator<DetectorResponse> {
    const iter = this.listSiteDetectorResponsesSlotPagingAll(
      resourceGroupName,
      siteName,
      slot,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteDetectorResponsesSlotPagingPage(
          resourceGroupName,
          siteName,
          slot,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteDetectorResponsesSlotPagingPage(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorResponsesSlotOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DetectorResponse[]> {
    let result: DiagnosticsListSiteDetectorResponsesSlotResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteDetectorResponsesSlot(
        resourceGroupName,
        siteName,
        slot,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteDetectorResponsesSlotNext(
        resourceGroupName,
        siteName,
        slot,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteDetectorResponsesSlotPagingAll(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorResponsesSlotOptionalParams
  ): AsyncIterableIterator<DetectorResponse> {
    for await (const page of this.listSiteDetectorResponsesSlotPagingPage(
      resourceGroupName,
      siteName,
      slot,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for Get Diagnostics Categories
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  public listSiteDiagnosticCategoriesSlot(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesSlotOptionalParams
  ): PagedAsyncIterableIterator<DiagnosticCategory> {
    const iter = this.listSiteDiagnosticCategoriesSlotPagingAll(
      resourceGroupName,
      siteName,
      slot,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteDiagnosticCategoriesSlotPagingPage(
          resourceGroupName,
          siteName,
          slot,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteDiagnosticCategoriesSlotPagingPage(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesSlotOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DiagnosticCategory[]> {
    let result: DiagnosticsListSiteDiagnosticCategoriesSlotResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteDiagnosticCategoriesSlot(
        resourceGroupName,
        siteName,
        slot,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteDiagnosticCategoriesSlotNext(
        resourceGroupName,
        siteName,
        slot,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteDiagnosticCategoriesSlotPagingAll(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesSlotOptionalParams
  ): AsyncIterableIterator<DiagnosticCategory> {
    for await (const page of this.listSiteDiagnosticCategoriesSlotPagingPage(
      resourceGroupName,
      siteName,
      slot,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for Get Site Analyses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param options The options parameters.
   */
  public listSiteAnalysesSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteAnalysesSlotOptionalParams
  ): PagedAsyncIterableIterator<AnalysisDefinition> {
    const iter = this.listSiteAnalysesSlotPagingAll(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      slot,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteAnalysesSlotPagingPage(
          resourceGroupName,
          siteName,
          diagnosticCategory,
          slot,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteAnalysesSlotPagingPage(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteAnalysesSlotOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<AnalysisDefinition[]> {
    let result: DiagnosticsListSiteAnalysesSlotResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteAnalysesSlot(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        slot,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteAnalysesSlotNext(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        slot,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteAnalysesSlotPagingAll(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteAnalysesSlotOptionalParams
  ): AsyncIterableIterator<AnalysisDefinition> {
    for await (const page of this.listSiteAnalysesSlotPagingPage(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      slot,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for Get Detectors
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param options The options parameters.
   */
  public listSiteDetectorsSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorsSlotOptionalParams
  ): PagedAsyncIterableIterator<DetectorDefinitionResource> {
    const iter = this.listSiteDetectorsSlotPagingAll(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      slot,
      options
    );
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },
      byPage: (settings?: PageSettings) => {
        if (settings?.maxPageSize) {
          throw new Error("maxPageSize is not supported by this operation.");
        }
        return this.listSiteDetectorsSlotPagingPage(
          resourceGroupName,
          siteName,
          diagnosticCategory,
          slot,
          options,
          settings
        );
      }
    };
  }

  private async *listSiteDetectorsSlotPagingPage(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorsSlotOptionalParams,
    settings?: PageSettings
  ): AsyncIterableIterator<DetectorDefinitionResource[]> {
    let result: DiagnosticsListSiteDetectorsSlotResponse;
    let continuationToken = settings?.continuationToken;
    if (!continuationToken) {
      result = await this._listSiteDetectorsSlot(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        slot,
        options
      );
      let page = result.value || [];
      continuationToken = result.nextLink;
      setContinuationToken(page, continuationToken);
      yield page;
    }
    while (continuationToken) {
      result = await this._listSiteDetectorsSlotNext(
        resourceGroupName,
        siteName,
        diagnosticCategory,
        slot,
        continuationToken,
        options
      );
      continuationToken = result.nextLink;
      let page = result.value || [];
      setContinuationToken(page, continuationToken);
      yield page;
    }
  }

  private async *listSiteDetectorsSlotPagingAll(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorsSlotOptionalParams
  ): AsyncIterableIterator<DetectorDefinitionResource> {
    for await (const page of this.listSiteDetectorsSlotPagingPage(
      resourceGroupName,
      siteName,
      diagnosticCategory,
      slot,
      options
    )) {
      yield* page;
    }
  }

  /**
   * Description for List Hosting Environment Detector Responses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param name Site Name
   * @param options The options parameters.
   */
  private _listHostingEnvironmentDetectorResponses(
    resourceGroupName: string,
    name: string,
    options?: DiagnosticsListHostingEnvironmentDetectorResponsesOptionalParams
  ): Promise<DiagnosticsListHostingEnvironmentDetectorResponsesResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, name, options },
      listHostingEnvironmentDetectorResponsesOperationSpec
    );
  }

  /**
   * Description for Get Hosting Environment Detector Response
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param name App Service Environment Name
   * @param detectorName Detector Resource Name
   * @param options The options parameters.
   */
  getHostingEnvironmentDetectorResponse(
    resourceGroupName: string,
    name: string,
    detectorName: string,
    options?: DiagnosticsGetHostingEnvironmentDetectorResponseOptionalParams
  ): Promise<DiagnosticsGetHostingEnvironmentDetectorResponseResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, name, detectorName, options },
      getHostingEnvironmentDetectorResponseOperationSpec
    );
  }

  /**
   * Description for List Site Detector Responses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param options The options parameters.
   */
  private _listSiteDetectorResponses(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDetectorResponsesOptionalParams
  ): Promise<DiagnosticsListSiteDetectorResponsesResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, options },
      listSiteDetectorResponsesOperationSpec
    );
  }

  /**
   * Description for Get site detector response
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param detectorName Detector Resource Name
   * @param options The options parameters.
   */
  getSiteDetectorResponse(
    resourceGroupName: string,
    siteName: string,
    detectorName: string,
    options?: DiagnosticsGetSiteDetectorResponseOptionalParams
  ): Promise<DiagnosticsGetSiteDetectorResponseResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, detectorName, options },
      getSiteDetectorResponseOperationSpec
    );
  }

  /**
   * Description for Get Diagnostics Categories
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param options The options parameters.
   */
  private _listSiteDiagnosticCategories(
    resourceGroupName: string,
    siteName: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesOptionalParams
  ): Promise<DiagnosticsListSiteDiagnosticCategoriesResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, options },
      listSiteDiagnosticCategoriesOperationSpec
    );
  }

  /**
   * Description for Get Diagnostics Category
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param options The options parameters.
   */
  getSiteDiagnosticCategory(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsGetSiteDiagnosticCategoryOptionalParams
  ): Promise<DiagnosticsGetSiteDiagnosticCategoryResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, options },
      getSiteDiagnosticCategoryOperationSpec
    );
  }

  /**
   * Description for Get Site Analyses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param options The options parameters.
   */
  private _listSiteAnalyses(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteAnalysesOptionalParams
  ): Promise<DiagnosticsListSiteAnalysesResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, options },
      listSiteAnalysesOperationSpec
    );
  }

  /**
   * Description for Get Site Analysis
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param analysisName Analysis Name
   * @param options The options parameters.
   */
  getSiteAnalysis(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    analysisName: string,
    options?: DiagnosticsGetSiteAnalysisOptionalParams
  ): Promise<DiagnosticsGetSiteAnalysisResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        analysisName,
        options
      },
      getSiteAnalysisOperationSpec
    );
  }

  /**
   * Description for Execute Analysis
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Category Name
   * @param analysisName Analysis Resource Name
   * @param options The options parameters.
   */
  executeSiteAnalysis(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    analysisName: string,
    options?: DiagnosticsExecuteSiteAnalysisOptionalParams
  ): Promise<DiagnosticsExecuteSiteAnalysisResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        analysisName,
        options
      },
      executeSiteAnalysisOperationSpec
    );
  }

  /**
   * Description for Get Detectors
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param options The options parameters.
   */
  private _listSiteDetectors(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    options?: DiagnosticsListSiteDetectorsOptionalParams
  ): Promise<DiagnosticsListSiteDetectorsResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, options },
      listSiteDetectorsOperationSpec
    );
  }

  /**
   * Description for Get Detector
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param detectorName Detector Name
   * @param options The options parameters.
   */
  getSiteDetector(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    detectorName: string,
    options?: DiagnosticsGetSiteDetectorOptionalParams
  ): Promise<DiagnosticsGetSiteDetectorResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        detectorName,
        options
      },
      getSiteDetectorOperationSpec
    );
  }

  /**
   * Description for Execute Detector
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param detectorName Detector Resource Name
   * @param diagnosticCategory Category Name
   * @param options The options parameters.
   */
  executeSiteDetector(
    resourceGroupName: string,
    siteName: string,
    detectorName: string,
    diagnosticCategory: string,
    options?: DiagnosticsExecuteSiteDetectorOptionalParams
  ): Promise<DiagnosticsExecuteSiteDetectorResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        detectorName,
        diagnosticCategory,
        options
      },
      executeSiteDetectorOperationSpec
    );
  }

  /**
   * Description for List Site Detector Responses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  private _listSiteDetectorResponsesSlot(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorResponsesSlotOptionalParams
  ): Promise<DiagnosticsListSiteDetectorResponsesSlotResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, slot, options },
      listSiteDetectorResponsesSlotOperationSpec
    );
  }

  /**
   * Description for Get site detector response
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param detectorName Detector Resource Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  getSiteDetectorResponseSlot(
    resourceGroupName: string,
    siteName: string,
    detectorName: string,
    slot: string,
    options?: DiagnosticsGetSiteDetectorResponseSlotOptionalParams
  ): Promise<DiagnosticsGetSiteDetectorResponseSlotResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, detectorName, slot, options },
      getSiteDetectorResponseSlotOperationSpec
    );
  }

  /**
   * Description for Get Diagnostics Categories
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  private _listSiteDiagnosticCategoriesSlot(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesSlotOptionalParams
  ): Promise<DiagnosticsListSiteDiagnosticCategoriesSlotResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, slot, options },
      listSiteDiagnosticCategoriesSlotOperationSpec
    );
  }

  /**
   * Description for Get Diagnostics Category
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param options The options parameters.
   */
  getSiteDiagnosticCategorySlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsGetSiteDiagnosticCategorySlotOptionalParams
  ): Promise<DiagnosticsGetSiteDiagnosticCategorySlotResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, slot, options },
      getSiteDiagnosticCategorySlotOperationSpec
    );
  }

  /**
   * Description for Get Site Analyses
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param options The options parameters.
   */
  private _listSiteAnalysesSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteAnalysesSlotOptionalParams
  ): Promise<DiagnosticsListSiteAnalysesSlotResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, slot, options },
      listSiteAnalysesSlotOperationSpec
    );
  }

  /**
   * Description for Get Site Analysis
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param analysisName Analysis Name
   * @param slot Slot - optional
   * @param options The options parameters.
   */
  getSiteAnalysisSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    analysisName: string,
    slot: string,
    options?: DiagnosticsGetSiteAnalysisSlotOptionalParams
  ): Promise<DiagnosticsGetSiteAnalysisSlotResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        analysisName,
        slot,
        options
      },
      getSiteAnalysisSlotOperationSpec
    );
  }

  /**
   * Description for Execute Analysis
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Category Name
   * @param analysisName Analysis Resource Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  executeSiteAnalysisSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    analysisName: string,
    slot: string,
    options?: DiagnosticsExecuteSiteAnalysisSlotOptionalParams
  ): Promise<DiagnosticsExecuteSiteAnalysisSlotResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        analysisName,
        slot,
        options
      },
      executeSiteAnalysisSlotOperationSpec
    );
  }

  /**
   * Description for Get Detectors
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param options The options parameters.
   */
  private _listSiteDetectorsSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsListSiteDetectorsSlotOptionalParams
  ): Promise<DiagnosticsListSiteDetectorsSlotResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, slot, options },
      listSiteDetectorsSlotOperationSpec
    );
  }

  /**
   * Description for Get Detector
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param detectorName Detector Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  getSiteDetectorSlot(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    detectorName: string,
    slot: string,
    options?: DiagnosticsGetSiteDetectorSlotOptionalParams
  ): Promise<DiagnosticsGetSiteDetectorSlotResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        detectorName,
        slot,
        options
      },
      getSiteDetectorSlotOperationSpec
    );
  }

  /**
   * Description for Execute Detector
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param detectorName Detector Resource Name
   * @param diagnosticCategory Category Name
   * @param slot Slot Name
   * @param options The options parameters.
   */
  executeSiteDetectorSlot(
    resourceGroupName: string,
    siteName: string,
    detectorName: string,
    diagnosticCategory: string,
    slot: string,
    options?: DiagnosticsExecuteSiteDetectorSlotOptionalParams
  ): Promise<DiagnosticsExecuteSiteDetectorSlotResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        detectorName,
        diagnosticCategory,
        slot,
        options
      },
      executeSiteDetectorSlotOperationSpec
    );
  }

  /**
   * ListHostingEnvironmentDetectorResponsesNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param name Site Name
   * @param nextLink The nextLink from the previous successful call to the
   *                 ListHostingEnvironmentDetectorResponses method.
   * @param options The options parameters.
   */
  private _listHostingEnvironmentDetectorResponsesNext(
    resourceGroupName: string,
    name: string,
    nextLink: string,
    options?: DiagnosticsListHostingEnvironmentDetectorResponsesNextOptionalParams
  ): Promise<DiagnosticsListHostingEnvironmentDetectorResponsesNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, name, nextLink, options },
      listHostingEnvironmentDetectorResponsesNextOperationSpec
    );
  }

  /**
   * ListSiteDetectorResponsesNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param nextLink The nextLink from the previous successful call to the ListSiteDetectorResponses
   *                 method.
   * @param options The options parameters.
   */
  private _listSiteDetectorResponsesNext(
    resourceGroupName: string,
    siteName: string,
    nextLink: string,
    options?: DiagnosticsListSiteDetectorResponsesNextOptionalParams
  ): Promise<DiagnosticsListSiteDetectorResponsesNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, nextLink, options },
      listSiteDetectorResponsesNextOperationSpec
    );
  }

  /**
   * ListSiteDiagnosticCategoriesNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param nextLink The nextLink from the previous successful call to the ListSiteDiagnosticCategories
   *                 method.
   * @param options The options parameters.
   */
  private _listSiteDiagnosticCategoriesNext(
    resourceGroupName: string,
    siteName: string,
    nextLink: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesNextOptionalParams
  ): Promise<DiagnosticsListSiteDiagnosticCategoriesNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, nextLink, options },
      listSiteDiagnosticCategoriesNextOperationSpec
    );
  }

  /**
   * ListSiteAnalysesNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param nextLink The nextLink from the previous successful call to the ListSiteAnalyses method.
   * @param options The options parameters.
   */
  private _listSiteAnalysesNext(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    nextLink: string,
    options?: DiagnosticsListSiteAnalysesNextOptionalParams
  ): Promise<DiagnosticsListSiteAnalysesNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, nextLink, options },
      listSiteAnalysesNextOperationSpec
    );
  }

  /**
   * ListSiteDetectorsNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param nextLink The nextLink from the previous successful call to the ListSiteDetectors method.
   * @param options The options parameters.
   */
  private _listSiteDetectorsNext(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    nextLink: string,
    options?: DiagnosticsListSiteDetectorsNextOptionalParams
  ): Promise<DiagnosticsListSiteDetectorsNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, diagnosticCategory, nextLink, options },
      listSiteDetectorsNextOperationSpec
    );
  }

  /**
   * ListSiteDetectorResponsesSlotNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param slot Slot Name
   * @param nextLink The nextLink from the previous successful call to the ListSiteDetectorResponsesSlot
   *                 method.
   * @param options The options parameters.
   */
  private _listSiteDetectorResponsesSlotNext(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    nextLink: string,
    options?: DiagnosticsListSiteDetectorResponsesSlotNextOptionalParams
  ): Promise<DiagnosticsListSiteDetectorResponsesSlotNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, slot, nextLink, options },
      listSiteDetectorResponsesSlotNextOperationSpec
    );
  }

  /**
   * ListSiteDiagnosticCategoriesSlotNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param slot Slot Name
   * @param nextLink The nextLink from the previous successful call to the
   *                 ListSiteDiagnosticCategoriesSlot method.
   * @param options The options parameters.
   */
  private _listSiteDiagnosticCategoriesSlotNext(
    resourceGroupName: string,
    siteName: string,
    slot: string,
    nextLink: string,
    options?: DiagnosticsListSiteDiagnosticCategoriesSlotNextOptionalParams
  ): Promise<DiagnosticsListSiteDiagnosticCategoriesSlotNextResponse> {
    return this.client.sendOperationRequest(
      { resourceGroupName, siteName, slot, nextLink, options },
      listSiteDiagnosticCategoriesSlotNextOperationSpec
    );
  }

  /**
   * ListSiteAnalysesSlotNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param nextLink The nextLink from the previous successful call to the ListSiteAnalysesSlot method.
   * @param options The options parameters.
   */
  private _listSiteAnalysesSlotNext(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    nextLink: string,
    options?: DiagnosticsListSiteAnalysesSlotNextOptionalParams
  ): Promise<DiagnosticsListSiteAnalysesSlotNextResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        slot,
        nextLink,
        options
      },
      listSiteAnalysesSlotNextOperationSpec
    );
  }

  /**
   * ListSiteDetectorsSlotNext
   * @param resourceGroupName Name of the resource group to which the resource belongs.
   * @param siteName Site Name
   * @param diagnosticCategory Diagnostic Category
   * @param slot Slot Name
   * @param nextLink The nextLink from the previous successful call to the ListSiteDetectorsSlot method.
   * @param options The options parameters.
   */
  private _listSiteDetectorsSlotNext(
    resourceGroupName: string,
    siteName: string,
    diagnosticCategory: string,
    slot: string,
    nextLink: string,
    options?: DiagnosticsListSiteDetectorsSlotNextOptionalParams
  ): Promise<DiagnosticsListSiteDetectorsSlotNextResponse> {
    return this.client.sendOperationRequest(
      {
        resourceGroupName,
        siteName,
        diagnosticCategory,
        slot,
        nextLink,
        options
      },
      listSiteDetectorsSlotNextOperationSpec
    );
  }
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);

const listHostingEnvironmentDetectorResponsesOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponseCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.name
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getHostingEnvironmentDetectorResponseOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponse
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.name,
    Parameters.detectorName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorResponsesOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponseCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteDetectorResponseOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponse
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.detectorName,
    Parameters.siteName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDiagnosticCategoriesOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticCategoryCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteDiagnosticCategoryOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticCategory
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteAnalysesOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticAnalysisCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteAnalysisOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.AnalysisDefinition
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.analysisName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const executeSiteAnalysisOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute",
  httpMethod: "POST",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticAnalysis
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.analysisName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorsOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticDetectorCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteDetectorOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorDefinitionResource
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.detectorName,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const executeSiteDetectorOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute",
  httpMethod: "POST",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticDetectorResponse
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.detectorName,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorResponsesSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponseCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteDetectorResponseSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponse
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.detectorName,
    Parameters.siteName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDiagnosticCategoriesSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticCategoryCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteDiagnosticCategorySlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticCategory
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteAnalysesSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticAnalysisCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteAnalysisSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.AnalysisDefinition
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.analysisName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const executeSiteAnalysisSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute",
  httpMethod: "POST",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticAnalysis
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.analysisName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorsSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticDetectorCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const getSiteDetectorSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorDefinitionResource
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [Parameters.apiVersion],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.detectorName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const executeSiteDetectorSlotOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute",
  httpMethod: "POST",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticDetectorResponse
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  queryParameters: [
    Parameters.apiVersion,
    Parameters.startTime,
    Parameters.endTime,
    Parameters.timeGrain
  ],
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.detectorName,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listHostingEnvironmentDetectorResponsesNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponseCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.name,
    Parameters.nextLink
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorResponsesNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponseCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDiagnosticCategoriesNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticCategoryCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteAnalysesNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticAnalysisCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorsNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticDetectorCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName,
    Parameters.diagnosticCategory
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorResponsesSlotNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DetectorResponseCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDiagnosticCategoriesSlotNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticCategoryCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteAnalysesSlotNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticAnalysisCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
const listSiteDetectorsSlotNextOperationSpec: coreClient.OperationSpec = {
  path: "{nextLink}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.DiagnosticDetectorCollection
    },
    default: {
      bodyMapper: Mappers.DefaultErrorResponse
    }
  },
  urlParameters: [
    Parameters.$host,
    Parameters.subscriptionId,
    Parameters.resourceGroupName,
    Parameters.nextLink,
    Parameters.siteName,
    Parameters.diagnosticCategory,
    Parameters.slot
  ],
  headerParameters: [Parameters.accept],
  serializer
};
