/*
* 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 } from "@azure/core-paging";
import { Skus } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { StorageManagementClient } from "../storageManagementClient";
import {
SkuInformation,
SkusListOptionalParams,
SkusListResponse
} from "../models";
///
/** Class containing Skus operations. */
export class SkusImpl implements Skus {
private readonly client: StorageManagementClient;
/**
* Initialize a new instance of the class Skus class.
* @param client Reference to the service client
*/
constructor(client: StorageManagementClient) {
this.client = client;
}
/**
* Lists the available SKUs supported by Microsoft.Storage for given subscription.
* @param options The options parameters.
*/
public list(
options?: SkusListOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(options);
}
};
}
private async *listPagingPage(
options?: SkusListOptionalParams
): AsyncIterableIterator {
let result = await this._list(options);
yield result.value || [];
}
private async *listPagingAll(
options?: SkusListOptionalParams
): AsyncIterableIterator {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Lists the available SKUs supported by Microsoft.Storage for given subscription.
* @param options The options parameters.
*/
private _list(options?: SkusListOptionalParams): Promise {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.StorageSkuListResult
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};