UNPKG

8.55 kBJavaScriptView Raw
1"use strict";
2/*
3 * ---------------------------------------------------------
4 * Copyright(C) Microsoft Corporation. All rights reserved.
5 * ---------------------------------------------------------
6 *
7 * ---------------------------------------------------------
8 * Generated file, DO NOT EDIT
9 * ---------------------------------------------------------
10 */
11var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13 return new (P || (P = Promise))(function (resolve, reject) {
14 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17 step((generator = generator.apply(thisArg, _arguments || [])).next());
18 });
19};
20Object.defineProperty(exports, "__esModule", { value: true });
21exports.SecurityRolesApi = void 0;
22const basem = require("./ClientApiBases");
23const SecurityRolesInterfaces = require("./interfaces/SecurityRolesInterfaces");
24class SecurityRolesApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-SecurityRoles-api', options);
27 }
28 /**
29 * @param {string} scopeId
30 * @param {string} resourceId
31 */
32 getRoleAssignments(scopeId, resourceId) {
33 return __awaiter(this, void 0, void 0, function* () {
34 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
35 let routeValues = {
36 scopeId: scopeId,
37 resourceId: resourceId
38 };
39 try {
40 let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues);
41 let url = verData.requestUrl;
42 let options = this.createRequestOptions('application/json', verData.apiVersion);
43 let res;
44 res = yield this.rest.get(url, options);
45 let ret = this.formatResponse(res.result, SecurityRolesInterfaces.TypeInfo.RoleAssignment, true);
46 resolve(ret);
47 }
48 catch (err) {
49 reject(err);
50 }
51 }));
52 });
53 }
54 /**
55 * @param {string} scopeId
56 * @param {string} resourceId
57 * @param {string} identityId
58 */
59 removeRoleAssignment(scopeId, resourceId, identityId) {
60 return __awaiter(this, void 0, void 0, function* () {
61 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
62 let routeValues = {
63 scopeId: scopeId,
64 resourceId: resourceId,
65 identityId: identityId
66 };
67 try {
68 let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues);
69 let url = verData.requestUrl;
70 let options = this.createRequestOptions('application/json', verData.apiVersion);
71 let res;
72 res = yield this.rest.del(url, options);
73 let ret = this.formatResponse(res.result, null, false);
74 resolve(ret);
75 }
76 catch (err) {
77 reject(err);
78 }
79 }));
80 });
81 }
82 /**
83 * @param {string[]} identityIds
84 * @param {string} scopeId
85 * @param {string} resourceId
86 */
87 removeRoleAssignments(identityIds, scopeId, resourceId) {
88 return __awaiter(this, void 0, void 0, function* () {
89 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
90 let routeValues = {
91 scopeId: scopeId,
92 resourceId: resourceId
93 };
94 try {
95 let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues);
96 let url = verData.requestUrl;
97 let options = this.createRequestOptions('application/json', verData.apiVersion);
98 let res;
99 res = yield this.rest.update(url, identityIds, options);
100 let ret = this.formatResponse(res.result, null, false);
101 resolve(ret);
102 }
103 catch (err) {
104 reject(err);
105 }
106 }));
107 });
108 }
109 /**
110 * @param {SecurityRolesInterfaces.UserRoleAssignmentRef} roleAssignment
111 * @param {string} scopeId
112 * @param {string} resourceId
113 * @param {string} identityId
114 */
115 setRoleAssignment(roleAssignment, scopeId, resourceId, identityId) {
116 return __awaiter(this, void 0, void 0, function* () {
117 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
118 let routeValues = {
119 scopeId: scopeId,
120 resourceId: resourceId,
121 identityId: identityId
122 };
123 try {
124 let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues);
125 let url = verData.requestUrl;
126 let options = this.createRequestOptions('application/json', verData.apiVersion);
127 let res;
128 res = yield this.rest.replace(url, roleAssignment, options);
129 let ret = this.formatResponse(res.result, SecurityRolesInterfaces.TypeInfo.RoleAssignment, false);
130 resolve(ret);
131 }
132 catch (err) {
133 reject(err);
134 }
135 }));
136 });
137 }
138 /**
139 * @param {SecurityRolesInterfaces.UserRoleAssignmentRef[]} roleAssignments
140 * @param {string} scopeId
141 * @param {string} resourceId
142 */
143 setRoleAssignments(roleAssignments, scopeId, resourceId) {
144 return __awaiter(this, void 0, void 0, function* () {
145 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
146 let routeValues = {
147 scopeId: scopeId,
148 resourceId: resourceId
149 };
150 try {
151 let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues);
152 let url = verData.requestUrl;
153 let options = this.createRequestOptions('application/json', verData.apiVersion);
154 let res;
155 res = yield this.rest.replace(url, roleAssignments, options);
156 let ret = this.formatResponse(res.result, SecurityRolesInterfaces.TypeInfo.RoleAssignment, true);
157 resolve(ret);
158 }
159 catch (err) {
160 reject(err);
161 }
162 }));
163 });
164 }
165 /**
166 * @param {string} scopeId
167 */
168 getRoleDefinitions(scopeId) {
169 return __awaiter(this, void 0, void 0, function* () {
170 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
171 let routeValues = {
172 scopeId: scopeId
173 };
174 try {
175 let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "f4cc9a86-453c-48d2-b44d-d3bd5c105f4f", routeValues);
176 let url = verData.requestUrl;
177 let options = this.createRequestOptions('application/json', verData.apiVersion);
178 let res;
179 res = yield this.rest.get(url, options);
180 let ret = this.formatResponse(res.result, null, true);
181 resolve(ret);
182 }
183 catch (err) {
184 reject(err);
185 }
186 }));
187 });
188 }
189}
190exports.SecurityRolesApi = SecurityRolesApi;