@azure/arm-security
Version:
A generated SDK for SecurityCenter.
617 lines • 24.7 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 JitNetworkAccessPolicies operations. */
export class JitNetworkAccessPoliciesImpl {
/**
* Initialize a new instance of the class JitNetworkAccessPolicies class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Policies for protecting resources using Just-in-Time access control.
* @param options The options parameters.
*/
list(options) {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(options);
}
};
}
listPagingPage(options) {
return __asyncGenerator(this, arguments, function* listPagingPage_1() {
let result = yield __await(this._list(options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listNext(continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listPagingAll(options) {
return __asyncGenerator(this, arguments, function* listPagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listPagingPage(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; }
}
});
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param options The options parameters.
*/
listByRegion(ascLocation, options) {
const iter = this.listByRegionPagingAll(ascLocation, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listByRegionPagingPage(ascLocation, options);
}
};
}
listByRegionPagingPage(ascLocation, options) {
return __asyncGenerator(this, arguments, function* listByRegionPagingPage_1() {
let result = yield __await(this._listByRegion(ascLocation, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listByRegionNext(ascLocation, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listByRegionPagingAll(ascLocation, options) {
return __asyncGenerator(this, arguments, function* listByRegionPagingAll_1() {
var e_2, _a;
try {
for (var _b = __asyncValues(this.listByRegionPagingPage(ascLocation, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
const page = _c.value;
yield __await(yield* __asyncDelegator(__asyncValues(page)));
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
}
finally { if (e_2) throw e_2.error; }
}
});
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param options The options parameters.
*/
listByResourceGroup(resourceGroupName, options) {
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listByResourceGroupPagingPage(resourceGroupName, options);
}
};
}
listByResourceGroupPagingPage(resourceGroupName, options) {
return __asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
let result = yield __await(this._listByResourceGroup(resourceGroupName, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listByResourceGroupPagingAll(resourceGroupName, options) {
return __asyncGenerator(this, arguments, function* listByResourceGroupPagingAll_1() {
var e_3, _a;
try {
for (var _b = __asyncValues(this.listByResourceGroupPagingPage(resourceGroupName, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
const page = _c.value;
yield __await(yield* __asyncDelegator(__asyncValues(page)));
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
}
finally { if (e_3) throw e_3.error; }
}
});
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param options The options parameters.
*/
listByResourceGroupAndRegion(resourceGroupName, ascLocation, options) {
const iter = this.listByResourceGroupAndRegionPagingAll(resourceGroupName, ascLocation, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listByResourceGroupAndRegionPagingPage(resourceGroupName, ascLocation, options);
}
};
}
listByResourceGroupAndRegionPagingPage(resourceGroupName, ascLocation, options) {
return __asyncGenerator(this, arguments, function* listByResourceGroupAndRegionPagingPage_1() {
let result = yield __await(this._listByResourceGroupAndRegion(resourceGroupName, ascLocation, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listByResourceGroupAndRegionNext(resourceGroupName, ascLocation, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listByResourceGroupAndRegionPagingAll(resourceGroupName, ascLocation, options) {
return __asyncGenerator(this, arguments, function* listByResourceGroupAndRegionPagingAll_1() {
var e_4, _a;
try {
for (var _b = __asyncValues(this.listByResourceGroupAndRegionPagingPage(resourceGroupName, ascLocation, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
const page = _c.value;
yield __await(yield* __asyncDelegator(__asyncValues(page)));
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
}
finally { if (e_4) throw e_4.error; }
}
});
}
/**
* Policies for protecting resources using Just-in-Time access control.
* @param options The options parameters.
*/
_list(options) {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param options The options parameters.
*/
_listByRegion(ascLocation, options) {
return this.client.sendOperationRequest({ ascLocation, options }, listByRegionOperationSpec);
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param options The options parameters.
*/
_listByResourceGroup(resourceGroupName, options) {
return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec);
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param options The options parameters.
*/
_listByResourceGroupAndRegion(resourceGroupName, ascLocation, options) {
return this.client.sendOperationRequest({ resourceGroupName, ascLocation, options }, listByResourceGroupAndRegionOperationSpec);
}
/**
* Policies for protecting resources using Just-in-Time access control for the subscription, location
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy.
* @param options The options parameters.
*/
get(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, options) {
return this.client.sendOperationRequest({ resourceGroupName, ascLocation, jitNetworkAccessPolicyName, options }, getOperationSpec);
}
/**
* Create a policy for protecting resources using Just-in-Time access control
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy.
* @param body
* @param options The options parameters.
*/
createOrUpdate(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, options) {
return this.client.sendOperationRequest({
resourceGroupName,
ascLocation,
jitNetworkAccessPolicyName,
body,
options
}, createOrUpdateOperationSpec);
}
/**
* Delete a Just-in-Time access control policy.
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy.
* @param options The options parameters.
*/
delete(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, options) {
return this.client.sendOperationRequest({ resourceGroupName, ascLocation, jitNetworkAccessPolicyName, options }, deleteOperationSpec);
}
/**
* Initiate a JIT access from a specific Just-in-Time policy configuration.
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy.
* @param body
* @param options The options parameters.
*/
initiate(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, options) {
return this.client.sendOperationRequest({
resourceGroupName,
ascLocation,
jitNetworkAccessPolicyName,
body,
options
}, initiateOperationSpec);
}
/**
* 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);
}
/**
* ListByRegionNext
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param nextLink The nextLink from the previous successful call to the ListByRegion method.
* @param options The options parameters.
*/
_listByRegionNext(ascLocation, nextLink, options) {
return this.client.sendOperationRequest({ ascLocation, nextLink, options }, listByRegionNextOperationSpec);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @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);
}
/**
* ListByResourceGroupAndRegionNext
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from
* Get locations
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroupAndRegion
* method.
* @param options The options parameters.
*/
_listByResourceGroupAndRegionNext(resourceGroupName, ascLocation, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, ascLocation, nextLink, options }, listByResourceGroupAndRegionNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listByRegionOperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.ascLocation
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupAndRegionOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.ascLocation
],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPolicy
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.ascLocation,
Parameters.jitNetworkAccessPolicyName
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPolicy
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.body2,
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.ascLocation,
Parameters.jitNetworkAccessPolicyName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.ascLocation,
Parameters.jitNetworkAccessPolicyName
],
headerParameters: [Parameters.accept],
serializer
};
const initiateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}",
httpMethod: "POST",
responses: {
202: {
bodyMapper: Mappers.JitNetworkAccessRequest
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.body3,
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.ascLocation,
Parameters.jitNetworkAccessPolicyName,
Parameters.jitNetworkAccessPolicyInitiateType
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const listNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listByRegionNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.ascLocation
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupAndRegionNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.JitNetworkAccessPoliciesList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion9],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink,
Parameters.ascLocation
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=jitNetworkAccessPolicies.js.map