94 lines
2.7 KiB
TypeScript
94 lines
2.7 KiB
TypeScript
/*
|
|
* 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";
|
|
|
|
/// <reference lib="esnext.asynciterable" />
|
|
/** 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<SkuInformation> {
|
|
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<SkuInformation[]> {
|
|
let result = await this._list(options);
|
|
yield result.value || [];
|
|
}
|
|
|
|
private async *listPagingAll(
|
|
options?: SkusListOptionalParams
|
|
): AsyncIterableIterator<SkuInformation> {
|
|
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<SkusListResponse> {
|
|
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
|
|
};
|