93 lines
3.4 KiB
JavaScript
93 lines
3.4 KiB
JavaScript
/*
|
|
* 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 { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
import * as coreClient from "@azure/core-client";
|
|
import * as Mappers from "../models/mappers";
|
|
import * as Parameters from "../models/parameters";
|
|
/// <reference lib="esnext.asynciterable" />
|
|
/** Class containing Usages operations. */
|
|
export class UsagesImpl {
|
|
/**
|
|
* Initialize a new instance of the class Usages class.
|
|
* @param client Reference to the service client
|
|
*/
|
|
constructor(client) {
|
|
this.client = client;
|
|
}
|
|
/**
|
|
* Gets the current usage count and the limit for the resources of the location under the subscription.
|
|
* @param location The location of the Azure Storage resource.
|
|
* @param options The options parameters.
|
|
*/
|
|
listByLocation(location, options) {
|
|
const iter = this.listByLocationPagingAll(location, options);
|
|
return {
|
|
next() {
|
|
return iter.next();
|
|
},
|
|
[Symbol.asyncIterator]() {
|
|
return this;
|
|
},
|
|
byPage: () => {
|
|
return this.listByLocationPagingPage(location, options);
|
|
}
|
|
};
|
|
}
|
|
listByLocationPagingPage(location, options) {
|
|
return __asyncGenerator(this, arguments, function* listByLocationPagingPage_1() {
|
|
let result = yield __await(this._listByLocation(location, options));
|
|
yield yield __await(result.value || []);
|
|
});
|
|
}
|
|
listByLocationPagingAll(location, options) {
|
|
return __asyncGenerator(this, arguments, function* listByLocationPagingAll_1() {
|
|
var e_1, _a;
|
|
try {
|
|
for (var _b = __asyncValues(this.listByLocationPagingPage(location, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
const page = _c.value;
|
|
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
}
|
|
}
|
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
finally {
|
|
try {
|
|
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
}
|
|
finally { if (e_1) throw e_1.error; }
|
|
}
|
|
});
|
|
}
|
|
/**
|
|
* Gets the current usage count and the limit for the resources of the location under the subscription.
|
|
* @param location The location of the Azure Storage resource.
|
|
* @param options The options parameters.
|
|
*/
|
|
_listByLocation(location, options) {
|
|
return this.client.sendOperationRequest({ location, options }, listByLocationOperationSpec);
|
|
}
|
|
}
|
|
// Operation Specifications
|
|
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
const listByLocationOperationSpec = {
|
|
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages",
|
|
httpMethod: "GET",
|
|
responses: {
|
|
200: {
|
|
bodyMapper: Mappers.UsageListResult
|
|
}
|
|
},
|
|
queryParameters: [Parameters.apiVersion],
|
|
urlParameters: [
|
|
Parameters.$host,
|
|
Parameters.subscriptionId,
|
|
Parameters.location
|
|
],
|
|
headerParameters: [Parameters.accept],
|
|
serializer
|
|
};
|
|
//# sourceMappingURL=usages.js.map
|