@azure/arm-monitor
Version:
A generated SDK for MonitorClient.
316 lines • 14.9 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, __awaiter } from "tslib";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { LroEngine } from "@azure/core-lro";
import { LroImpl } from "../lroImpl";
/// <reference lib="esnext.asynciterable" />
/** Class containing PrivateEndpointConnections operations. */
export class PrivateEndpointConnectionsImpl {
/**
* Initialize a new instance of the class PrivateEndpointConnections class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Gets all private endpoint connections on a private link scope.
* @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 a private endpoint connection.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param privateEndpointConnectionName The name of the private endpoint connection.
* @param options The options parameters.
*/
get(resourceGroupName, scopeName, privateEndpointConnectionName, options) {
return this.client.sendOperationRequest({ resourceGroupName, scopeName, privateEndpointConnectionName, options }, getOperationSpec);
}
/**
* Approve or reject a private endpoint connection with a given name.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param privateEndpointConnectionName The name of the private endpoint connection.
* @param parameters A private endpoint connection
* @param options The options parameters.
*/
beginCreateOrUpdate(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) {
return __awaiter(this, void 0, void 0, function* () {
const directSendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () {
return this.client.sendOperationRequest(args, spec);
});
const sendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () {
var _a;
let currentRawResponse = undefined;
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
const callback = (rawResponse, flatResponse) => {
currentRawResponse = rawResponse;
providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
};
const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) });
const flatResponse = yield directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse.status,
body: currentRawResponse.parsedBody,
headers: currentRawResponse.headers.toJSON()
}
};
});
const lro = new LroImpl(sendOperation, {
resourceGroupName,
scopeName,
privateEndpointConnectionName,
parameters,
options
}, createOrUpdateOperationSpec);
return new LroEngine(lro, {
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
});
});
}
/**
* Approve or reject a private endpoint connection with a given name.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param privateEndpointConnectionName The name of the private endpoint connection.
* @param parameters A private endpoint connection
* @param options The options parameters.
*/
beginCreateOrUpdateAndWait(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) {
return __awaiter(this, void 0, void 0, function* () {
const poller = yield this.beginCreateOrUpdate(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options);
return poller.pollUntilDone();
});
}
/**
* Deletes a private endpoint connection with a given name.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param privateEndpointConnectionName The name of the private endpoint connection.
* @param options The options parameters.
*/
beginDelete(resourceGroupName, scopeName, privateEndpointConnectionName, options) {
return __awaiter(this, void 0, void 0, function* () {
const directSendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () {
return this.client.sendOperationRequest(args, spec);
});
const sendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () {
var _a;
let currentRawResponse = undefined;
const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
const callback = (rawResponse, flatResponse) => {
currentRawResponse = rawResponse;
providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
};
const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) });
const flatResponse = yield directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse.status,
body: currentRawResponse.parsedBody,
headers: currentRawResponse.headers.toJSON()
}
};
});
const lro = new LroImpl(sendOperation, { resourceGroupName, scopeName, privateEndpointConnectionName, options }, deleteOperationSpec);
return new LroEngine(lro, {
resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
});
});
}
/**
* Deletes a private endpoint connection with a given name.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Monitor PrivateLinkScope resource.
* @param privateEndpointConnectionName The name of the private endpoint connection.
* @param options The options parameters.
*/
beginDeleteAndWait(resourceGroupName, scopeName, privateEndpointConnectionName, options) {
return __awaiter(this, void 0, void 0, function* () {
const poller = yield this.beginDelete(resourceGroupName, scopeName, privateEndpointConnectionName, options);
return poller.pollUntilDone();
});
}
/**
* Gets all private endpoint connections on a private link scope.
* @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);
}
/**
* 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 getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PrivateEndpointConnection
}
},
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.scopeName,
Parameters.privateEndpointConnectionName
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.PrivateEndpointConnection
},
201: {
bodyMapper: Mappers.PrivateEndpointConnection
},
202: {
bodyMapper: Mappers.PrivateEndpointConnection
},
204: {
bodyMapper: Mappers.PrivateEndpointConnection
}
},
requestBody: Parameters.parameters8,
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.scopeName,
Parameters.privateEndpointConnectionName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}",
httpMethod: "DELETE",
responses: { 200: {}, 201: {}, 202: {}, 204: {} },
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.scopeName,
Parameters.privateEndpointConnectionName
],
serializer
};
const listByPrivateLinkScopeOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PrivateEndpointConnectionListResult
}
},
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.scopeName
],
headerParameters: [Parameters.accept],
serializer
};
const listByPrivateLinkScopeNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PrivateEndpointConnectionListResult
}
},
queryParameters: [Parameters.apiVersion10],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.scopeName
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=privateEndpointConnections.js.map