/*
 * Copyright (c) Microsoft Corporation.  All rights reserved. 
 * Licensed under the MIT License.  See License.txt in the project root for
 * license information. 
 *
 * Code generated by Microsoft (R) AutoRest Code Generator. 
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated. 
 */

import * as msRest from "@azure/ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/expressRoutePortsLocationsMappers";
import * as Parameters from "../models/parameters";
import { NetworkManagementClientContext } from "../networkManagementClientContext";

/** Class representing a ExpressRoutePortsLocations. */ 
export class ExpressRoutePortsLocations {
  private readonly client: NetworkManagementClientContext;

  /**
   * Create a ExpressRoutePortsLocations. 
   * @param {NetworkManagementClientContext} client Reference to the service client. 
   */
  constructor(client: NetworkManagementClientContext) {
    this.client = client;
  }

  /**
   * Retrieves all ExpressRoutePort peering locations.  Does not return available bandwidths for each
   * location.  Available bandwidths can only be obtained when retrieving a specific peering location. 
   * @param [options] The optional parameters
   * @returns Promise<Models. ExpressRoutePortsLocationsListResponse>
   */
  list(options?:  msRest. RequestOptionsBase): Promise<Models. ExpressRoutePortsLocationsListResponse>;
  /**
   * @param callback The callback
   */
  list(callback: msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>): void;
  /**
   * @param options The optional parameters
   * @param callback The callback
   */
  list(options: msRest. RequestOptionsBase, callback: msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>): void;
  list(options?:  msRest. RequestOptionsBase | msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>, callback?:  msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>): Promise<Models. ExpressRoutePortsLocationsListResponse> {
    return this.client.sendOperationRequest(
      {
        options
      },
      listOperationSpec,
      callback) as Promise<Models. ExpressRoutePortsLocationsListResponse>;
  }

  /**
   * Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths
   * available at said peering location. 
   * @param locationName Name of the requested ExpressRoutePort peering location. 
   * @param [options] The optional parameters
   * @returns Promise<Models. ExpressRoutePortsLocationsGetResponse>
   */
  get(locationName: string, options?:  msRest. RequestOptionsBase): Promise<Models. ExpressRoutePortsLocationsGetResponse>;
  /**
   * @param locationName Name of the requested ExpressRoutePort peering location. 
   * @param callback The callback
   */
  get(locationName: string, callback: msRest. ServiceCallback<Models. ExpressRoutePortsLocation>): void;
  /**
   * @param locationName Name of the requested ExpressRoutePort peering location. 
   * @param options The optional parameters
   * @param callback The callback
   */
  get(locationName: string, options: msRest. RequestOptionsBase, callback: msRest. ServiceCallback<Models. ExpressRoutePortsLocation>): void;
  get(locationName: string, options?:  msRest. RequestOptionsBase | msRest. ServiceCallback<Models. ExpressRoutePortsLocation>, callback?:  msRest. ServiceCallback<Models. ExpressRoutePortsLocation>): Promise<Models. ExpressRoutePortsLocationsGetResponse> {
    return this.client.sendOperationRequest(
      {
        locationName,
        options
      },
      getOperationSpec,
      callback) as Promise<Models. ExpressRoutePortsLocationsGetResponse>;
  }

  /**
   * Retrieves all ExpressRoutePort peering locations.  Does not return available bandwidths for each
   * location.  Available bandwidths can only be obtained when retrieving a specific peering location. 
   * @param nextPageLink The NextLink from the previous successful call to List operation. 
   * @param [options] The optional parameters
   * @returns Promise<Models. ExpressRoutePortsLocationsListNextResponse>
   */
  listNext(nextPageLink: string, options?:  msRest. RequestOptionsBase): Promise<Models. ExpressRoutePortsLocationsListNextResponse>;
  /**
   * @param nextPageLink The NextLink from the previous successful call to List operation. 
   * @param callback The callback
   */
  listNext(nextPageLink: string, callback: msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>): void;
  /**
   * @param nextPageLink The NextLink from the previous successful call to List operation. 
   * @param options The optional parameters
   * @param callback The callback
   */
  listNext(nextPageLink: string, options: msRest. RequestOptionsBase, callback: msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>): void;
  listNext(nextPageLink: string, options?:  msRest. RequestOptionsBase | msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>, callback?:  msRest. ServiceCallback<Models. ExpressRoutePortsLocationListResult>): Promise<Models. ExpressRoutePortsLocationsListNextResponse> {
    return this.client.sendOperationRequest(
      {
        nextPageLink,
        options
      },
      listNextOperationSpec,
      callback) as Promise<Models. ExpressRoutePortsLocationsListNextResponse>;
  }
}

// Operation Specifications
const serializer = new msRest. Serializer(Mappers);
const listOperationSpec: msRest. OperationSpec = {
  httpMethod: "GET",
  path: "subscriptions/{subscriptionId}/providers/Microsoft. Network/ExpressRoutePortsLocations",
  urlParameters: [
    Parameters.subscriptionId
  ],
  queryParameters: [
    Parameters.apiVersion0
  ],
  headerParameters: [
    Parameters.acceptLanguage
  ],
  responses: {
    200: {
      bodyMapper: Mappers. ExpressRoutePortsLocationListResult
    },
    default: {
      bodyMapper: Mappers. CloudError
    }
  },
  serializer
};

const getOperationSpec: msRest. OperationSpec = {
  httpMethod: "GET",
  path: "subscriptions/{subscriptionId}/providers/Microsoft. Network/ExpressRoutePortsLocations/{locationName}",
  urlParameters: [
    Parameters.subscriptionId,
    Parameters.locationName
  ],
  queryParameters: [
    Parameters.apiVersion0
  ],
  headerParameters: [
    Parameters.acceptLanguage
  ],
  responses: {
    200: {
      bodyMapper: Mappers. ExpressRoutePortsLocation
    },
    default: {
      bodyMapper: Mappers. CloudError
    }
  },
  serializer
};

const listNextOperationSpec: msRest. OperationSpec = {
  httpMethod: "GET",
  baseUrl: "https://management.azure.com",
  path: "{nextLink}",
  urlParameters: [
    Parameters.nextPageLink
  ],
  headerParameters: [
    Parameters.acceptLanguage
  ],
  responses: {
    200: {
      bodyMapper: Mappers. ExpressRoutePortsLocationListResult
    },
    default: {
      bodyMapper: Mappers. CloudError
    }
  },
  serializer
};
