@azure/arm-monitor
Version:
A generated SDK for MonitorClient.
160 lines • 6.8 kB
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 PrivateLinkResources operations. */
export class PrivateLinkResourcesImpl {
/**
* Initialize a new instance of the class PrivateLinkResources class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param options The options parameters.
*/
listByPrivateLinkScope(resourceGroupName, scopeName, options) {
const iter = this.listByPrivateLinkScopePagingAll(resourceGroupName, scopeName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listByPrivateLinkScopePagingPage(resourceGroupName, scopeName, options);
}
};
}
listByPrivateLinkScopePagingPage(resourceGroupName, scopeName, options) {
return __asyncGenerator(this, arguments, function* listByPrivateLinkScopePagingPage_1() {
let result = yield __await(this._listByPrivateLinkScope(resourceGroupName, scopeName, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listByPrivateLinkScopeNext(resourceGroupName, scopeName, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listByPrivateLinkScopePagingAll(resourceGroupName, scopeName, options) {
return __asyncGenerator(this, arguments, function* listByPrivateLinkScopePagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listByPrivateLinkScopePagingPage(resourceGroupName, scopeName, 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 private link resources that need to be created for a Azure Monitor PrivateLinkScope.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param options The options parameters.
*/
_listByPrivateLinkScope(resourceGroupName, scopeName, options) {
return this.client.sendOperationRequest({ resourceGroupName, scopeName, options }, listByPrivateLinkScopeOperationSpec);
}
/**
* Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param groupName The name of the private link resource.
* @param options The options parameters.
*/
get(resourceGroupName, scopeName, groupName, options) {
return this.client.sendOperationRequest({ resourceGroupName, scopeName, groupName, options }, getOperationSpec);
}
/**
* ListByPrivateLinkScopeNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param nextLink The nextLink from the previous successful call to the ListByPrivateLinkScope method.
* @param options The options parameters.
*/
_listByPrivateLinkScopeNext(resourceGroupName, scopeName, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, scopeName, nextLink, options }, listByPrivateLinkScopeNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByPrivateLinkScopeOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PrivateLinkResourceListResult
}
},
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.scopeName
],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PrivateLinkResource
}
},
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.scopeName,
Parameters.groupName
],
headerParameters: [Parameters.accept],
serializer
};
const listByPrivateLinkScopeNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PrivateLinkResourceListResult
}
},
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.scopeName
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=privateLinkResources.js.map