@azure/arm-appservice
Version:
A generated SDK for WebSiteManagementClient.
501 lines • 19.3 kB
JavaScript
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResourceHealthMetadataOperationsImpl = void 0;
const tslib_1 = require("tslib");
const pagingHelper_js_1 = require("../pagingHelper.js");
const coreClient = tslib_1.__importStar(require("@azure/core-client"));
const Mappers = tslib_1.__importStar(require("../models/mappers.js"));
const Parameters = tslib_1.__importStar(require("../models/parameters.js"));
/// <reference lib="esnext.asynciterable" />
/** Class containing ResourceHealthMetadataOperations operations. */
class ResourceHealthMetadataOperationsImpl {
client;
/**
* Initialize a new instance of the class ResourceHealthMetadataOperations class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Description for List all ResourceHealthMetadata for all sites in the subscription.
* @param options The options parameters.
*/
list(options) {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
},
};
}
async *listPagingPage(options, settings) {
let result;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
const page = result.value || [];
continuationToken = result.nextLink;
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
const page = result.value || [];
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
}
async *listPagingAll(options) {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Description for List all ResourceHealthMetadata for all sites in the resource group in the
* subscription.
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param options The options parameters.
*/
listByResourceGroup(resourceGroupName, options) {
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
},
};
}
async *listByResourceGroupPagingPage(resourceGroupName, options, settings) {
let result;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroup(resourceGroupName, options);
const page = result.value || [];
continuationToken = result.nextLink;
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupNext(resourceGroupName, continuationToken, options);
continuationToken = result.nextLink;
const page = result.value || [];
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
}
async *listByResourceGroupPagingAll(resourceGroupName, options) {
for await (const page of this.listByResourceGroupPagingPage(resourceGroupName, options)) {
yield* page;
}
}
/**
* Description for Gets the category of ResourceHealthMetadata to use for the given site as a
* collection
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app.
* @param options The options parameters.
*/
listBySite(resourceGroupName, name, options) {
const iter = this.listBySitePagingAll(resourceGroupName, name, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listBySitePagingPage(resourceGroupName, name, options, settings);
},
};
}
async *listBySitePagingPage(resourceGroupName, name, options, settings) {
let result;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listBySite(resourceGroupName, name, options);
const page = result.value || [];
continuationToken = result.nextLink;
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listBySiteNext(resourceGroupName, name, continuationToken, options);
continuationToken = result.nextLink;
const page = result.value || [];
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
}
async *listBySitePagingAll(resourceGroupName, name, options) {
for await (const page of this.listBySitePagingPage(resourceGroupName, name, options)) {
yield* page;
}
}
/**
* Description for Gets the category of ResourceHealthMetadata to use for the given site as a
* collection
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app.
* @param slot Name of web app slot. If not specified then will default to production slot.
* @param options The options parameters.
*/
listBySiteSlot(resourceGroupName, name, slot, options) {
const iter = this.listBySiteSlotPagingAll(resourceGroupName, name, slot, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listBySiteSlotPagingPage(resourceGroupName, name, slot, options, settings);
},
};
}
async *listBySiteSlotPagingPage(resourceGroupName, name, slot, options, settings) {
let result;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listBySiteSlot(resourceGroupName, name, slot, options);
const page = result.value || [];
continuationToken = result.nextLink;
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listBySiteSlotNext(resourceGroupName, name, slot, continuationToken, options);
continuationToken = result.nextLink;
const page = result.value || [];
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
yield page;
}
}
async *listBySiteSlotPagingAll(resourceGroupName, name, slot, options) {
for await (const page of this.listBySiteSlotPagingPage(resourceGroupName, name, slot, options)) {
yield* page;
}
}
/**
* Description for List all ResourceHealthMetadata for all sites in the subscription.
* @param options The options parameters.
*/
_list(options) {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* Description for List all ResourceHealthMetadata for all sites in the resource group in the
* subscription.
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param options The options parameters.
*/
_listByResourceGroup(resourceGroupName, options) {
return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec);
}
/**
* Description for Gets the category of ResourceHealthMetadata to use for the given site as a
* collection
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app.
* @param options The options parameters.
*/
_listBySite(resourceGroupName, name, options) {
return this.client.sendOperationRequest({ resourceGroupName, name, options }, listBySiteOperationSpec);
}
/**
* Description for Gets the category of ResourceHealthMetadata to use for the given site
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app
* @param options The options parameters.
*/
getBySite(resourceGroupName, name, options) {
return this.client.sendOperationRequest({ resourceGroupName, name, options }, getBySiteOperationSpec);
}
/**
* Description for Gets the category of ResourceHealthMetadata to use for the given site as a
* collection
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app.
* @param slot Name of web app slot. If not specified then will default to production slot.
* @param options The options parameters.
*/
_listBySiteSlot(resourceGroupName, name, slot, options) {
return this.client.sendOperationRequest({ resourceGroupName, name, slot, options }, listBySiteSlotOperationSpec);
}
/**
* Description for Gets the category of ResourceHealthMetadata to use for the given site
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app
* @param slot Name of web app slot. If not specified then will default to production slot.
* @param options The options parameters.
*/
getBySiteSlot(resourceGroupName, name, slot, options) {
return this.client.sendOperationRequest({ resourceGroupName, name, slot, options }, getBySiteSlotOperationSpec);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
_listNext(nextLink, options) {
return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
* @param options The options parameters.
*/
_listByResourceGroupNext(resourceGroupName, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, nextLink, options }, listByResourceGroupNextOperationSpec);
}
/**
* ListBySiteNext
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app.
* @param nextLink The nextLink from the previous successful call to the ListBySite method.
* @param options The options parameters.
*/
_listBySiteNext(resourceGroupName, name, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, name, nextLink, options }, listBySiteNextOperationSpec);
}
/**
* ListBySiteSlotNext
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of web app.
* @param slot Name of web app slot. If not specified then will default to production slot.
* @param nextLink The nextLink from the previous successful call to the ListBySiteSlot method.
* @param options The options parameters.
*/
_listBySiteSlotNext(resourceGroupName, name, slot, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, name, slot, nextLink, options }, listBySiteSlotNextOperationSpec);
}
}
exports.ResourceHealthMetadataOperationsImpl = ResourceHealthMetadataOperationsImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName],
headerParameters: [Parameters.accept],
serializer,
};
const listBySiteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.name,
],
headerParameters: [Parameters.accept],
serializer,
};
const getBySiteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadata,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.name,
],
headerParameters: [Parameters.accept],
serializer,
};
const listBySiteSlotOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.name,
Parameters.slot,
],
headerParameters: [Parameters.accept],
serializer,
};
const getBySiteSlotOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadata,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.name,
Parameters.slot,
],
headerParameters: [Parameters.accept],
serializer,
};
const listNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink,
],
headerParameters: [Parameters.accept],
serializer,
};
const listBySiteNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.name,
Parameters.nextLink,
],
headerParameters: [Parameters.accept],
serializer,
};
const listBySiteSlotNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceHealthMetadataCollection,
},
default: {
bodyMapper: Mappers.DefaultErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.name,
Parameters.nextLink,
Parameters.slot,
],
headerParameters: [Parameters.accept],
serializer,
};
//# sourceMappingURL=resourceHealthMetadataOperations.js.map