Matteo Scandolo | df0f98d | 2015-12-02 11:30:46 -0800 | [diff] [blame] | 1 | /*jshint -W069 */ |
| 2 | /*global angular:false */ |
| 3 | angular.module('xos.xoslib', []) |
| 4 | .factory('xoslib', ['$q', '$http', '$rootScope', function($q, $http, $rootScope) { |
| 5 | 'use strict'; |
| 6 | |
| 7 | /** |
| 8 | * |
| 9 | * @class xoslib |
| 10 | * @param {(string|object)} [domainOrOptions] - The project domain or options object. If object, see the object's optional properties. |
| 11 | * @param {string} [domainOrOptions.domain] - The project domain |
| 12 | * @param {string} [domainOrOptions.cache] - An angularjs cache implementation |
| 13 | * @param {object} [domainOrOptions.token] - auth token - object with value property and optional headerOrQueryName and isQuery properties |
| 14 | * @param {string} [cache] - An angularjs cache implementation |
| 15 | */ |
| 16 | var xoslib = (function() { |
| 17 | function xoslib(options, cache) { |
| 18 | var domain = (typeof options === 'object') ? options.domain : options; |
| 19 | this.domain = typeof(domain) === 'string' ? domain : 'http://localhost:9999'; |
| 20 | cache = cache || ((typeof options === 'object') ? options.cache : cache); |
| 21 | this.cache = cache; |
| 22 | } |
| 23 | |
| 24 | xoslib.prototype.$on = function($scope, path, handler) { |
| 25 | var url = domain + path; |
| 26 | $scope.$on(url, function() { |
| 27 | handler(); |
| 28 | }); |
| 29 | return this; |
| 30 | }; |
| 31 | |
| 32 | xoslib.prototype.$broadcast = function(path) { |
| 33 | var url = domain + path; |
| 34 | //cache.remove(url); |
| 35 | $rootScope.$broadcast(url); |
| 36 | return this; |
| 37 | }; |
| 38 | |
| 39 | xoslib.transformRequest = function(obj) { |
| 40 | var str = []; |
| 41 | for (var p in obj) { |
| 42 | var val = obj[p]; |
| 43 | if (angular.isArray(val)) { |
| 44 | val.forEach(function(val) { |
| 45 | str.push(encodeURIComponent(p) + "=" + encodeURIComponent(val)); |
| 46 | }); |
| 47 | } else { |
| 48 | str.push(encodeURIComponent(p) + "=" + encodeURIComponent(val)); |
| 49 | } |
| 50 | } |
| 51 | return str.join("&"); |
| 52 | }; |
| 53 | |
| 54 | /** |
| 55 | * |
| 56 | * @method |
| 57 | * @name xoslib#Monitoring_Channel_Detail_GET |
| 58 | * @param {string} pk - |
| 59 | * |
| 60 | */ |
| 61 | xoslib.prototype.Monitoring_Channel_Detail_GET = function(parameters) { |
| 62 | if (parameters === undefined) { |
| 63 | parameters = {}; |
| 64 | } |
| 65 | var deferred = $q.defer(); |
| 66 | |
| 67 | var domain = this.domain; |
| 68 | var path = '/xoslib/monitoringchannel/{pk}/'; |
| 69 | |
| 70 | var body; |
| 71 | var queryParameters = {}; |
| 72 | var headers = {}; |
| 73 | var form = {}; |
| 74 | |
| 75 | path = path.replace('{pk}', parameters['pk']); |
| 76 | |
| 77 | if (parameters['pk'] === undefined) { |
| 78 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 79 | return deferred.promise; |
| 80 | } |
| 81 | |
| 82 | if (parameters.$queryParameters) { |
| 83 | Object.keys(parameters.$queryParameters) |
| 84 | .forEach(function(parameterName) { |
| 85 | var parameter = parameters.$queryParameters[parameterName]; |
| 86 | queryParameters[parameterName] = parameter; |
| 87 | }); |
| 88 | } |
| 89 | |
| 90 | var url = domain + path; |
| 91 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 92 | if (cached !== undefined && parameters.$refresh !== true) { |
| 93 | deferred.resolve(cached); |
| 94 | return deferred.promise; |
| 95 | } |
| 96 | var options = { |
| 97 | timeout: parameters.$timeout, |
| 98 | method: 'GET', |
| 99 | url: url, |
| 100 | params: queryParameters, |
| 101 | data: body, |
| 102 | headers: headers |
| 103 | }; |
| 104 | if (Object.keys(form).length > 0) { |
| 105 | options.data = form; |
| 106 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 107 | options.transformRequest = xoslib.transformRequest; |
| 108 | } |
| 109 | $http(options) |
| 110 | .success(function(data, status, headers, config) { |
| 111 | deferred.resolve(data); |
| 112 | if (parameters.$cache !== undefined) { |
| 113 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 114 | } |
| 115 | }) |
| 116 | .error(function(data, status, headers, config) { |
| 117 | deferred.reject({ |
| 118 | status: status, |
| 119 | headers: headers, |
| 120 | config: config, |
| 121 | body: data |
| 122 | }); |
| 123 | }); |
| 124 | |
| 125 | return deferred.promise; |
| 126 | }; |
| 127 | /** |
| 128 | * |
| 129 | * @method |
| 130 | * @name xoslib#Monitoring_Channel_Detail_PUT |
| 131 | * @param {string} pk - |
| 132 | * @param {string} provider_service - |
| 133 | * |
| 134 | */ |
| 135 | xoslib.prototype.Monitoring_Channel_Detail_PUT = function(parameters) { |
| 136 | if (parameters === undefined) { |
| 137 | parameters = {}; |
| 138 | } |
| 139 | var deferred = $q.defer(); |
| 140 | |
| 141 | var domain = this.domain; |
| 142 | var path = '/xoslib/monitoringchannel/{pk}/'; |
| 143 | |
| 144 | var body; |
| 145 | var queryParameters = {}; |
| 146 | var headers = {}; |
| 147 | var form = {}; |
| 148 | |
| 149 | path = path.replace('{pk}', parameters['pk']); |
| 150 | |
| 151 | if (parameters['pk'] === undefined) { |
| 152 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 153 | return deferred.promise; |
| 154 | } |
| 155 | |
| 156 | if (parameters['provider_service'] !== undefined) { |
| 157 | form['provider_service'] = parameters['provider_service']; |
| 158 | } |
| 159 | |
| 160 | if (parameters['provider_service'] === undefined) { |
| 161 | deferred.reject(new Error('Missing required form parameter: provider_service')); |
| 162 | return deferred.promise; |
| 163 | } |
| 164 | |
| 165 | if (parameters.$queryParameters) { |
| 166 | Object.keys(parameters.$queryParameters) |
| 167 | .forEach(function(parameterName) { |
| 168 | var parameter = parameters.$queryParameters[parameterName]; |
| 169 | queryParameters[parameterName] = parameter; |
| 170 | }); |
| 171 | } |
| 172 | |
| 173 | var url = domain + path; |
| 174 | var options = { |
| 175 | timeout: parameters.$timeout, |
| 176 | method: 'PUT', |
| 177 | url: url, |
| 178 | params: queryParameters, |
| 179 | data: body, |
| 180 | headers: headers |
| 181 | }; |
| 182 | if (Object.keys(form).length > 0) { |
| 183 | options.data = form; |
| 184 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 185 | options.transformRequest = xoslib.transformRequest; |
| 186 | } |
| 187 | $http(options) |
| 188 | .success(function(data, status, headers, config) { |
| 189 | deferred.resolve(data); |
| 190 | if (parameters.$cache !== undefined) { |
| 191 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 192 | } |
| 193 | }) |
| 194 | .error(function(data, status, headers, config) { |
| 195 | deferred.reject({ |
| 196 | status: status, |
| 197 | headers: headers, |
| 198 | config: config, |
| 199 | body: data |
| 200 | }); |
| 201 | }); |
| 202 | |
| 203 | return deferred.promise; |
| 204 | }; |
| 205 | /** |
| 206 | * |
| 207 | * @method |
| 208 | * @name xoslib#Monitoring_Channel_Detail_PATCH |
| 209 | * @param {string} pk - |
| 210 | * @param {string} provider_service - |
| 211 | * |
| 212 | */ |
| 213 | xoslib.prototype.Monitoring_Channel_Detail_PATCH = function(parameters) { |
| 214 | if (parameters === undefined) { |
| 215 | parameters = {}; |
| 216 | } |
| 217 | var deferred = $q.defer(); |
| 218 | |
| 219 | var domain = this.domain; |
| 220 | var path = '/xoslib/monitoringchannel/{pk}/'; |
| 221 | |
| 222 | var body; |
| 223 | var queryParameters = {}; |
| 224 | var headers = {}; |
| 225 | var form = {}; |
| 226 | |
| 227 | path = path.replace('{pk}', parameters['pk']); |
| 228 | |
| 229 | if (parameters['pk'] === undefined) { |
| 230 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 231 | return deferred.promise; |
| 232 | } |
| 233 | |
| 234 | if (parameters['provider_service'] !== undefined) { |
| 235 | form['provider_service'] = parameters['provider_service']; |
| 236 | } |
| 237 | |
| 238 | if (parameters.$queryParameters) { |
| 239 | Object.keys(parameters.$queryParameters) |
| 240 | .forEach(function(parameterName) { |
| 241 | var parameter = parameters.$queryParameters[parameterName]; |
| 242 | queryParameters[parameterName] = parameter; |
| 243 | }); |
| 244 | } |
| 245 | |
| 246 | var url = domain + path; |
| 247 | var options = { |
| 248 | timeout: parameters.$timeout, |
| 249 | method: 'PATCH', |
| 250 | url: url, |
| 251 | params: queryParameters, |
| 252 | data: body, |
| 253 | headers: headers |
| 254 | }; |
| 255 | if (Object.keys(form).length > 0) { |
| 256 | options.data = form; |
| 257 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 258 | options.transformRequest = xoslib.transformRequest; |
| 259 | } |
| 260 | $http(options) |
| 261 | .success(function(data, status, headers, config) { |
| 262 | deferred.resolve(data); |
| 263 | if (parameters.$cache !== undefined) { |
| 264 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 265 | } |
| 266 | }) |
| 267 | .error(function(data, status, headers, config) { |
| 268 | deferred.reject({ |
| 269 | status: status, |
| 270 | headers: headers, |
| 271 | config: config, |
| 272 | body: data |
| 273 | }); |
| 274 | }); |
| 275 | |
| 276 | return deferred.promise; |
| 277 | }; |
| 278 | /** |
| 279 | * |
| 280 | * @method |
| 281 | * @name xoslib#Monitoring_Channel_Detail_DELETE |
| 282 | * @param {string} pk - |
| 283 | * |
| 284 | */ |
| 285 | xoslib.prototype.Monitoring_Channel_Detail_DELETE = function(parameters) { |
| 286 | if (parameters === undefined) { |
| 287 | parameters = {}; |
| 288 | } |
| 289 | var deferred = $q.defer(); |
| 290 | |
| 291 | var domain = this.domain; |
| 292 | var path = '/xoslib/monitoringchannel/{pk}/'; |
| 293 | |
| 294 | var body; |
| 295 | var queryParameters = {}; |
| 296 | var headers = {}; |
| 297 | var form = {}; |
| 298 | |
| 299 | path = path.replace('{pk}', parameters['pk']); |
| 300 | |
| 301 | if (parameters['pk'] === undefined) { |
| 302 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 303 | return deferred.promise; |
| 304 | } |
| 305 | |
| 306 | if (parameters.$queryParameters) { |
| 307 | Object.keys(parameters.$queryParameters) |
| 308 | .forEach(function(parameterName) { |
| 309 | var parameter = parameters.$queryParameters[parameterName]; |
| 310 | queryParameters[parameterName] = parameter; |
| 311 | }); |
| 312 | } |
| 313 | |
| 314 | var url = domain + path; |
| 315 | var options = { |
| 316 | timeout: parameters.$timeout, |
| 317 | method: 'DELETE', |
| 318 | url: url, |
| 319 | params: queryParameters, |
| 320 | data: body, |
| 321 | headers: headers |
| 322 | }; |
| 323 | if (Object.keys(form).length > 0) { |
| 324 | options.data = form; |
| 325 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 326 | options.transformRequest = xoslib.transformRequest; |
| 327 | } |
| 328 | $http(options) |
| 329 | .success(function(data, status, headers, config) { |
| 330 | deferred.resolve(data); |
| 331 | if (parameters.$cache !== undefined) { |
| 332 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 333 | } |
| 334 | }) |
| 335 | .error(function(data, status, headers, config) { |
| 336 | deferred.reject({ |
| 337 | status: status, |
| 338 | headers: headers, |
| 339 | config: config, |
| 340 | body: data |
| 341 | }); |
| 342 | }); |
| 343 | |
| 344 | return deferred.promise; |
| 345 | }; |
| 346 | /** |
| 347 | * |
| 348 | * @method |
| 349 | * @name xoslib#Monitoring_Channel_List_GET |
| 350 | * |
| 351 | */ |
| 352 | xoslib.prototype.Monitoring_Channel_List_GET = function(parameters) { |
| 353 | if (parameters === undefined) { |
| 354 | parameters = {}; |
| 355 | } |
| 356 | var deferred = $q.defer(); |
| 357 | |
| 358 | var domain = this.domain; |
| 359 | var path = '/xoslib/monitoringchannel/'; |
| 360 | |
| 361 | var body; |
| 362 | var queryParameters = {}; |
| 363 | var headers = {}; |
| 364 | var form = {}; |
| 365 | |
| 366 | if (parameters.$queryParameters) { |
| 367 | Object.keys(parameters.$queryParameters) |
| 368 | .forEach(function(parameterName) { |
| 369 | var parameter = parameters.$queryParameters[parameterName]; |
| 370 | queryParameters[parameterName] = parameter; |
| 371 | }); |
| 372 | } |
| 373 | |
| 374 | var url = domain + path; |
| 375 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 376 | if (cached !== undefined && parameters.$refresh !== true) { |
| 377 | deferred.resolve(cached); |
| 378 | return deferred.promise; |
| 379 | } |
| 380 | var options = { |
| 381 | timeout: parameters.$timeout, |
| 382 | method: 'GET', |
| 383 | url: url, |
| 384 | params: queryParameters, |
| 385 | data: body, |
| 386 | headers: headers |
| 387 | }; |
| 388 | if (Object.keys(form).length > 0) { |
| 389 | options.data = form; |
| 390 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 391 | options.transformRequest = xoslib.transformRequest; |
| 392 | } |
| 393 | $http(options) |
| 394 | .success(function(data, status, headers, config) { |
| 395 | deferred.resolve(data); |
| 396 | if (parameters.$cache !== undefined) { |
| 397 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 398 | } |
| 399 | }) |
| 400 | .error(function(data, status, headers, config) { |
| 401 | deferred.reject({ |
| 402 | status: status, |
| 403 | headers: headers, |
| 404 | config: config, |
| 405 | body: data |
| 406 | }); |
| 407 | }); |
| 408 | |
| 409 | return deferred.promise; |
| 410 | }; |
| 411 | /** |
| 412 | * |
| 413 | * @method |
| 414 | * @name xoslib#Monitoring_Channel_List_POST |
| 415 | * @param {string} provider_service - |
| 416 | * |
| 417 | */ |
| 418 | xoslib.prototype.Monitoring_Channel_List_POST = function(parameters) { |
| 419 | if (parameters === undefined) { |
| 420 | parameters = {}; |
| 421 | } |
| 422 | var deferred = $q.defer(); |
| 423 | |
| 424 | var domain = this.domain; |
| 425 | var path = '/xoslib/monitoringchannel/'; |
| 426 | |
| 427 | var body; |
| 428 | var queryParameters = {}; |
| 429 | var headers = {}; |
| 430 | var form = {}; |
| 431 | |
| 432 | if (parameters['provider_service'] !== undefined) { |
| 433 | form['provider_service'] = parameters['provider_service']; |
| 434 | } |
| 435 | |
| 436 | if (parameters['provider_service'] === undefined) { |
| 437 | deferred.reject(new Error('Missing required form parameter: provider_service')); |
| 438 | return deferred.promise; |
| 439 | } |
| 440 | |
| 441 | if (parameters.$queryParameters) { |
| 442 | Object.keys(parameters.$queryParameters) |
| 443 | .forEach(function(parameterName) { |
| 444 | var parameter = parameters.$queryParameters[parameterName]; |
| 445 | queryParameters[parameterName] = parameter; |
| 446 | }); |
| 447 | } |
| 448 | |
| 449 | var url = domain + path; |
| 450 | var options = { |
| 451 | timeout: parameters.$timeout, |
| 452 | method: 'POST', |
| 453 | url: url, |
| 454 | params: queryParameters, |
| 455 | data: body, |
| 456 | headers: headers |
| 457 | }; |
| 458 | if (Object.keys(form).length > 0) { |
| 459 | options.data = form; |
| 460 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 461 | options.transformRequest = xoslib.transformRequest; |
| 462 | } |
| 463 | $http(options) |
| 464 | .success(function(data, status, headers, config) { |
| 465 | deferred.resolve(data); |
| 466 | if (parameters.$cache !== undefined) { |
| 467 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 468 | } |
| 469 | }) |
| 470 | .error(function(data, status, headers, config) { |
| 471 | deferred.reject({ |
| 472 | status: status, |
| 473 | headers: headers, |
| 474 | config: config, |
| 475 | body: data |
| 476 | }); |
| 477 | }); |
| 478 | |
| 479 | return deferred.promise; |
| 480 | }; |
| 481 | /** |
| 482 | * |
| 483 | * @method |
| 484 | * @name xoslib#Hpc_Detail_GET |
| 485 | * @param {string} pk - |
| 486 | * |
| 487 | */ |
| 488 | xoslib.prototype.Hpc_Detail_GET = function(parameters) { |
| 489 | if (parameters === undefined) { |
| 490 | parameters = {}; |
| 491 | } |
| 492 | var deferred = $q.defer(); |
| 493 | |
| 494 | var domain = this.domain; |
| 495 | var path = '/xoslib/hpcview/{pk}/'; |
| 496 | |
| 497 | var body; |
| 498 | var queryParameters = {}; |
| 499 | var headers = {}; |
| 500 | var form = {}; |
| 501 | |
| 502 | path = path.replace('{pk}', parameters['pk']); |
| 503 | |
| 504 | if (parameters['pk'] === undefined) { |
| 505 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 506 | return deferred.promise; |
| 507 | } |
| 508 | |
| 509 | if (parameters.$queryParameters) { |
| 510 | Object.keys(parameters.$queryParameters) |
| 511 | .forEach(function(parameterName) { |
| 512 | var parameter = parameters.$queryParameters[parameterName]; |
| 513 | queryParameters[parameterName] = parameter; |
| 514 | }); |
| 515 | } |
| 516 | |
| 517 | var url = domain + path; |
| 518 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 519 | if (cached !== undefined && parameters.$refresh !== true) { |
| 520 | deferred.resolve(cached); |
| 521 | return deferred.promise; |
| 522 | } |
| 523 | var options = { |
| 524 | timeout: parameters.$timeout, |
| 525 | method: 'GET', |
| 526 | url: url, |
| 527 | params: queryParameters, |
| 528 | data: body, |
| 529 | headers: headers |
| 530 | }; |
| 531 | if (Object.keys(form).length > 0) { |
| 532 | options.data = form; |
| 533 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 534 | options.transformRequest = xoslib.transformRequest; |
| 535 | } |
| 536 | $http(options) |
| 537 | .success(function(data, status, headers, config) { |
| 538 | deferred.resolve(data); |
| 539 | if (parameters.$cache !== undefined) { |
| 540 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 541 | } |
| 542 | }) |
| 543 | .error(function(data, status, headers, config) { |
| 544 | deferred.reject({ |
| 545 | status: status, |
| 546 | headers: headers, |
| 547 | config: config, |
| 548 | body: data |
| 549 | }); |
| 550 | }); |
| 551 | |
| 552 | return deferred.promise; |
| 553 | }; |
| 554 | /** |
| 555 | * |
| 556 | * @method |
| 557 | * @name xoslib#Hpc_List_GET |
| 558 | * |
| 559 | */ |
| 560 | xoslib.prototype.Hpc_List_GET = function(parameters) { |
| 561 | if (parameters === undefined) { |
| 562 | parameters = {}; |
| 563 | } |
| 564 | var deferred = $q.defer(); |
| 565 | |
| 566 | var domain = this.domain; |
| 567 | var path = '/xoslib/hpcview/'; |
| 568 | |
| 569 | var body; |
| 570 | var queryParameters = {}; |
| 571 | var headers = {}; |
| 572 | var form = {}; |
| 573 | |
| 574 | if (parameters.$queryParameters) { |
| 575 | Object.keys(parameters.$queryParameters) |
| 576 | .forEach(function(parameterName) { |
| 577 | var parameter = parameters.$queryParameters[parameterName]; |
| 578 | queryParameters[parameterName] = parameter; |
| 579 | }); |
| 580 | } |
| 581 | |
| 582 | var url = domain + path; |
| 583 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 584 | if (cached !== undefined && parameters.$refresh !== true) { |
| 585 | deferred.resolve(cached); |
| 586 | return deferred.promise; |
| 587 | } |
| 588 | var options = { |
| 589 | timeout: parameters.$timeout, |
| 590 | method: 'GET', |
| 591 | url: url, |
| 592 | params: queryParameters, |
| 593 | data: body, |
| 594 | headers: headers |
| 595 | }; |
| 596 | if (Object.keys(form).length > 0) { |
| 597 | options.data = form; |
| 598 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 599 | options.transformRequest = xoslib.transformRequest; |
| 600 | } |
| 601 | $http(options) |
| 602 | .success(function(data, status, headers, config) { |
| 603 | deferred.resolve(data); |
| 604 | if (parameters.$cache !== undefined) { |
| 605 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 606 | } |
| 607 | }) |
| 608 | .error(function(data, status, headers, config) { |
| 609 | deferred.reject({ |
| 610 | status: status, |
| 611 | headers: headers, |
| 612 | config: config, |
| 613 | body: data |
| 614 | }); |
| 615 | }); |
| 616 | |
| 617 | return deferred.promise; |
| 618 | }; |
| 619 | /** |
| 620 | * |
| 621 | * @method |
| 622 | * @name xoslib#Tenant_Detail_GET |
| 623 | * @param {string} pk - |
| 624 | * |
| 625 | */ |
| 626 | xoslib.prototype.Tenant_Detail_GET = function(parameters) { |
| 627 | if (parameters === undefined) { |
| 628 | parameters = {}; |
| 629 | } |
| 630 | var deferred = $q.defer(); |
| 631 | |
| 632 | var domain = this.domain; |
| 633 | var path = '/xoslib/tenantview/{pk}/'; |
| 634 | |
| 635 | var body; |
| 636 | var queryParameters = {}; |
| 637 | var headers = {}; |
| 638 | var form = {}; |
| 639 | |
| 640 | path = path.replace('{pk}', parameters['pk']); |
| 641 | |
| 642 | if (parameters['pk'] === undefined) { |
| 643 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 644 | return deferred.promise; |
| 645 | } |
| 646 | |
| 647 | if (parameters.$queryParameters) { |
| 648 | Object.keys(parameters.$queryParameters) |
| 649 | .forEach(function(parameterName) { |
| 650 | var parameter = parameters.$queryParameters[parameterName]; |
| 651 | queryParameters[parameterName] = parameter; |
| 652 | }); |
| 653 | } |
| 654 | |
| 655 | var url = domain + path; |
| 656 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 657 | if (cached !== undefined && parameters.$refresh !== true) { |
| 658 | deferred.resolve(cached); |
| 659 | return deferred.promise; |
| 660 | } |
| 661 | var options = { |
| 662 | timeout: parameters.$timeout, |
| 663 | method: 'GET', |
| 664 | url: url, |
| 665 | params: queryParameters, |
| 666 | data: body, |
| 667 | headers: headers |
| 668 | }; |
| 669 | if (Object.keys(form).length > 0) { |
| 670 | options.data = form; |
| 671 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 672 | options.transformRequest = xoslib.transformRequest; |
| 673 | } |
| 674 | $http(options) |
| 675 | .success(function(data, status, headers, config) { |
| 676 | deferred.resolve(data); |
| 677 | if (parameters.$cache !== undefined) { |
| 678 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 679 | } |
| 680 | }) |
| 681 | .error(function(data, status, headers, config) { |
| 682 | deferred.reject({ |
| 683 | status: status, |
| 684 | headers: headers, |
| 685 | config: config, |
| 686 | body: data |
| 687 | }); |
| 688 | }); |
| 689 | |
| 690 | return deferred.promise; |
| 691 | }; |
| 692 | /** |
| 693 | * |
| 694 | * @method |
| 695 | * @name xoslib#Tenant_List_GET |
| 696 | * |
| 697 | */ |
| 698 | xoslib.prototype.Tenant_List_GET = function(parameters) { |
| 699 | if (parameters === undefined) { |
| 700 | parameters = {}; |
| 701 | } |
| 702 | var deferred = $q.defer(); |
| 703 | |
| 704 | var domain = this.domain; |
| 705 | var path = '/xoslib/tenantview/'; |
| 706 | |
| 707 | var body; |
| 708 | var queryParameters = {}; |
| 709 | var headers = {}; |
| 710 | var form = {}; |
| 711 | |
| 712 | if (parameters.$queryParameters) { |
| 713 | Object.keys(parameters.$queryParameters) |
| 714 | .forEach(function(parameterName) { |
| 715 | var parameter = parameters.$queryParameters[parameterName]; |
| 716 | queryParameters[parameterName] = parameter; |
| 717 | }); |
| 718 | } |
| 719 | |
| 720 | var url = domain + path; |
| 721 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 722 | if (cached !== undefined && parameters.$refresh !== true) { |
| 723 | deferred.resolve(cached); |
| 724 | return deferred.promise; |
| 725 | } |
| 726 | var options = { |
| 727 | timeout: parameters.$timeout, |
| 728 | method: 'GET', |
| 729 | url: url, |
| 730 | params: queryParameters, |
| 731 | data: body, |
| 732 | headers: headers |
| 733 | }; |
| 734 | if (Object.keys(form).length > 0) { |
| 735 | options.data = form; |
| 736 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 737 | options.transformRequest = xoslib.transformRequest; |
| 738 | } |
| 739 | $http(options) |
| 740 | .success(function(data, status, headers, config) { |
| 741 | deferred.resolve(data); |
| 742 | if (parameters.$cache !== undefined) { |
| 743 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 744 | } |
| 745 | }) |
| 746 | .error(function(data, status, headers, config) { |
| 747 | deferred.reject({ |
| 748 | status: status, |
| 749 | headers: headers, |
| 750 | config: config, |
| 751 | body: data |
| 752 | }); |
| 753 | }); |
| 754 | |
| 755 | return deferred.promise; |
| 756 | }; |
| 757 | /** |
| 758 | * |
| 759 | * @method |
| 760 | * @name xoslib#Port_Forwarding_Detail_GET |
| 761 | * @param {string} pk - |
| 762 | * |
| 763 | */ |
| 764 | xoslib.prototype.Port_Forwarding_Detail_GET = function(parameters) { |
| 765 | if (parameters === undefined) { |
| 766 | parameters = {}; |
| 767 | } |
| 768 | var deferred = $q.defer(); |
| 769 | |
| 770 | var domain = this.domain; |
| 771 | var path = '/xoslib/portforwarding/{pk}/'; |
| 772 | |
| 773 | var body; |
| 774 | var queryParameters = {}; |
| 775 | var headers = {}; |
| 776 | var form = {}; |
| 777 | |
| 778 | path = path.replace('{pk}', parameters['pk']); |
| 779 | |
| 780 | if (parameters['pk'] === undefined) { |
| 781 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 782 | return deferred.promise; |
| 783 | } |
| 784 | |
| 785 | if (parameters.$queryParameters) { |
| 786 | Object.keys(parameters.$queryParameters) |
| 787 | .forEach(function(parameterName) { |
| 788 | var parameter = parameters.$queryParameters[parameterName]; |
| 789 | queryParameters[parameterName] = parameter; |
| 790 | }); |
| 791 | } |
| 792 | |
| 793 | var url = domain + path; |
| 794 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 795 | if (cached !== undefined && parameters.$refresh !== true) { |
| 796 | deferred.resolve(cached); |
| 797 | return deferred.promise; |
| 798 | } |
| 799 | var options = { |
| 800 | timeout: parameters.$timeout, |
| 801 | method: 'GET', |
| 802 | url: url, |
| 803 | params: queryParameters, |
| 804 | data: body, |
| 805 | headers: headers |
| 806 | }; |
| 807 | if (Object.keys(form).length > 0) { |
| 808 | options.data = form; |
| 809 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 810 | options.transformRequest = xoslib.transformRequest; |
| 811 | } |
| 812 | $http(options) |
| 813 | .success(function(data, status, headers, config) { |
| 814 | deferred.resolve(data); |
| 815 | if (parameters.$cache !== undefined) { |
| 816 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 817 | } |
| 818 | }) |
| 819 | .error(function(data, status, headers, config) { |
| 820 | deferred.reject({ |
| 821 | status: status, |
| 822 | headers: headers, |
| 823 | config: config, |
| 824 | body: data |
| 825 | }); |
| 826 | }); |
| 827 | |
| 828 | return deferred.promise; |
| 829 | }; |
| 830 | /** |
| 831 | * |
| 832 | * @method |
| 833 | * @name xoslib#Port_Forwarding_List_GET |
| 834 | * |
| 835 | */ |
| 836 | xoslib.prototype.Port_Forwarding_List_GET = function(parameters) { |
| 837 | if (parameters === undefined) { |
| 838 | parameters = {}; |
| 839 | } |
| 840 | var deferred = $q.defer(); |
| 841 | |
| 842 | var domain = this.domain; |
| 843 | var path = '/xoslib/portforwarding/'; |
| 844 | |
| 845 | var body; |
| 846 | var queryParameters = {}; |
| 847 | var headers = {}; |
| 848 | var form = {}; |
| 849 | |
| 850 | if (parameters.$queryParameters) { |
| 851 | Object.keys(parameters.$queryParameters) |
| 852 | .forEach(function(parameterName) { |
| 853 | var parameter = parameters.$queryParameters[parameterName]; |
| 854 | queryParameters[parameterName] = parameter; |
| 855 | }); |
| 856 | } |
| 857 | |
| 858 | var url = domain + path; |
| 859 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 860 | if (cached !== undefined && parameters.$refresh !== true) { |
| 861 | deferred.resolve(cached); |
| 862 | return deferred.promise; |
| 863 | } |
| 864 | var options = { |
| 865 | timeout: parameters.$timeout, |
| 866 | method: 'GET', |
| 867 | url: url, |
| 868 | params: queryParameters, |
| 869 | data: body, |
| 870 | headers: headers |
| 871 | }; |
| 872 | if (Object.keys(form).length > 0) { |
| 873 | options.data = form; |
| 874 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 875 | options.transformRequest = xoslib.transformRequest; |
| 876 | } |
| 877 | $http(options) |
| 878 | .success(function(data, status, headers, config) { |
| 879 | deferred.resolve(data); |
| 880 | if (parameters.$cache !== undefined) { |
| 881 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 882 | } |
| 883 | }) |
| 884 | .error(function(data, status, headers, config) { |
| 885 | deferred.reject({ |
| 886 | status: status, |
| 887 | headers: headers, |
| 888 | config: config, |
| 889 | body: data |
| 890 | }); |
| 891 | }); |
| 892 | |
| 893 | return deferred.promise; |
| 894 | }; |
| 895 | /** |
| 896 | * |
| 897 | * @method |
| 898 | * @name xoslib#Ssh_Key_Detail_GET |
| 899 | * @param {string} pk - |
| 900 | * |
| 901 | */ |
| 902 | xoslib.prototype.Ssh_Key_Detail_GET = function(parameters) { |
| 903 | if (parameters === undefined) { |
| 904 | parameters = {}; |
| 905 | } |
| 906 | var deferred = $q.defer(); |
| 907 | |
| 908 | var domain = this.domain; |
| 909 | var path = '/xoslib/sshkeys/{pk}/'; |
| 910 | |
| 911 | var body; |
| 912 | var queryParameters = {}; |
| 913 | var headers = {}; |
| 914 | var form = {}; |
| 915 | |
| 916 | path = path.replace('{pk}', parameters['pk']); |
| 917 | |
| 918 | if (parameters['pk'] === undefined) { |
| 919 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 920 | return deferred.promise; |
| 921 | } |
| 922 | |
| 923 | if (parameters.$queryParameters) { |
| 924 | Object.keys(parameters.$queryParameters) |
| 925 | .forEach(function(parameterName) { |
| 926 | var parameter = parameters.$queryParameters[parameterName]; |
| 927 | queryParameters[parameterName] = parameter; |
| 928 | }); |
| 929 | } |
| 930 | |
| 931 | var url = domain + path; |
| 932 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 933 | if (cached !== undefined && parameters.$refresh !== true) { |
| 934 | deferred.resolve(cached); |
| 935 | return deferred.promise; |
| 936 | } |
| 937 | var options = { |
| 938 | timeout: parameters.$timeout, |
| 939 | method: 'GET', |
| 940 | url: url, |
| 941 | params: queryParameters, |
| 942 | data: body, |
| 943 | headers: headers |
| 944 | }; |
| 945 | if (Object.keys(form).length > 0) { |
| 946 | options.data = form; |
| 947 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 948 | options.transformRequest = xoslib.transformRequest; |
| 949 | } |
| 950 | $http(options) |
| 951 | .success(function(data, status, headers, config) { |
| 952 | deferred.resolve(data); |
| 953 | if (parameters.$cache !== undefined) { |
| 954 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 955 | } |
| 956 | }) |
| 957 | .error(function(data, status, headers, config) { |
| 958 | deferred.reject({ |
| 959 | status: status, |
| 960 | headers: headers, |
| 961 | config: config, |
| 962 | body: data |
| 963 | }); |
| 964 | }); |
| 965 | |
| 966 | return deferred.promise; |
| 967 | }; |
| 968 | /** |
| 969 | * |
| 970 | * @method |
| 971 | * @name xoslib#Ssh_Key_List_GET |
| 972 | * |
| 973 | */ |
| 974 | xoslib.prototype.Ssh_Key_List_GET = function(parameters) { |
| 975 | if (parameters === undefined) { |
| 976 | parameters = {}; |
| 977 | } |
| 978 | var deferred = $q.defer(); |
| 979 | |
| 980 | var domain = this.domain; |
| 981 | var path = '/xoslib/sshkeys/'; |
| 982 | |
| 983 | var body; |
| 984 | var queryParameters = {}; |
| 985 | var headers = {}; |
| 986 | var form = {}; |
| 987 | |
| 988 | if (parameters.$queryParameters) { |
| 989 | Object.keys(parameters.$queryParameters) |
| 990 | .forEach(function(parameterName) { |
| 991 | var parameter = parameters.$queryParameters[parameterName]; |
| 992 | queryParameters[parameterName] = parameter; |
| 993 | }); |
| 994 | } |
| 995 | |
| 996 | var url = domain + path; |
| 997 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 998 | if (cached !== undefined && parameters.$refresh !== true) { |
| 999 | deferred.resolve(cached); |
| 1000 | return deferred.promise; |
| 1001 | } |
| 1002 | var options = { |
| 1003 | timeout: parameters.$timeout, |
| 1004 | method: 'GET', |
| 1005 | url: url, |
| 1006 | params: queryParameters, |
| 1007 | data: body, |
| 1008 | headers: headers |
| 1009 | }; |
| 1010 | if (Object.keys(form).length > 0) { |
| 1011 | options.data = form; |
| 1012 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1013 | options.transformRequest = xoslib.transformRequest; |
| 1014 | } |
| 1015 | $http(options) |
| 1016 | .success(function(data, status, headers, config) { |
| 1017 | deferred.resolve(data); |
| 1018 | if (parameters.$cache !== undefined) { |
| 1019 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1020 | } |
| 1021 | }) |
| 1022 | .error(function(data, status, headers, config) { |
| 1023 | deferred.reject({ |
| 1024 | status: status, |
| 1025 | headers: headers, |
| 1026 | config: config, |
| 1027 | body: data |
| 1028 | }); |
| 1029 | }); |
| 1030 | |
| 1031 | return deferred.promise; |
| 1032 | }; |
| 1033 | /** |
| 1034 | * |
| 1035 | * @method |
| 1036 | * @name xoslib#Cord_Debug_get_vbng_dump |
| 1037 | * |
| 1038 | */ |
| 1039 | xoslib.prototype.Cord_Debug_get_vbng_dump = function(parameters) { |
| 1040 | if (parameters === undefined) { |
| 1041 | parameters = {}; |
| 1042 | } |
| 1043 | var deferred = $q.defer(); |
| 1044 | |
| 1045 | var domain = this.domain; |
| 1046 | var path = '/xoslib/rs/cord_debug/vbng_dump/'; |
| 1047 | |
| 1048 | var body; |
| 1049 | var queryParameters = {}; |
| 1050 | var headers = {}; |
| 1051 | var form = {}; |
| 1052 | |
| 1053 | if (parameters.$queryParameters) { |
| 1054 | Object.keys(parameters.$queryParameters) |
| 1055 | .forEach(function(parameterName) { |
| 1056 | var parameter = parameters.$queryParameters[parameterName]; |
| 1057 | queryParameters[parameterName] = parameter; |
| 1058 | }); |
| 1059 | } |
| 1060 | |
| 1061 | var url = domain + path; |
| 1062 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 1063 | if (cached !== undefined && parameters.$refresh !== true) { |
| 1064 | deferred.resolve(cached); |
| 1065 | return deferred.promise; |
| 1066 | } |
| 1067 | var options = { |
| 1068 | timeout: parameters.$timeout, |
| 1069 | method: 'GET', |
| 1070 | url: url, |
| 1071 | params: queryParameters, |
| 1072 | data: body, |
| 1073 | headers: headers |
| 1074 | }; |
| 1075 | if (Object.keys(form).length > 0) { |
| 1076 | options.data = form; |
| 1077 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1078 | options.transformRequest = xoslib.transformRequest; |
| 1079 | } |
| 1080 | $http(options) |
| 1081 | .success(function(data, status, headers, config) { |
| 1082 | deferred.resolve(data); |
| 1083 | if (parameters.$cache !== undefined) { |
| 1084 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1085 | } |
| 1086 | }) |
| 1087 | .error(function(data, status, headers, config) { |
| 1088 | deferred.reject({ |
| 1089 | status: status, |
| 1090 | headers: headers, |
| 1091 | config: config, |
| 1092 | body: data |
| 1093 | }); |
| 1094 | }); |
| 1095 | |
| 1096 | return deferred.promise; |
| 1097 | }; |
| 1098 | /** |
| 1099 | * |
| 1100 | * @method |
| 1101 | * @name xoslib#Cord_Subscriber_Detail_GET |
| 1102 | * @param {string} pk - |
| 1103 | * |
| 1104 | */ |
| 1105 | xoslib.prototype.Cord_Subscriber_Detail_GET = function(parameters) { |
| 1106 | if (parameters === undefined) { |
| 1107 | parameters = {}; |
| 1108 | } |
| 1109 | var deferred = $q.defer(); |
| 1110 | |
| 1111 | var domain = this.domain; |
| 1112 | var path = '/xoslib/cordsubscriber/{pk}/'; |
| 1113 | |
| 1114 | var body; |
| 1115 | var queryParameters = {}; |
| 1116 | var headers = {}; |
| 1117 | var form = {}; |
| 1118 | |
| 1119 | path = path.replace('{pk}', parameters['pk']); |
| 1120 | |
| 1121 | if (parameters['pk'] === undefined) { |
| 1122 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 1123 | return deferred.promise; |
| 1124 | } |
| 1125 | |
| 1126 | if (parameters.$queryParameters) { |
| 1127 | Object.keys(parameters.$queryParameters) |
| 1128 | .forEach(function(parameterName) { |
| 1129 | var parameter = parameters.$queryParameters[parameterName]; |
| 1130 | queryParameters[parameterName] = parameter; |
| 1131 | }); |
| 1132 | } |
| 1133 | |
| 1134 | var url = domain + path; |
| 1135 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 1136 | if (cached !== undefined && parameters.$refresh !== true) { |
| 1137 | deferred.resolve(cached); |
| 1138 | return deferred.promise; |
| 1139 | } |
| 1140 | var options = { |
| 1141 | timeout: parameters.$timeout, |
| 1142 | method: 'GET', |
| 1143 | url: url, |
| 1144 | params: queryParameters, |
| 1145 | data: body, |
| 1146 | headers: headers |
| 1147 | }; |
| 1148 | if (Object.keys(form).length > 0) { |
| 1149 | options.data = form; |
| 1150 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1151 | options.transformRequest = xoslib.transformRequest; |
| 1152 | } |
| 1153 | $http(options) |
| 1154 | .success(function(data, status, headers, config) { |
| 1155 | deferred.resolve(data); |
| 1156 | if (parameters.$cache !== undefined) { |
| 1157 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1158 | } |
| 1159 | }) |
| 1160 | .error(function(data, status, headers, config) { |
| 1161 | deferred.reject({ |
| 1162 | status: status, |
| 1163 | headers: headers, |
| 1164 | config: config, |
| 1165 | body: data |
| 1166 | }); |
| 1167 | }); |
| 1168 | |
| 1169 | return deferred.promise; |
| 1170 | }; |
| 1171 | /** |
| 1172 | * |
| 1173 | * @method |
| 1174 | * @name xoslib#Cord_Subscriber_Detail_PUT |
| 1175 | * @param {string} pk - |
| 1176 | * @param {boolean} firewall_enable - |
| 1177 | * @param {string} firewall_rules - |
| 1178 | * @param {boolean} url_filter_enable - |
| 1179 | * @param {string} url_filter_rules - |
| 1180 | * @param {string} url_filter_level - |
| 1181 | * @param {boolean} vcpe_synced - |
| 1182 | * @param {boolean} cdn_enable - |
| 1183 | * @param {string} routeable_subnet - |
| 1184 | * |
| 1185 | */ |
| 1186 | xoslib.prototype.Cord_Subscriber_Detail_PUT = function(parameters) { |
| 1187 | if (parameters === undefined) { |
| 1188 | parameters = {}; |
| 1189 | } |
| 1190 | var deferred = $q.defer(); |
| 1191 | |
| 1192 | var domain = this.domain; |
| 1193 | var path = '/xoslib/cordsubscriber/{pk}/'; |
| 1194 | |
| 1195 | var body; |
| 1196 | var queryParameters = {}; |
| 1197 | var headers = {}; |
| 1198 | var form = {}; |
| 1199 | |
| 1200 | path = path.replace('{pk}', parameters['pk']); |
| 1201 | |
| 1202 | if (parameters['pk'] === undefined) { |
| 1203 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 1204 | return deferred.promise; |
| 1205 | } |
| 1206 | |
| 1207 | if (parameters['firewall_enable'] !== undefined) { |
| 1208 | form['firewall_enable'] = parameters['firewall_enable']; |
| 1209 | } |
| 1210 | |
| 1211 | if (parameters['firewall_enable'] === undefined) { |
| 1212 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 1213 | return deferred.promise; |
| 1214 | } |
| 1215 | |
| 1216 | if (parameters['firewall_rules'] !== undefined) { |
| 1217 | form['firewall_rules'] = parameters['firewall_rules']; |
| 1218 | } |
| 1219 | |
| 1220 | if (parameters['firewall_rules'] === undefined) { |
| 1221 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 1222 | return deferred.promise; |
| 1223 | } |
| 1224 | |
| 1225 | if (parameters['url_filter_enable'] !== undefined) { |
| 1226 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 1227 | } |
| 1228 | |
| 1229 | if (parameters['url_filter_enable'] === undefined) { |
| 1230 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 1231 | return deferred.promise; |
| 1232 | } |
| 1233 | |
| 1234 | if (parameters['url_filter_rules'] !== undefined) { |
| 1235 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 1236 | } |
| 1237 | |
| 1238 | if (parameters['url_filter_rules'] === undefined) { |
| 1239 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 1240 | return deferred.promise; |
| 1241 | } |
| 1242 | |
| 1243 | if (parameters['url_filter_level'] !== undefined) { |
| 1244 | form['url_filter_level'] = parameters['url_filter_level']; |
| 1245 | } |
| 1246 | |
| 1247 | if (parameters['vcpe_synced'] !== undefined) { |
| 1248 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 1249 | } |
| 1250 | |
| 1251 | if (parameters['vcpe_synced'] === undefined) { |
| 1252 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 1253 | return deferred.promise; |
| 1254 | } |
| 1255 | |
| 1256 | if (parameters['cdn_enable'] !== undefined) { |
| 1257 | form['cdn_enable'] = parameters['cdn_enable']; |
| 1258 | } |
| 1259 | |
| 1260 | if (parameters['cdn_enable'] === undefined) { |
| 1261 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 1262 | return deferred.promise; |
| 1263 | } |
| 1264 | |
| 1265 | if (parameters['routeable_subnet'] !== undefined) { |
| 1266 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 1267 | } |
| 1268 | |
| 1269 | if (parameters.$queryParameters) { |
| 1270 | Object.keys(parameters.$queryParameters) |
| 1271 | .forEach(function(parameterName) { |
| 1272 | var parameter = parameters.$queryParameters[parameterName]; |
| 1273 | queryParameters[parameterName] = parameter; |
| 1274 | }); |
| 1275 | } |
| 1276 | |
| 1277 | var url = domain + path; |
| 1278 | var options = { |
| 1279 | timeout: parameters.$timeout, |
| 1280 | method: 'PUT', |
| 1281 | url: url, |
| 1282 | params: queryParameters, |
| 1283 | data: body, |
| 1284 | headers: headers |
| 1285 | }; |
| 1286 | if (Object.keys(form).length > 0) { |
| 1287 | options.data = form; |
| 1288 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1289 | options.transformRequest = xoslib.transformRequest; |
| 1290 | } |
| 1291 | $http(options) |
| 1292 | .success(function(data, status, headers, config) { |
| 1293 | deferred.resolve(data); |
| 1294 | if (parameters.$cache !== undefined) { |
| 1295 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1296 | } |
| 1297 | }) |
| 1298 | .error(function(data, status, headers, config) { |
| 1299 | deferred.reject({ |
| 1300 | status: status, |
| 1301 | headers: headers, |
| 1302 | config: config, |
| 1303 | body: data |
| 1304 | }); |
| 1305 | }); |
| 1306 | |
| 1307 | return deferred.promise; |
| 1308 | }; |
| 1309 | /** |
| 1310 | * |
| 1311 | * @method |
| 1312 | * @name xoslib#Cord_Subscriber_Detail_PATCH |
| 1313 | * @param {string} pk - |
| 1314 | * @param {boolean} firewall_enable - |
| 1315 | * @param {string} firewall_rules - |
| 1316 | * @param {boolean} url_filter_enable - |
| 1317 | * @param {string} url_filter_rules - |
| 1318 | * @param {string} url_filter_level - |
| 1319 | * @param {boolean} vcpe_synced - |
| 1320 | * @param {boolean} cdn_enable - |
| 1321 | * @param {string} routeable_subnet - |
| 1322 | * |
| 1323 | */ |
| 1324 | xoslib.prototype.Cord_Subscriber_Detail_PATCH = function(parameters) { |
| 1325 | if (parameters === undefined) { |
| 1326 | parameters = {}; |
| 1327 | } |
| 1328 | var deferred = $q.defer(); |
| 1329 | |
| 1330 | var domain = this.domain; |
| 1331 | var path = '/xoslib/cordsubscriber/{pk}/'; |
| 1332 | |
| 1333 | var body; |
| 1334 | var queryParameters = {}; |
| 1335 | var headers = {}; |
| 1336 | var form = {}; |
| 1337 | |
| 1338 | path = path.replace('{pk}', parameters['pk']); |
| 1339 | |
| 1340 | if (parameters['pk'] === undefined) { |
| 1341 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 1342 | return deferred.promise; |
| 1343 | } |
| 1344 | |
| 1345 | if (parameters['firewall_enable'] !== undefined) { |
| 1346 | form['firewall_enable'] = parameters['firewall_enable']; |
| 1347 | } |
| 1348 | |
| 1349 | if (parameters['firewall_rules'] !== undefined) { |
| 1350 | form['firewall_rules'] = parameters['firewall_rules']; |
| 1351 | } |
| 1352 | |
| 1353 | if (parameters['url_filter_enable'] !== undefined) { |
| 1354 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 1355 | } |
| 1356 | |
| 1357 | if (parameters['url_filter_rules'] !== undefined) { |
| 1358 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 1359 | } |
| 1360 | |
| 1361 | if (parameters['url_filter_level'] !== undefined) { |
| 1362 | form['url_filter_level'] = parameters['url_filter_level']; |
| 1363 | } |
| 1364 | |
| 1365 | if (parameters['vcpe_synced'] !== undefined) { |
| 1366 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 1367 | } |
| 1368 | |
| 1369 | if (parameters['cdn_enable'] !== undefined) { |
| 1370 | form['cdn_enable'] = parameters['cdn_enable']; |
| 1371 | } |
| 1372 | |
| 1373 | if (parameters['routeable_subnet'] !== undefined) { |
| 1374 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 1375 | } |
| 1376 | |
| 1377 | if (parameters.$queryParameters) { |
| 1378 | Object.keys(parameters.$queryParameters) |
| 1379 | .forEach(function(parameterName) { |
| 1380 | var parameter = parameters.$queryParameters[parameterName]; |
| 1381 | queryParameters[parameterName] = parameter; |
| 1382 | }); |
| 1383 | } |
| 1384 | |
| 1385 | var url = domain + path; |
| 1386 | var options = { |
| 1387 | timeout: parameters.$timeout, |
| 1388 | method: 'PATCH', |
| 1389 | url: url, |
| 1390 | params: queryParameters, |
| 1391 | data: body, |
| 1392 | headers: headers |
| 1393 | }; |
| 1394 | if (Object.keys(form).length > 0) { |
| 1395 | options.data = form; |
| 1396 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1397 | options.transformRequest = xoslib.transformRequest; |
| 1398 | } |
| 1399 | $http(options) |
| 1400 | .success(function(data, status, headers, config) { |
| 1401 | deferred.resolve(data); |
| 1402 | if (parameters.$cache !== undefined) { |
| 1403 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1404 | } |
| 1405 | }) |
| 1406 | .error(function(data, status, headers, config) { |
| 1407 | deferred.reject({ |
| 1408 | status: status, |
| 1409 | headers: headers, |
| 1410 | config: config, |
| 1411 | body: data |
| 1412 | }); |
| 1413 | }); |
| 1414 | |
| 1415 | return deferred.promise; |
| 1416 | }; |
| 1417 | /** |
| 1418 | * |
| 1419 | * @method |
| 1420 | * @name xoslib#Cord_Subscriber_Detail_DELETE |
| 1421 | * @param {string} pk - |
| 1422 | * |
| 1423 | */ |
| 1424 | xoslib.prototype.Cord_Subscriber_Detail_DELETE = function(parameters) { |
| 1425 | if (parameters === undefined) { |
| 1426 | parameters = {}; |
| 1427 | } |
| 1428 | var deferred = $q.defer(); |
| 1429 | |
| 1430 | var domain = this.domain; |
| 1431 | var path = '/xoslib/cordsubscriber/{pk}/'; |
| 1432 | |
| 1433 | var body; |
| 1434 | var queryParameters = {}; |
| 1435 | var headers = {}; |
| 1436 | var form = {}; |
| 1437 | |
| 1438 | path = path.replace('{pk}', parameters['pk']); |
| 1439 | |
| 1440 | if (parameters['pk'] === undefined) { |
| 1441 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 1442 | return deferred.promise; |
| 1443 | } |
| 1444 | |
| 1445 | if (parameters.$queryParameters) { |
| 1446 | Object.keys(parameters.$queryParameters) |
| 1447 | .forEach(function(parameterName) { |
| 1448 | var parameter = parameters.$queryParameters[parameterName]; |
| 1449 | queryParameters[parameterName] = parameter; |
| 1450 | }); |
| 1451 | } |
| 1452 | |
| 1453 | var url = domain + path; |
| 1454 | var options = { |
| 1455 | timeout: parameters.$timeout, |
| 1456 | method: 'DELETE', |
| 1457 | url: url, |
| 1458 | params: queryParameters, |
| 1459 | data: body, |
| 1460 | headers: headers |
| 1461 | }; |
| 1462 | if (Object.keys(form).length > 0) { |
| 1463 | options.data = form; |
| 1464 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1465 | options.transformRequest = xoslib.transformRequest; |
| 1466 | } |
| 1467 | $http(options) |
| 1468 | .success(function(data, status, headers, config) { |
| 1469 | deferred.resolve(data); |
| 1470 | if (parameters.$cache !== undefined) { |
| 1471 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1472 | } |
| 1473 | }) |
| 1474 | .error(function(data, status, headers, config) { |
| 1475 | deferred.reject({ |
| 1476 | status: status, |
| 1477 | headers: headers, |
| 1478 | config: config, |
| 1479 | body: data |
| 1480 | }); |
| 1481 | }); |
| 1482 | |
| 1483 | return deferred.promise; |
| 1484 | }; |
| 1485 | /** |
| 1486 | * |
| 1487 | * @method |
| 1488 | * @name xoslib#Cord_Subscriber_List_GET |
| 1489 | * |
| 1490 | */ |
| 1491 | xoslib.prototype.Cord_Subscriber_List_GET = function(parameters) { |
| 1492 | if (parameters === undefined) { |
| 1493 | parameters = {}; |
| 1494 | } |
| 1495 | var deferred = $q.defer(); |
| 1496 | |
| 1497 | var domain = this.domain; |
| 1498 | var path = '/xoslib/cordsubscriber/'; |
| 1499 | |
| 1500 | var body; |
| 1501 | var queryParameters = {}; |
| 1502 | var headers = {}; |
| 1503 | var form = {}; |
| 1504 | |
| 1505 | if (parameters.$queryParameters) { |
| 1506 | Object.keys(parameters.$queryParameters) |
| 1507 | .forEach(function(parameterName) { |
| 1508 | var parameter = parameters.$queryParameters[parameterName]; |
| 1509 | queryParameters[parameterName] = parameter; |
| 1510 | }); |
| 1511 | } |
| 1512 | |
| 1513 | var url = domain + path; |
| 1514 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 1515 | if (cached !== undefined && parameters.$refresh !== true) { |
| 1516 | deferred.resolve(cached); |
| 1517 | return deferred.promise; |
| 1518 | } |
| 1519 | var options = { |
| 1520 | timeout: parameters.$timeout, |
| 1521 | method: 'GET', |
| 1522 | url: url, |
| 1523 | params: queryParameters, |
| 1524 | data: body, |
| 1525 | headers: headers |
| 1526 | }; |
| 1527 | if (Object.keys(form).length > 0) { |
| 1528 | options.data = form; |
| 1529 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1530 | options.transformRequest = xoslib.transformRequest; |
| 1531 | } |
| 1532 | $http(options) |
| 1533 | .success(function(data, status, headers, config) { |
| 1534 | deferred.resolve(data); |
| 1535 | if (parameters.$cache !== undefined) { |
| 1536 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1537 | } |
| 1538 | }) |
| 1539 | .error(function(data, status, headers, config) { |
| 1540 | deferred.reject({ |
| 1541 | status: status, |
| 1542 | headers: headers, |
| 1543 | config: config, |
| 1544 | body: data |
| 1545 | }); |
| 1546 | }); |
| 1547 | |
| 1548 | return deferred.promise; |
| 1549 | }; |
| 1550 | /** |
| 1551 | * |
| 1552 | * @method |
| 1553 | * @name xoslib#Cord_Subscriber_List_POST |
| 1554 | * @param {boolean} firewall_enable - |
| 1555 | * @param {string} firewall_rules - |
| 1556 | * @param {boolean} url_filter_enable - |
| 1557 | * @param {string} url_filter_rules - |
| 1558 | * @param {string} url_filter_level - |
| 1559 | * @param {boolean} vcpe_synced - |
| 1560 | * @param {boolean} cdn_enable - |
| 1561 | * @param {string} routeable_subnet - |
| 1562 | * |
| 1563 | */ |
| 1564 | xoslib.prototype.Cord_Subscriber_List_POST = function(parameters) { |
| 1565 | if (parameters === undefined) { |
| 1566 | parameters = {}; |
| 1567 | } |
| 1568 | var deferred = $q.defer(); |
| 1569 | |
| 1570 | var domain = this.domain; |
| 1571 | var path = '/xoslib/cordsubscriber/'; |
| 1572 | |
| 1573 | var body; |
| 1574 | var queryParameters = {}; |
| 1575 | var headers = {}; |
| 1576 | var form = {}; |
| 1577 | |
| 1578 | if (parameters['firewall_enable'] !== undefined) { |
| 1579 | form['firewall_enable'] = parameters['firewall_enable']; |
| 1580 | } |
| 1581 | |
| 1582 | if (parameters['firewall_enable'] === undefined) { |
| 1583 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 1584 | return deferred.promise; |
| 1585 | } |
| 1586 | |
| 1587 | if (parameters['firewall_rules'] !== undefined) { |
| 1588 | form['firewall_rules'] = parameters['firewall_rules']; |
| 1589 | } |
| 1590 | |
| 1591 | if (parameters['firewall_rules'] === undefined) { |
| 1592 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 1593 | return deferred.promise; |
| 1594 | } |
| 1595 | |
| 1596 | if (parameters['url_filter_enable'] !== undefined) { |
| 1597 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 1598 | } |
| 1599 | |
| 1600 | if (parameters['url_filter_enable'] === undefined) { |
| 1601 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 1602 | return deferred.promise; |
| 1603 | } |
| 1604 | |
| 1605 | if (parameters['url_filter_rules'] !== undefined) { |
| 1606 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 1607 | } |
| 1608 | |
| 1609 | if (parameters['url_filter_rules'] === undefined) { |
| 1610 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 1611 | return deferred.promise; |
| 1612 | } |
| 1613 | |
| 1614 | if (parameters['url_filter_level'] !== undefined) { |
| 1615 | form['url_filter_level'] = parameters['url_filter_level']; |
| 1616 | } |
| 1617 | |
| 1618 | if (parameters['vcpe_synced'] !== undefined) { |
| 1619 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 1620 | } |
| 1621 | |
| 1622 | if (parameters['vcpe_synced'] === undefined) { |
| 1623 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 1624 | return deferred.promise; |
| 1625 | } |
| 1626 | |
| 1627 | if (parameters['cdn_enable'] !== undefined) { |
| 1628 | form['cdn_enable'] = parameters['cdn_enable']; |
| 1629 | } |
| 1630 | |
| 1631 | if (parameters['cdn_enable'] === undefined) { |
| 1632 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 1633 | return deferred.promise; |
| 1634 | } |
| 1635 | |
| 1636 | if (parameters['routeable_subnet'] !== undefined) { |
| 1637 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 1638 | } |
| 1639 | |
| 1640 | if (parameters.$queryParameters) { |
| 1641 | Object.keys(parameters.$queryParameters) |
| 1642 | .forEach(function(parameterName) { |
| 1643 | var parameter = parameters.$queryParameters[parameterName]; |
| 1644 | queryParameters[parameterName] = parameter; |
| 1645 | }); |
| 1646 | } |
| 1647 | |
| 1648 | var url = domain + path; |
| 1649 | var options = { |
| 1650 | timeout: parameters.$timeout, |
| 1651 | method: 'POST', |
| 1652 | url: url, |
| 1653 | params: queryParameters, |
| 1654 | data: body, |
| 1655 | headers: headers |
| 1656 | }; |
| 1657 | if (Object.keys(form).length > 0) { |
| 1658 | options.data = form; |
| 1659 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1660 | options.transformRequest = xoslib.transformRequest; |
| 1661 | } |
| 1662 | $http(options) |
| 1663 | .success(function(data, status, headers, config) { |
| 1664 | deferred.resolve(data); |
| 1665 | if (parameters.$cache !== undefined) { |
| 1666 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1667 | } |
| 1668 | }) |
| 1669 | .error(function(data, status, headers, config) { |
| 1670 | deferred.reject({ |
| 1671 | status: status, |
| 1672 | headers: headers, |
| 1673 | config: config, |
| 1674 | body: data |
| 1675 | }); |
| 1676 | }); |
| 1677 | |
| 1678 | return deferred.promise; |
| 1679 | }; |
| 1680 | /** |
| 1681 | * |
| 1682 | * @method |
| 1683 | * @name xoslib#Cord_Subscriber_list |
| 1684 | * |
| 1685 | */ |
| 1686 | xoslib.prototype.Cord_Subscriber_list = function(parameters) { |
| 1687 | if (parameters === undefined) { |
| 1688 | parameters = {}; |
| 1689 | } |
| 1690 | var deferred = $q.defer(); |
| 1691 | |
| 1692 | var domain = this.domain; |
| 1693 | var path = '/xoslib/rs/subscriber/'; |
| 1694 | |
| 1695 | var body; |
| 1696 | var queryParameters = {}; |
| 1697 | var headers = {}; |
| 1698 | var form = {}; |
| 1699 | |
| 1700 | if (parameters.$queryParameters) { |
| 1701 | Object.keys(parameters.$queryParameters) |
| 1702 | .forEach(function(parameterName) { |
| 1703 | var parameter = parameters.$queryParameters[parameterName]; |
| 1704 | queryParameters[parameterName] = parameter; |
| 1705 | }); |
| 1706 | } |
| 1707 | |
| 1708 | var url = domain + path; |
| 1709 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 1710 | if (cached !== undefined && parameters.$refresh !== true) { |
| 1711 | deferred.resolve(cached); |
| 1712 | return deferred.promise; |
| 1713 | } |
| 1714 | var options = { |
| 1715 | timeout: parameters.$timeout, |
| 1716 | method: 'GET', |
| 1717 | url: url, |
| 1718 | params: queryParameters, |
| 1719 | data: body, |
| 1720 | headers: headers |
| 1721 | }; |
| 1722 | if (Object.keys(form).length > 0) { |
| 1723 | options.data = form; |
| 1724 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1725 | options.transformRequest = xoslib.transformRequest; |
| 1726 | } |
| 1727 | $http(options) |
| 1728 | .success(function(data, status, headers, config) { |
| 1729 | deferred.resolve(data); |
| 1730 | if (parameters.$cache !== undefined) { |
| 1731 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1732 | } |
| 1733 | }) |
| 1734 | .error(function(data, status, headers, config) { |
| 1735 | deferred.reject({ |
| 1736 | status: status, |
| 1737 | headers: headers, |
| 1738 | config: config, |
| 1739 | body: data |
| 1740 | }); |
| 1741 | }); |
| 1742 | |
| 1743 | return deferred.promise; |
| 1744 | }; |
| 1745 | /** |
| 1746 | * |
| 1747 | * @method |
| 1748 | * @name xoslib#Cord_Subscriber_update |
| 1749 | * @param {string} pk - |
| 1750 | * @param {boolean} firewall_enable - |
| 1751 | * @param {string} firewall_rules - |
| 1752 | * @param {boolean} url_filter_enable - |
| 1753 | * @param {string} url_filter_rules - |
| 1754 | * @param {string} url_filter_level - |
| 1755 | * @param {boolean} vcpe_synced - |
| 1756 | * @param {boolean} cdn_enable - |
| 1757 | * @param {string} routeable_subnet - |
| 1758 | * |
| 1759 | */ |
| 1760 | xoslib.prototype.Cord_Subscriber_update = function(parameters) { |
| 1761 | if (parameters === undefined) { |
| 1762 | parameters = {}; |
| 1763 | } |
| 1764 | var deferred = $q.defer(); |
| 1765 | |
| 1766 | var domain = this.domain; |
| 1767 | var path = '/xoslib/rs/subscriber/{pk}/'; |
| 1768 | |
| 1769 | var body; |
| 1770 | var queryParameters = {}; |
| 1771 | var headers = {}; |
| 1772 | var form = {}; |
| 1773 | |
| 1774 | path = path.replace('{pk}', parameters['pk']); |
| 1775 | |
| 1776 | if (parameters['pk'] === undefined) { |
| 1777 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 1778 | return deferred.promise; |
| 1779 | } |
| 1780 | |
| 1781 | if (parameters['firewall_enable'] !== undefined) { |
| 1782 | form['firewall_enable'] = parameters['firewall_enable']; |
| 1783 | } |
| 1784 | |
| 1785 | if (parameters['firewall_enable'] === undefined) { |
| 1786 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 1787 | return deferred.promise; |
| 1788 | } |
| 1789 | |
| 1790 | if (parameters['firewall_rules'] !== undefined) { |
| 1791 | form['firewall_rules'] = parameters['firewall_rules']; |
| 1792 | } |
| 1793 | |
| 1794 | if (parameters['firewall_rules'] === undefined) { |
| 1795 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 1796 | return deferred.promise; |
| 1797 | } |
| 1798 | |
| 1799 | if (parameters['url_filter_enable'] !== undefined) { |
| 1800 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 1801 | } |
| 1802 | |
| 1803 | if (parameters['url_filter_enable'] === undefined) { |
| 1804 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 1805 | return deferred.promise; |
| 1806 | } |
| 1807 | |
| 1808 | if (parameters['url_filter_rules'] !== undefined) { |
| 1809 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 1810 | } |
| 1811 | |
| 1812 | if (parameters['url_filter_rules'] === undefined) { |
| 1813 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 1814 | return deferred.promise; |
| 1815 | } |
| 1816 | |
| 1817 | if (parameters['url_filter_level'] !== undefined) { |
| 1818 | form['url_filter_level'] = parameters['url_filter_level']; |
| 1819 | } |
| 1820 | |
| 1821 | if (parameters['vcpe_synced'] !== undefined) { |
| 1822 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 1823 | } |
| 1824 | |
| 1825 | if (parameters['vcpe_synced'] === undefined) { |
| 1826 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 1827 | return deferred.promise; |
| 1828 | } |
| 1829 | |
| 1830 | if (parameters['cdn_enable'] !== undefined) { |
| 1831 | form['cdn_enable'] = parameters['cdn_enable']; |
| 1832 | } |
| 1833 | |
| 1834 | if (parameters['cdn_enable'] === undefined) { |
| 1835 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 1836 | return deferred.promise; |
| 1837 | } |
| 1838 | |
| 1839 | if (parameters['routeable_subnet'] !== undefined) { |
| 1840 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 1841 | } |
| 1842 | |
| 1843 | if (parameters.$queryParameters) { |
| 1844 | Object.keys(parameters.$queryParameters) |
| 1845 | .forEach(function(parameterName) { |
| 1846 | var parameter = parameters.$queryParameters[parameterName]; |
| 1847 | queryParameters[parameterName] = parameter; |
| 1848 | }); |
| 1849 | } |
| 1850 | |
| 1851 | var url = domain + path; |
| 1852 | var options = { |
| 1853 | timeout: parameters.$timeout, |
| 1854 | method: 'PUT', |
| 1855 | url: url, |
| 1856 | params: queryParameters, |
| 1857 | data: body, |
| 1858 | headers: headers |
| 1859 | }; |
| 1860 | if (Object.keys(form).length > 0) { |
| 1861 | options.data = form; |
| 1862 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1863 | options.transformRequest = xoslib.transformRequest; |
| 1864 | } |
| 1865 | $http(options) |
| 1866 | .success(function(data, status, headers, config) { |
| 1867 | deferred.resolve(data); |
| 1868 | if (parameters.$cache !== undefined) { |
| 1869 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1870 | } |
| 1871 | }) |
| 1872 | .error(function(data, status, headers, config) { |
| 1873 | deferred.reject({ |
| 1874 | status: status, |
| 1875 | headers: headers, |
| 1876 | config: config, |
| 1877 | body: data |
| 1878 | }); |
| 1879 | }); |
| 1880 | |
| 1881 | return deferred.promise; |
| 1882 | }; |
| 1883 | /** |
| 1884 | * |
| 1885 | * @method |
| 1886 | * @name xoslib#Cord_Subscriber_partial_update |
| 1887 | * @param {string} pk - |
| 1888 | * @param {boolean} firewall_enable - |
| 1889 | * @param {string} firewall_rules - |
| 1890 | * @param {boolean} url_filter_enable - |
| 1891 | * @param {string} url_filter_rules - |
| 1892 | * @param {string} url_filter_level - |
| 1893 | * @param {boolean} vcpe_synced - |
| 1894 | * @param {boolean} cdn_enable - |
| 1895 | * @param {string} routeable_subnet - |
| 1896 | * |
| 1897 | */ |
| 1898 | xoslib.prototype.Cord_Subscriber_partial_update = function(parameters) { |
| 1899 | if (parameters === undefined) { |
| 1900 | parameters = {}; |
| 1901 | } |
| 1902 | var deferred = $q.defer(); |
| 1903 | |
| 1904 | var domain = this.domain; |
| 1905 | var path = '/xoslib/rs/subscriber/{pk}/'; |
| 1906 | |
| 1907 | var body; |
| 1908 | var queryParameters = {}; |
| 1909 | var headers = {}; |
| 1910 | var form = {}; |
| 1911 | |
| 1912 | path = path.replace('{pk}', parameters['pk']); |
| 1913 | |
| 1914 | if (parameters['pk'] === undefined) { |
| 1915 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 1916 | return deferred.promise; |
| 1917 | } |
| 1918 | |
| 1919 | if (parameters['firewall_enable'] !== undefined) { |
| 1920 | form['firewall_enable'] = parameters['firewall_enable']; |
| 1921 | } |
| 1922 | |
| 1923 | if (parameters['firewall_rules'] !== undefined) { |
| 1924 | form['firewall_rules'] = parameters['firewall_rules']; |
| 1925 | } |
| 1926 | |
| 1927 | if (parameters['url_filter_enable'] !== undefined) { |
| 1928 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 1929 | } |
| 1930 | |
| 1931 | if (parameters['url_filter_rules'] !== undefined) { |
| 1932 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 1933 | } |
| 1934 | |
| 1935 | if (parameters['url_filter_level'] !== undefined) { |
| 1936 | form['url_filter_level'] = parameters['url_filter_level']; |
| 1937 | } |
| 1938 | |
| 1939 | if (parameters['vcpe_synced'] !== undefined) { |
| 1940 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 1941 | } |
| 1942 | |
| 1943 | if (parameters['cdn_enable'] !== undefined) { |
| 1944 | form['cdn_enable'] = parameters['cdn_enable']; |
| 1945 | } |
| 1946 | |
| 1947 | if (parameters['routeable_subnet'] !== undefined) { |
| 1948 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 1949 | } |
| 1950 | |
| 1951 | if (parameters.$queryParameters) { |
| 1952 | Object.keys(parameters.$queryParameters) |
| 1953 | .forEach(function(parameterName) { |
| 1954 | var parameter = parameters.$queryParameters[parameterName]; |
| 1955 | queryParameters[parameterName] = parameter; |
| 1956 | }); |
| 1957 | } |
| 1958 | |
| 1959 | var url = domain + path; |
| 1960 | var options = { |
| 1961 | timeout: parameters.$timeout, |
| 1962 | method: 'PATCH', |
| 1963 | url: url, |
| 1964 | params: queryParameters, |
| 1965 | data: body, |
| 1966 | headers: headers |
| 1967 | }; |
| 1968 | if (Object.keys(form).length > 0) { |
| 1969 | options.data = form; |
| 1970 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 1971 | options.transformRequest = xoslib.transformRequest; |
| 1972 | } |
| 1973 | $http(options) |
| 1974 | .success(function(data, status, headers, config) { |
| 1975 | deferred.resolve(data); |
| 1976 | if (parameters.$cache !== undefined) { |
| 1977 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 1978 | } |
| 1979 | }) |
| 1980 | .error(function(data, status, headers, config) { |
| 1981 | deferred.reject({ |
| 1982 | status: status, |
| 1983 | headers: headers, |
| 1984 | config: config, |
| 1985 | body: data |
| 1986 | }); |
| 1987 | }); |
| 1988 | |
| 1989 | return deferred.promise; |
| 1990 | }; |
| 1991 | /** |
| 1992 | * |
| 1993 | * @method |
| 1994 | * @name xoslib#Cord_Subscriber_update |
| 1995 | * @param {string} pk - |
| 1996 | * @param {boolean} firewall_enable - |
| 1997 | * @param {string} firewall_rules - |
| 1998 | * @param {boolean} url_filter_enable - |
| 1999 | * @param {string} url_filter_rules - |
| 2000 | * @param {string} url_filter_level - |
| 2001 | * @param {boolean} vcpe_synced - |
| 2002 | * @param {boolean} cdn_enable - |
| 2003 | * @param {string} routeable_subnet - |
| 2004 | * |
| 2005 | */ |
| 2006 | xoslib.prototype.Cord_Subscriber_update = function(parameters) { |
| 2007 | if (parameters === undefined) { |
| 2008 | parameters = {}; |
| 2009 | } |
| 2010 | var deferred = $q.defer(); |
| 2011 | |
| 2012 | var domain = this.domain; |
| 2013 | var path = '/xoslib/rs/subscriber/{pk}/'; |
| 2014 | |
| 2015 | var body; |
| 2016 | var queryParameters = {}; |
| 2017 | var headers = {}; |
| 2018 | var form = {}; |
| 2019 | |
| 2020 | path = path.replace('{pk}', parameters['pk']); |
| 2021 | |
| 2022 | if (parameters['pk'] === undefined) { |
| 2023 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2024 | return deferred.promise; |
| 2025 | } |
| 2026 | |
| 2027 | if (parameters['firewall_enable'] !== undefined) { |
| 2028 | form['firewall_enable'] = parameters['firewall_enable']; |
| 2029 | } |
| 2030 | |
| 2031 | if (parameters['firewall_enable'] === undefined) { |
| 2032 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 2033 | return deferred.promise; |
| 2034 | } |
| 2035 | |
| 2036 | if (parameters['firewall_rules'] !== undefined) { |
| 2037 | form['firewall_rules'] = parameters['firewall_rules']; |
| 2038 | } |
| 2039 | |
| 2040 | if (parameters['firewall_rules'] === undefined) { |
| 2041 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 2042 | return deferred.promise; |
| 2043 | } |
| 2044 | |
| 2045 | if (parameters['url_filter_enable'] !== undefined) { |
| 2046 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 2047 | } |
| 2048 | |
| 2049 | if (parameters['url_filter_enable'] === undefined) { |
| 2050 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 2051 | return deferred.promise; |
| 2052 | } |
| 2053 | |
| 2054 | if (parameters['url_filter_rules'] !== undefined) { |
| 2055 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 2056 | } |
| 2057 | |
| 2058 | if (parameters['url_filter_rules'] === undefined) { |
| 2059 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 2060 | return deferred.promise; |
| 2061 | } |
| 2062 | |
| 2063 | if (parameters['url_filter_level'] !== undefined) { |
| 2064 | form['url_filter_level'] = parameters['url_filter_level']; |
| 2065 | } |
| 2066 | |
| 2067 | if (parameters['vcpe_synced'] !== undefined) { |
| 2068 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 2069 | } |
| 2070 | |
| 2071 | if (parameters['vcpe_synced'] === undefined) { |
| 2072 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 2073 | return deferred.promise; |
| 2074 | } |
| 2075 | |
| 2076 | if (parameters['cdn_enable'] !== undefined) { |
| 2077 | form['cdn_enable'] = parameters['cdn_enable']; |
| 2078 | } |
| 2079 | |
| 2080 | if (parameters['cdn_enable'] === undefined) { |
| 2081 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 2082 | return deferred.promise; |
| 2083 | } |
| 2084 | |
| 2085 | if (parameters['routeable_subnet'] !== undefined) { |
| 2086 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 2087 | } |
| 2088 | |
| 2089 | if (parameters.$queryParameters) { |
| 2090 | Object.keys(parameters.$queryParameters) |
| 2091 | .forEach(function(parameterName) { |
| 2092 | var parameter = parameters.$queryParameters[parameterName]; |
| 2093 | queryParameters[parameterName] = parameter; |
| 2094 | }); |
| 2095 | } |
| 2096 | |
| 2097 | var url = domain + path; |
| 2098 | var options = { |
| 2099 | timeout: parameters.$timeout, |
| 2100 | method: 'POST', |
| 2101 | url: url, |
| 2102 | params: queryParameters, |
| 2103 | data: body, |
| 2104 | headers: headers |
| 2105 | }; |
| 2106 | if (Object.keys(form).length > 0) { |
| 2107 | options.data = form; |
| 2108 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2109 | options.transformRequest = xoslib.transformRequest; |
| 2110 | } |
| 2111 | $http(options) |
| 2112 | .success(function(data, status, headers, config) { |
| 2113 | deferred.resolve(data); |
| 2114 | if (parameters.$cache !== undefined) { |
| 2115 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2116 | } |
| 2117 | }) |
| 2118 | .error(function(data, status, headers, config) { |
| 2119 | deferred.reject({ |
| 2120 | status: status, |
| 2121 | headers: headers, |
| 2122 | config: config, |
| 2123 | body: data |
| 2124 | }); |
| 2125 | }); |
| 2126 | |
| 2127 | return deferred.promise; |
| 2128 | }; |
| 2129 | /** |
| 2130 | * |
| 2131 | * @method |
| 2132 | * @name xoslib#Cord_Subscriber_destroy |
| 2133 | * @param {string} pk - |
| 2134 | * |
| 2135 | */ |
| 2136 | xoslib.prototype.Cord_Subscriber_destroy = function(parameters) { |
| 2137 | if (parameters === undefined) { |
| 2138 | parameters = {}; |
| 2139 | } |
| 2140 | var deferred = $q.defer(); |
| 2141 | |
| 2142 | var domain = this.domain; |
| 2143 | var path = '/xoslib/rs/subscriber/{pk}/'; |
| 2144 | |
| 2145 | var body; |
| 2146 | var queryParameters = {}; |
| 2147 | var headers = {}; |
| 2148 | var form = {}; |
| 2149 | |
| 2150 | path = path.replace('{pk}', parameters['pk']); |
| 2151 | |
| 2152 | if (parameters['pk'] === undefined) { |
| 2153 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2154 | return deferred.promise; |
| 2155 | } |
| 2156 | |
| 2157 | if (parameters.$queryParameters) { |
| 2158 | Object.keys(parameters.$queryParameters) |
| 2159 | .forEach(function(parameterName) { |
| 2160 | var parameter = parameters.$queryParameters[parameterName]; |
| 2161 | queryParameters[parameterName] = parameter; |
| 2162 | }); |
| 2163 | } |
| 2164 | |
| 2165 | var url = domain + path; |
| 2166 | var options = { |
| 2167 | timeout: parameters.$timeout, |
| 2168 | method: 'DELETE', |
| 2169 | url: url, |
| 2170 | params: queryParameters, |
| 2171 | data: body, |
| 2172 | headers: headers |
| 2173 | }; |
| 2174 | if (Object.keys(form).length > 0) { |
| 2175 | options.data = form; |
| 2176 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2177 | options.transformRequest = xoslib.transformRequest; |
| 2178 | } |
| 2179 | $http(options) |
| 2180 | .success(function(data, status, headers, config) { |
| 2181 | deferred.resolve(data); |
| 2182 | if (parameters.$cache !== undefined) { |
| 2183 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2184 | } |
| 2185 | }) |
| 2186 | .error(function(data, status, headers, config) { |
| 2187 | deferred.reject({ |
| 2188 | status: status, |
| 2189 | headers: headers, |
| 2190 | config: config, |
| 2191 | body: data |
| 2192 | }); |
| 2193 | }); |
| 2194 | |
| 2195 | return deferred.promise; |
| 2196 | }; |
| 2197 | /** |
| 2198 | * |
| 2199 | * @method |
| 2200 | * @name xoslib#Cord_Subscriber_retrieve |
| 2201 | * @param {string} pk - |
| 2202 | * |
| 2203 | */ |
| 2204 | xoslib.prototype.Cord_Subscriber_retrieve = function(parameters) { |
| 2205 | if (parameters === undefined) { |
| 2206 | parameters = {}; |
| 2207 | } |
| 2208 | var deferred = $q.defer(); |
| 2209 | |
| 2210 | var domain = this.domain; |
| 2211 | var path = '/xoslib/rs/subscriber/{pk}/'; |
| 2212 | |
| 2213 | var body; |
| 2214 | var queryParameters = {}; |
| 2215 | var headers = {}; |
| 2216 | var form = {}; |
| 2217 | |
| 2218 | path = path.replace('{pk}', parameters['pk']); |
| 2219 | |
| 2220 | if (parameters['pk'] === undefined) { |
| 2221 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2222 | return deferred.promise; |
| 2223 | } |
| 2224 | |
| 2225 | if (parameters.$queryParameters) { |
| 2226 | Object.keys(parameters.$queryParameters) |
| 2227 | .forEach(function(parameterName) { |
| 2228 | var parameter = parameters.$queryParameters[parameterName]; |
| 2229 | queryParameters[parameterName] = parameter; |
| 2230 | }); |
| 2231 | } |
| 2232 | |
| 2233 | var url = domain + path; |
| 2234 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 2235 | if (cached !== undefined && parameters.$refresh !== true) { |
| 2236 | deferred.resolve(cached); |
| 2237 | return deferred.promise; |
| 2238 | } |
| 2239 | var options = { |
| 2240 | timeout: parameters.$timeout, |
| 2241 | method: 'GET', |
| 2242 | url: url, |
| 2243 | params: queryParameters, |
| 2244 | data: body, |
| 2245 | headers: headers |
| 2246 | }; |
| 2247 | if (Object.keys(form).length > 0) { |
| 2248 | options.data = form; |
| 2249 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2250 | options.transformRequest = xoslib.transformRequest; |
| 2251 | } |
| 2252 | $http(options) |
| 2253 | .success(function(data, status, headers, config) { |
| 2254 | deferred.resolve(data); |
| 2255 | if (parameters.$cache !== undefined) { |
| 2256 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2257 | } |
| 2258 | }) |
| 2259 | .error(function(data, status, headers, config) { |
| 2260 | deferred.reject({ |
| 2261 | status: status, |
| 2262 | headers: headers, |
| 2263 | config: config, |
| 2264 | body: data |
| 2265 | }); |
| 2266 | }); |
| 2267 | |
| 2268 | return deferred.promise; |
| 2269 | }; |
| 2270 | /** |
| 2271 | * |
| 2272 | * @method |
| 2273 | * @name xoslib#Cord_Subscriber_get_vcpe_synced |
| 2274 | * @param {string} pk - |
| 2275 | * |
| 2276 | */ |
| 2277 | xoslib.prototype.Cord_Subscriber_get_vcpe_synced = function(parameters) { |
| 2278 | if (parameters === undefined) { |
| 2279 | parameters = {}; |
| 2280 | } |
| 2281 | var deferred = $q.defer(); |
| 2282 | |
| 2283 | var domain = this.domain; |
| 2284 | var path = '/xoslib/rs/subscriber/{pk}/vcpe_synced/'; |
| 2285 | |
| 2286 | var body; |
| 2287 | var queryParameters = {}; |
| 2288 | var headers = {}; |
| 2289 | var form = {}; |
| 2290 | |
| 2291 | path = path.replace('{pk}', parameters['pk']); |
| 2292 | |
| 2293 | if (parameters['pk'] === undefined) { |
| 2294 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2295 | return deferred.promise; |
| 2296 | } |
| 2297 | |
| 2298 | if (parameters.$queryParameters) { |
| 2299 | Object.keys(parameters.$queryParameters) |
| 2300 | .forEach(function(parameterName) { |
| 2301 | var parameter = parameters.$queryParameters[parameterName]; |
| 2302 | queryParameters[parameterName] = parameter; |
| 2303 | }); |
| 2304 | } |
| 2305 | |
| 2306 | var url = domain + path; |
| 2307 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 2308 | if (cached !== undefined && parameters.$refresh !== true) { |
| 2309 | deferred.resolve(cached); |
| 2310 | return deferred.promise; |
| 2311 | } |
| 2312 | var options = { |
| 2313 | timeout: parameters.$timeout, |
| 2314 | method: 'GET', |
| 2315 | url: url, |
| 2316 | params: queryParameters, |
| 2317 | data: body, |
| 2318 | headers: headers |
| 2319 | }; |
| 2320 | if (Object.keys(form).length > 0) { |
| 2321 | options.data = form; |
| 2322 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2323 | options.transformRequest = xoslib.transformRequest; |
| 2324 | } |
| 2325 | $http(options) |
| 2326 | .success(function(data, status, headers, config) { |
| 2327 | deferred.resolve(data); |
| 2328 | if (parameters.$cache !== undefined) { |
| 2329 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2330 | } |
| 2331 | }) |
| 2332 | .error(function(data, status, headers, config) { |
| 2333 | deferred.reject({ |
| 2334 | status: status, |
| 2335 | headers: headers, |
| 2336 | config: config, |
| 2337 | body: data |
| 2338 | }); |
| 2339 | }); |
| 2340 | |
| 2341 | return deferred.promise; |
| 2342 | }; |
| 2343 | /** |
| 2344 | * |
| 2345 | * @method |
| 2346 | * @name xoslib#Cord_Subscriber_get_url_filter |
| 2347 | * @param {string} pk - |
| 2348 | * |
| 2349 | */ |
| 2350 | xoslib.prototype.Cord_Subscriber_get_url_filter = function(parameters) { |
| 2351 | if (parameters === undefined) { |
| 2352 | parameters = {}; |
| 2353 | } |
| 2354 | var deferred = $q.defer(); |
| 2355 | |
| 2356 | var domain = this.domain; |
| 2357 | var path = '/xoslib/rs/subscriber/{pk}/url_filter/'; |
| 2358 | |
| 2359 | var body; |
| 2360 | var queryParameters = {}; |
| 2361 | var headers = {}; |
| 2362 | var form = {}; |
| 2363 | |
| 2364 | path = path.replace('{pk}', parameters['pk']); |
| 2365 | |
| 2366 | if (parameters['pk'] === undefined) { |
| 2367 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2368 | return deferred.promise; |
| 2369 | } |
| 2370 | |
| 2371 | if (parameters.$queryParameters) { |
| 2372 | Object.keys(parameters.$queryParameters) |
| 2373 | .forEach(function(parameterName) { |
| 2374 | var parameter = parameters.$queryParameters[parameterName]; |
| 2375 | queryParameters[parameterName] = parameter; |
| 2376 | }); |
| 2377 | } |
| 2378 | |
| 2379 | var url = domain + path; |
| 2380 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 2381 | if (cached !== undefined && parameters.$refresh !== true) { |
| 2382 | deferred.resolve(cached); |
| 2383 | return deferred.promise; |
| 2384 | } |
| 2385 | var options = { |
| 2386 | timeout: parameters.$timeout, |
| 2387 | method: 'GET', |
| 2388 | url: url, |
| 2389 | params: queryParameters, |
| 2390 | data: body, |
| 2391 | headers: headers |
| 2392 | }; |
| 2393 | if (Object.keys(form).length > 0) { |
| 2394 | options.data = form; |
| 2395 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2396 | options.transformRequest = xoslib.transformRequest; |
| 2397 | } |
| 2398 | $http(options) |
| 2399 | .success(function(data, status, headers, config) { |
| 2400 | deferred.resolve(data); |
| 2401 | if (parameters.$cache !== undefined) { |
| 2402 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2403 | } |
| 2404 | }) |
| 2405 | .error(function(data, status, headers, config) { |
| 2406 | deferred.reject({ |
| 2407 | status: status, |
| 2408 | headers: headers, |
| 2409 | config: config, |
| 2410 | body: data |
| 2411 | }); |
| 2412 | }); |
| 2413 | |
| 2414 | return deferred.promise; |
| 2415 | }; |
| 2416 | /** |
| 2417 | * |
| 2418 | * @method |
| 2419 | * @name xoslib#Cord_Subscriber_set_url_filter |
| 2420 | * @param {string} pk - |
| 2421 | * @param {string} level - |
| 2422 | * @param {boolean} firewall_enable - |
| 2423 | * @param {string} firewall_rules - |
| 2424 | * @param {boolean} url_filter_enable - |
| 2425 | * @param {string} url_filter_rules - |
| 2426 | * @param {string} url_filter_level - |
| 2427 | * @param {boolean} vcpe_synced - |
| 2428 | * @param {boolean} cdn_enable - |
| 2429 | * @param {string} routeable_subnet - |
| 2430 | * |
| 2431 | */ |
| 2432 | xoslib.prototype.Cord_Subscriber_set_url_filter = function(parameters) { |
| 2433 | if (parameters === undefined) { |
| 2434 | parameters = {}; |
| 2435 | } |
| 2436 | var deferred = $q.defer(); |
| 2437 | |
| 2438 | var domain = this.domain; |
| 2439 | var path = '/xoslib/rs/subscriber/{pk}/url_filter/{level}/'; |
| 2440 | |
| 2441 | var body; |
| 2442 | var queryParameters = {}; |
| 2443 | var headers = {}; |
| 2444 | var form = {}; |
| 2445 | |
| 2446 | path = path.replace('{pk}', parameters['pk']); |
| 2447 | |
| 2448 | if (parameters['pk'] === undefined) { |
| 2449 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2450 | return deferred.promise; |
| 2451 | } |
| 2452 | |
| 2453 | path = path.replace('{level}', parameters['level']); |
| 2454 | |
| 2455 | if (parameters['level'] === undefined) { |
| 2456 | deferred.reject(new Error('Missing required path parameter: level')); |
| 2457 | return deferred.promise; |
| 2458 | } |
| 2459 | |
| 2460 | if (parameters['firewall_enable'] !== undefined) { |
| 2461 | form['firewall_enable'] = parameters['firewall_enable']; |
| 2462 | } |
| 2463 | |
| 2464 | if (parameters['firewall_enable'] === undefined) { |
| 2465 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 2466 | return deferred.promise; |
| 2467 | } |
| 2468 | |
| 2469 | if (parameters['firewall_rules'] !== undefined) { |
| 2470 | form['firewall_rules'] = parameters['firewall_rules']; |
| 2471 | } |
| 2472 | |
| 2473 | if (parameters['firewall_rules'] === undefined) { |
| 2474 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 2475 | return deferred.promise; |
| 2476 | } |
| 2477 | |
| 2478 | if (parameters['url_filter_enable'] !== undefined) { |
| 2479 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 2480 | } |
| 2481 | |
| 2482 | if (parameters['url_filter_enable'] === undefined) { |
| 2483 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 2484 | return deferred.promise; |
| 2485 | } |
| 2486 | |
| 2487 | if (parameters['url_filter_rules'] !== undefined) { |
| 2488 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 2489 | } |
| 2490 | |
| 2491 | if (parameters['url_filter_rules'] === undefined) { |
| 2492 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 2493 | return deferred.promise; |
| 2494 | } |
| 2495 | |
| 2496 | if (parameters['url_filter_level'] !== undefined) { |
| 2497 | form['url_filter_level'] = parameters['url_filter_level']; |
| 2498 | } |
| 2499 | |
| 2500 | if (parameters['vcpe_synced'] !== undefined) { |
| 2501 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 2502 | } |
| 2503 | |
| 2504 | if (parameters['vcpe_synced'] === undefined) { |
| 2505 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 2506 | return deferred.promise; |
| 2507 | } |
| 2508 | |
| 2509 | if (parameters['cdn_enable'] !== undefined) { |
| 2510 | form['cdn_enable'] = parameters['cdn_enable']; |
| 2511 | } |
| 2512 | |
| 2513 | if (parameters['cdn_enable'] === undefined) { |
| 2514 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 2515 | return deferred.promise; |
| 2516 | } |
| 2517 | |
| 2518 | if (parameters['routeable_subnet'] !== undefined) { |
| 2519 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 2520 | } |
| 2521 | |
| 2522 | if (parameters.$queryParameters) { |
| 2523 | Object.keys(parameters.$queryParameters) |
| 2524 | .forEach(function(parameterName) { |
| 2525 | var parameter = parameters.$queryParameters[parameterName]; |
| 2526 | queryParameters[parameterName] = parameter; |
| 2527 | }); |
| 2528 | } |
| 2529 | |
| 2530 | var url = domain + path; |
| 2531 | var options = { |
| 2532 | timeout: parameters.$timeout, |
| 2533 | method: 'PUT', |
| 2534 | url: url, |
| 2535 | params: queryParameters, |
| 2536 | data: body, |
| 2537 | headers: headers |
| 2538 | }; |
| 2539 | if (Object.keys(form).length > 0) { |
| 2540 | options.data = form; |
| 2541 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2542 | options.transformRequest = xoslib.transformRequest; |
| 2543 | } |
| 2544 | $http(options) |
| 2545 | .success(function(data, status, headers, config) { |
| 2546 | deferred.resolve(data); |
| 2547 | if (parameters.$cache !== undefined) { |
| 2548 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2549 | } |
| 2550 | }) |
| 2551 | .error(function(data, status, headers, config) { |
| 2552 | deferred.reject({ |
| 2553 | status: status, |
| 2554 | headers: headers, |
| 2555 | config: config, |
| 2556 | body: data |
| 2557 | }); |
| 2558 | }); |
| 2559 | |
| 2560 | return deferred.promise; |
| 2561 | }; |
| 2562 | /** |
| 2563 | * |
| 2564 | * @method |
| 2565 | * @name xoslib#Cord_Subscriber_get_services |
| 2566 | * @param {string} pk - |
| 2567 | * |
| 2568 | */ |
| 2569 | xoslib.prototype.Cord_Subscriber_get_services = function(parameters) { |
| 2570 | if (parameters === undefined) { |
| 2571 | parameters = {}; |
| 2572 | } |
| 2573 | var deferred = $q.defer(); |
| 2574 | |
| 2575 | var domain = this.domain; |
| 2576 | var path = '/xoslib/rs/subscriber/{pk}/services/'; |
| 2577 | |
| 2578 | var body; |
| 2579 | var queryParameters = {}; |
| 2580 | var headers = {}; |
| 2581 | var form = {}; |
| 2582 | |
| 2583 | path = path.replace('{pk}', parameters['pk']); |
| 2584 | |
| 2585 | if (parameters['pk'] === undefined) { |
| 2586 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2587 | return deferred.promise; |
| 2588 | } |
| 2589 | |
| 2590 | if (parameters.$queryParameters) { |
| 2591 | Object.keys(parameters.$queryParameters) |
| 2592 | .forEach(function(parameterName) { |
| 2593 | var parameter = parameters.$queryParameters[parameterName]; |
| 2594 | queryParameters[parameterName] = parameter; |
| 2595 | }); |
| 2596 | } |
| 2597 | |
| 2598 | var url = domain + path; |
| 2599 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 2600 | if (cached !== undefined && parameters.$refresh !== true) { |
| 2601 | deferred.resolve(cached); |
| 2602 | return deferred.promise; |
| 2603 | } |
| 2604 | var options = { |
| 2605 | timeout: parameters.$timeout, |
| 2606 | method: 'GET', |
| 2607 | url: url, |
| 2608 | params: queryParameters, |
| 2609 | data: body, |
| 2610 | headers: headers |
| 2611 | }; |
| 2612 | if (Object.keys(form).length > 0) { |
| 2613 | options.data = form; |
| 2614 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2615 | options.transformRequest = xoslib.transformRequest; |
| 2616 | } |
| 2617 | $http(options) |
| 2618 | .success(function(data, status, headers, config) { |
| 2619 | deferred.resolve(data); |
| 2620 | if (parameters.$cache !== undefined) { |
| 2621 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2622 | } |
| 2623 | }) |
| 2624 | .error(function(data, status, headers, config) { |
| 2625 | deferred.reject({ |
| 2626 | status: status, |
| 2627 | headers: headers, |
| 2628 | config: config, |
| 2629 | body: data |
| 2630 | }); |
| 2631 | }); |
| 2632 | |
| 2633 | return deferred.promise; |
| 2634 | }; |
| 2635 | /** |
| 2636 | * |
| 2637 | * @method |
| 2638 | * @name xoslib#Cord_Subscriber_get_service |
| 2639 | * @param {string} pk - |
| 2640 | * @param {string} service - |
| 2641 | * |
| 2642 | */ |
| 2643 | xoslib.prototype.Cord_Subscriber_get_service = function(parameters) { |
| 2644 | if (parameters === undefined) { |
| 2645 | parameters = {}; |
| 2646 | } |
| 2647 | var deferred = $q.defer(); |
| 2648 | |
| 2649 | var domain = this.domain; |
| 2650 | var path = '/xoslib/rs/subscriber/{pk}/services/{service}/'; |
| 2651 | |
| 2652 | var body; |
| 2653 | var queryParameters = {}; |
| 2654 | var headers = {}; |
| 2655 | var form = {}; |
| 2656 | |
| 2657 | path = path.replace('{pk}', parameters['pk']); |
| 2658 | |
| 2659 | if (parameters['pk'] === undefined) { |
| 2660 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2661 | return deferred.promise; |
| 2662 | } |
| 2663 | |
| 2664 | path = path.replace('{service}', parameters['service']); |
| 2665 | |
| 2666 | if (parameters['service'] === undefined) { |
| 2667 | deferred.reject(new Error('Missing required path parameter: service')); |
| 2668 | return deferred.promise; |
| 2669 | } |
| 2670 | |
| 2671 | if (parameters.$queryParameters) { |
| 2672 | Object.keys(parameters.$queryParameters) |
| 2673 | .forEach(function(parameterName) { |
| 2674 | var parameter = parameters.$queryParameters[parameterName]; |
| 2675 | queryParameters[parameterName] = parameter; |
| 2676 | }); |
| 2677 | } |
| 2678 | |
| 2679 | var url = domain + path; |
| 2680 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 2681 | if (cached !== undefined && parameters.$refresh !== true) { |
| 2682 | deferred.resolve(cached); |
| 2683 | return deferred.promise; |
| 2684 | } |
| 2685 | var options = { |
| 2686 | timeout: parameters.$timeout, |
| 2687 | method: 'GET', |
| 2688 | url: url, |
| 2689 | params: queryParameters, |
| 2690 | data: body, |
| 2691 | headers: headers |
| 2692 | }; |
| 2693 | if (Object.keys(form).length > 0) { |
| 2694 | options.data = form; |
| 2695 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2696 | options.transformRequest = xoslib.transformRequest; |
| 2697 | } |
| 2698 | $http(options) |
| 2699 | .success(function(data, status, headers, config) { |
| 2700 | deferred.resolve(data); |
| 2701 | if (parameters.$cache !== undefined) { |
| 2702 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2703 | } |
| 2704 | }) |
| 2705 | .error(function(data, status, headers, config) { |
| 2706 | deferred.reject({ |
| 2707 | status: status, |
| 2708 | headers: headers, |
| 2709 | config: config, |
| 2710 | body: data |
| 2711 | }); |
| 2712 | }); |
| 2713 | |
| 2714 | return deferred.promise; |
| 2715 | }; |
| 2716 | /** |
| 2717 | * |
| 2718 | * @method |
| 2719 | * @name xoslib#Cord_Subscriber_enable_service |
| 2720 | * @param {string} pk - |
| 2721 | * @param {string} service - |
| 2722 | * @param {boolean} firewall_enable - |
| 2723 | * @param {string} firewall_rules - |
| 2724 | * @param {boolean} url_filter_enable - |
| 2725 | * @param {string} url_filter_rules - |
| 2726 | * @param {string} url_filter_level - |
| 2727 | * @param {boolean} vcpe_synced - |
| 2728 | * @param {boolean} cdn_enable - |
| 2729 | * @param {string} routeable_subnet - |
| 2730 | * |
| 2731 | */ |
| 2732 | xoslib.prototype.Cord_Subscriber_enable_service = function(parameters) { |
| 2733 | if (parameters === undefined) { |
| 2734 | parameters = {}; |
| 2735 | } |
| 2736 | var deferred = $q.defer(); |
| 2737 | |
| 2738 | var domain = this.domain; |
| 2739 | var path = '/xoslib/rs/subscriber/{pk}/services/{service}/true/'; |
| 2740 | |
| 2741 | var body; |
| 2742 | var queryParameters = {}; |
| 2743 | var headers = {}; |
| 2744 | var form = {}; |
| 2745 | |
| 2746 | path = path.replace('{pk}', parameters['pk']); |
| 2747 | |
| 2748 | if (parameters['pk'] === undefined) { |
| 2749 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2750 | return deferred.promise; |
| 2751 | } |
| 2752 | |
| 2753 | path = path.replace('{service}', parameters['service']); |
| 2754 | |
| 2755 | if (parameters['service'] === undefined) { |
| 2756 | deferred.reject(new Error('Missing required path parameter: service')); |
| 2757 | return deferred.promise; |
| 2758 | } |
| 2759 | |
| 2760 | if (parameters['firewall_enable'] !== undefined) { |
| 2761 | form['firewall_enable'] = parameters['firewall_enable']; |
| 2762 | } |
| 2763 | |
| 2764 | if (parameters['firewall_enable'] === undefined) { |
| 2765 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 2766 | return deferred.promise; |
| 2767 | } |
| 2768 | |
| 2769 | if (parameters['firewall_rules'] !== undefined) { |
| 2770 | form['firewall_rules'] = parameters['firewall_rules']; |
| 2771 | } |
| 2772 | |
| 2773 | if (parameters['firewall_rules'] === undefined) { |
| 2774 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 2775 | return deferred.promise; |
| 2776 | } |
| 2777 | |
| 2778 | if (parameters['url_filter_enable'] !== undefined) { |
| 2779 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 2780 | } |
| 2781 | |
| 2782 | if (parameters['url_filter_enable'] === undefined) { |
| 2783 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 2784 | return deferred.promise; |
| 2785 | } |
| 2786 | |
| 2787 | if (parameters['url_filter_rules'] !== undefined) { |
| 2788 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 2789 | } |
| 2790 | |
| 2791 | if (parameters['url_filter_rules'] === undefined) { |
| 2792 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 2793 | return deferred.promise; |
| 2794 | } |
| 2795 | |
| 2796 | if (parameters['url_filter_level'] !== undefined) { |
| 2797 | form['url_filter_level'] = parameters['url_filter_level']; |
| 2798 | } |
| 2799 | |
| 2800 | if (parameters['vcpe_synced'] !== undefined) { |
| 2801 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 2802 | } |
| 2803 | |
| 2804 | if (parameters['vcpe_synced'] === undefined) { |
| 2805 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 2806 | return deferred.promise; |
| 2807 | } |
| 2808 | |
| 2809 | if (parameters['cdn_enable'] !== undefined) { |
| 2810 | form['cdn_enable'] = parameters['cdn_enable']; |
| 2811 | } |
| 2812 | |
| 2813 | if (parameters['cdn_enable'] === undefined) { |
| 2814 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 2815 | return deferred.promise; |
| 2816 | } |
| 2817 | |
| 2818 | if (parameters['routeable_subnet'] !== undefined) { |
| 2819 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 2820 | } |
| 2821 | |
| 2822 | if (parameters.$queryParameters) { |
| 2823 | Object.keys(parameters.$queryParameters) |
| 2824 | .forEach(function(parameterName) { |
| 2825 | var parameter = parameters.$queryParameters[parameterName]; |
| 2826 | queryParameters[parameterName] = parameter; |
| 2827 | }); |
| 2828 | } |
| 2829 | |
| 2830 | var url = domain + path; |
| 2831 | var options = { |
| 2832 | timeout: parameters.$timeout, |
| 2833 | method: 'PUT', |
| 2834 | url: url, |
| 2835 | params: queryParameters, |
| 2836 | data: body, |
| 2837 | headers: headers |
| 2838 | }; |
| 2839 | if (Object.keys(form).length > 0) { |
| 2840 | options.data = form; |
| 2841 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2842 | options.transformRequest = xoslib.transformRequest; |
| 2843 | } |
| 2844 | $http(options) |
| 2845 | .success(function(data, status, headers, config) { |
| 2846 | deferred.resolve(data); |
| 2847 | if (parameters.$cache !== undefined) { |
| 2848 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2849 | } |
| 2850 | }) |
| 2851 | .error(function(data, status, headers, config) { |
| 2852 | deferred.reject({ |
| 2853 | status: status, |
| 2854 | headers: headers, |
| 2855 | config: config, |
| 2856 | body: data |
| 2857 | }); |
| 2858 | }); |
| 2859 | |
| 2860 | return deferred.promise; |
| 2861 | }; |
| 2862 | /** |
| 2863 | * |
| 2864 | * @method |
| 2865 | * @name xoslib#Cord_Subscriber_disable_service |
| 2866 | * @param {string} pk - |
| 2867 | * @param {string} service - |
| 2868 | * @param {boolean} firewall_enable - |
| 2869 | * @param {string} firewall_rules - |
| 2870 | * @param {boolean} url_filter_enable - |
| 2871 | * @param {string} url_filter_rules - |
| 2872 | * @param {string} url_filter_level - |
| 2873 | * @param {boolean} vcpe_synced - |
| 2874 | * @param {boolean} cdn_enable - |
| 2875 | * @param {string} routeable_subnet - |
| 2876 | * |
| 2877 | */ |
| 2878 | xoslib.prototype.Cord_Subscriber_disable_service = function(parameters) { |
| 2879 | if (parameters === undefined) { |
| 2880 | parameters = {}; |
| 2881 | } |
| 2882 | var deferred = $q.defer(); |
| 2883 | |
| 2884 | var domain = this.domain; |
| 2885 | var path = '/xoslib/rs/subscriber/{pk}/services/{service}/false/'; |
| 2886 | |
| 2887 | var body; |
| 2888 | var queryParameters = {}; |
| 2889 | var headers = {}; |
| 2890 | var form = {}; |
| 2891 | |
| 2892 | path = path.replace('{pk}', parameters['pk']); |
| 2893 | |
| 2894 | if (parameters['pk'] === undefined) { |
| 2895 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 2896 | return deferred.promise; |
| 2897 | } |
| 2898 | |
| 2899 | path = path.replace('{service}', parameters['service']); |
| 2900 | |
| 2901 | if (parameters['service'] === undefined) { |
| 2902 | deferred.reject(new Error('Missing required path parameter: service')); |
| 2903 | return deferred.promise; |
| 2904 | } |
| 2905 | |
| 2906 | if (parameters['firewall_enable'] !== undefined) { |
| 2907 | form['firewall_enable'] = parameters['firewall_enable']; |
| 2908 | } |
| 2909 | |
| 2910 | if (parameters['firewall_enable'] === undefined) { |
| 2911 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 2912 | return deferred.promise; |
| 2913 | } |
| 2914 | |
| 2915 | if (parameters['firewall_rules'] !== undefined) { |
| 2916 | form['firewall_rules'] = parameters['firewall_rules']; |
| 2917 | } |
| 2918 | |
| 2919 | if (parameters['firewall_rules'] === undefined) { |
| 2920 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 2921 | return deferred.promise; |
| 2922 | } |
| 2923 | |
| 2924 | if (parameters['url_filter_enable'] !== undefined) { |
| 2925 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 2926 | } |
| 2927 | |
| 2928 | if (parameters['url_filter_enable'] === undefined) { |
| 2929 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 2930 | return deferred.promise; |
| 2931 | } |
| 2932 | |
| 2933 | if (parameters['url_filter_rules'] !== undefined) { |
| 2934 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 2935 | } |
| 2936 | |
| 2937 | if (parameters['url_filter_rules'] === undefined) { |
| 2938 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 2939 | return deferred.promise; |
| 2940 | } |
| 2941 | |
| 2942 | if (parameters['url_filter_level'] !== undefined) { |
| 2943 | form['url_filter_level'] = parameters['url_filter_level']; |
| 2944 | } |
| 2945 | |
| 2946 | if (parameters['vcpe_synced'] !== undefined) { |
| 2947 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 2948 | } |
| 2949 | |
| 2950 | if (parameters['vcpe_synced'] === undefined) { |
| 2951 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 2952 | return deferred.promise; |
| 2953 | } |
| 2954 | |
| 2955 | if (parameters['cdn_enable'] !== undefined) { |
| 2956 | form['cdn_enable'] = parameters['cdn_enable']; |
| 2957 | } |
| 2958 | |
| 2959 | if (parameters['cdn_enable'] === undefined) { |
| 2960 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 2961 | return deferred.promise; |
| 2962 | } |
| 2963 | |
| 2964 | if (parameters['routeable_subnet'] !== undefined) { |
| 2965 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 2966 | } |
| 2967 | |
| 2968 | if (parameters.$queryParameters) { |
| 2969 | Object.keys(parameters.$queryParameters) |
| 2970 | .forEach(function(parameterName) { |
| 2971 | var parameter = parameters.$queryParameters[parameterName]; |
| 2972 | queryParameters[parameterName] = parameter; |
| 2973 | }); |
| 2974 | } |
| 2975 | |
| 2976 | var url = domain + path; |
| 2977 | var options = { |
| 2978 | timeout: parameters.$timeout, |
| 2979 | method: 'PUT', |
| 2980 | url: url, |
| 2981 | params: queryParameters, |
| 2982 | data: body, |
| 2983 | headers: headers |
| 2984 | }; |
| 2985 | if (Object.keys(form).length > 0) { |
| 2986 | options.data = form; |
| 2987 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 2988 | options.transformRequest = xoslib.transformRequest; |
| 2989 | } |
| 2990 | $http(options) |
| 2991 | .success(function(data, status, headers, config) { |
| 2992 | deferred.resolve(data); |
| 2993 | if (parameters.$cache !== undefined) { |
| 2994 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 2995 | } |
| 2996 | }) |
| 2997 | .error(function(data, status, headers, config) { |
| 2998 | deferred.reject({ |
| 2999 | status: status, |
| 3000 | headers: headers, |
| 3001 | config: config, |
| 3002 | body: data |
| 3003 | }); |
| 3004 | }); |
| 3005 | |
| 3006 | return deferred.promise; |
| 3007 | }; |
| 3008 | /** |
| 3009 | * |
| 3010 | * @method |
| 3011 | * @name xoslib#Cord_Subscriber_create_user |
| 3012 | * @param {string} pk - |
| 3013 | * @param {boolean} firewall_enable - |
| 3014 | * @param {string} firewall_rules - |
| 3015 | * @param {boolean} url_filter_enable - |
| 3016 | * @param {string} url_filter_rules - |
| 3017 | * @param {string} url_filter_level - |
| 3018 | * @param {boolean} vcpe_synced - |
| 3019 | * @param {boolean} cdn_enable - |
| 3020 | * @param {string} routeable_subnet - |
| 3021 | * |
| 3022 | */ |
| 3023 | xoslib.prototype.Cord_Subscriber_create_user = function(parameters) { |
| 3024 | if (parameters === undefined) { |
| 3025 | parameters = {}; |
| 3026 | } |
| 3027 | var deferred = $q.defer(); |
| 3028 | |
| 3029 | var domain = this.domain; |
| 3030 | var path = '/xoslib/rs/subscriber/{pk}/users/'; |
| 3031 | |
| 3032 | var body; |
| 3033 | var queryParameters = {}; |
| 3034 | var headers = {}; |
| 3035 | var form = {}; |
| 3036 | |
| 3037 | path = path.replace('{pk}', parameters['pk']); |
| 3038 | |
| 3039 | if (parameters['pk'] === undefined) { |
| 3040 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3041 | return deferred.promise; |
| 3042 | } |
| 3043 | |
| 3044 | if (parameters['firewall_enable'] !== undefined) { |
| 3045 | form['firewall_enable'] = parameters['firewall_enable']; |
| 3046 | } |
| 3047 | |
| 3048 | if (parameters['firewall_enable'] === undefined) { |
| 3049 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 3050 | return deferred.promise; |
| 3051 | } |
| 3052 | |
| 3053 | if (parameters['firewall_rules'] !== undefined) { |
| 3054 | form['firewall_rules'] = parameters['firewall_rules']; |
| 3055 | } |
| 3056 | |
| 3057 | if (parameters['firewall_rules'] === undefined) { |
| 3058 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 3059 | return deferred.promise; |
| 3060 | } |
| 3061 | |
| 3062 | if (parameters['url_filter_enable'] !== undefined) { |
| 3063 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 3064 | } |
| 3065 | |
| 3066 | if (parameters['url_filter_enable'] === undefined) { |
| 3067 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 3068 | return deferred.promise; |
| 3069 | } |
| 3070 | |
| 3071 | if (parameters['url_filter_rules'] !== undefined) { |
| 3072 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 3073 | } |
| 3074 | |
| 3075 | if (parameters['url_filter_rules'] === undefined) { |
| 3076 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 3077 | return deferred.promise; |
| 3078 | } |
| 3079 | |
| 3080 | if (parameters['url_filter_level'] !== undefined) { |
| 3081 | form['url_filter_level'] = parameters['url_filter_level']; |
| 3082 | } |
| 3083 | |
| 3084 | if (parameters['vcpe_synced'] !== undefined) { |
| 3085 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 3086 | } |
| 3087 | |
| 3088 | if (parameters['vcpe_synced'] === undefined) { |
| 3089 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 3090 | return deferred.promise; |
| 3091 | } |
| 3092 | |
| 3093 | if (parameters['cdn_enable'] !== undefined) { |
| 3094 | form['cdn_enable'] = parameters['cdn_enable']; |
| 3095 | } |
| 3096 | |
| 3097 | if (parameters['cdn_enable'] === undefined) { |
| 3098 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 3099 | return deferred.promise; |
| 3100 | } |
| 3101 | |
| 3102 | if (parameters['routeable_subnet'] !== undefined) { |
| 3103 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 3104 | } |
| 3105 | |
| 3106 | if (parameters.$queryParameters) { |
| 3107 | Object.keys(parameters.$queryParameters) |
| 3108 | .forEach(function(parameterName) { |
| 3109 | var parameter = parameters.$queryParameters[parameterName]; |
| 3110 | queryParameters[parameterName] = parameter; |
| 3111 | }); |
| 3112 | } |
| 3113 | |
| 3114 | var url = domain + path; |
| 3115 | var options = { |
| 3116 | timeout: parameters.$timeout, |
| 3117 | method: 'POST', |
| 3118 | url: url, |
| 3119 | params: queryParameters, |
| 3120 | data: body, |
| 3121 | headers: headers |
| 3122 | }; |
| 3123 | if (Object.keys(form).length > 0) { |
| 3124 | options.data = form; |
| 3125 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3126 | options.transformRequest = xoslib.transformRequest; |
| 3127 | } |
| 3128 | $http(options) |
| 3129 | .success(function(data, status, headers, config) { |
| 3130 | deferred.resolve(data); |
| 3131 | if (parameters.$cache !== undefined) { |
| 3132 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3133 | } |
| 3134 | }) |
| 3135 | .error(function(data, status, headers, config) { |
| 3136 | deferred.reject({ |
| 3137 | status: status, |
| 3138 | headers: headers, |
| 3139 | config: config, |
| 3140 | body: data |
| 3141 | }); |
| 3142 | }); |
| 3143 | |
| 3144 | return deferred.promise; |
| 3145 | }; |
| 3146 | /** |
| 3147 | * |
| 3148 | * @method |
| 3149 | * @name xoslib#Cord_Subscriber_get_users |
| 3150 | * @param {string} pk - |
| 3151 | * |
| 3152 | */ |
| 3153 | xoslib.prototype.Cord_Subscriber_get_users = function(parameters) { |
| 3154 | if (parameters === undefined) { |
| 3155 | parameters = {}; |
| 3156 | } |
| 3157 | var deferred = $q.defer(); |
| 3158 | |
| 3159 | var domain = this.domain; |
| 3160 | var path = '/xoslib/rs/subscriber/{pk}/users/'; |
| 3161 | |
| 3162 | var body; |
| 3163 | var queryParameters = {}; |
| 3164 | var headers = {}; |
| 3165 | var form = {}; |
| 3166 | |
| 3167 | path = path.replace('{pk}', parameters['pk']); |
| 3168 | |
| 3169 | if (parameters['pk'] === undefined) { |
| 3170 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3171 | return deferred.promise; |
| 3172 | } |
| 3173 | |
| 3174 | if (parameters.$queryParameters) { |
| 3175 | Object.keys(parameters.$queryParameters) |
| 3176 | .forEach(function(parameterName) { |
| 3177 | var parameter = parameters.$queryParameters[parameterName]; |
| 3178 | queryParameters[parameterName] = parameter; |
| 3179 | }); |
| 3180 | } |
| 3181 | |
| 3182 | var url = domain + path; |
| 3183 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 3184 | if (cached !== undefined && parameters.$refresh !== true) { |
| 3185 | deferred.resolve(cached); |
| 3186 | return deferred.promise; |
| 3187 | } |
| 3188 | var options = { |
| 3189 | timeout: parameters.$timeout, |
| 3190 | method: 'GET', |
| 3191 | url: url, |
| 3192 | params: queryParameters, |
| 3193 | data: body, |
| 3194 | headers: headers |
| 3195 | }; |
| 3196 | if (Object.keys(form).length > 0) { |
| 3197 | options.data = form; |
| 3198 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3199 | options.transformRequest = xoslib.transformRequest; |
| 3200 | } |
| 3201 | $http(options) |
| 3202 | .success(function(data, status, headers, config) { |
| 3203 | deferred.resolve(data); |
| 3204 | if (parameters.$cache !== undefined) { |
| 3205 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3206 | } |
| 3207 | }) |
| 3208 | .error(function(data, status, headers, config) { |
| 3209 | deferred.reject({ |
| 3210 | status: status, |
| 3211 | headers: headers, |
| 3212 | config: config, |
| 3213 | body: data |
| 3214 | }); |
| 3215 | }); |
| 3216 | |
| 3217 | return deferred.promise; |
| 3218 | }; |
| 3219 | /** |
| 3220 | * |
| 3221 | * @method |
| 3222 | * @name xoslib#Cord_Subscriber_clear_users |
| 3223 | * @param {string} pk - |
| 3224 | * @param {boolean} firewall_enable - |
| 3225 | * @param {string} firewall_rules - |
| 3226 | * @param {boolean} url_filter_enable - |
| 3227 | * @param {string} url_filter_rules - |
| 3228 | * @param {string} url_filter_level - |
| 3229 | * @param {boolean} vcpe_synced - |
| 3230 | * @param {boolean} cdn_enable - |
| 3231 | * @param {string} routeable_subnet - |
| 3232 | * |
| 3233 | */ |
| 3234 | xoslib.prototype.Cord_Subscriber_clear_users = function(parameters) { |
| 3235 | if (parameters === undefined) { |
| 3236 | parameters = {}; |
| 3237 | } |
| 3238 | var deferred = $q.defer(); |
| 3239 | |
| 3240 | var domain = this.domain; |
| 3241 | var path = '/xoslib/rs/subscriber/{pk}/users/clearusers/'; |
| 3242 | |
| 3243 | var body; |
| 3244 | var queryParameters = {}; |
| 3245 | var headers = {}; |
| 3246 | var form = {}; |
| 3247 | |
| 3248 | path = path.replace('{pk}', parameters['pk']); |
| 3249 | |
| 3250 | if (parameters['pk'] === undefined) { |
| 3251 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3252 | return deferred.promise; |
| 3253 | } |
| 3254 | |
| 3255 | if (parameters['firewall_enable'] !== undefined) { |
| 3256 | form['firewall_enable'] = parameters['firewall_enable']; |
| 3257 | } |
| 3258 | |
| 3259 | if (parameters['firewall_enable'] === undefined) { |
| 3260 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 3261 | return deferred.promise; |
| 3262 | } |
| 3263 | |
| 3264 | if (parameters['firewall_rules'] !== undefined) { |
| 3265 | form['firewall_rules'] = parameters['firewall_rules']; |
| 3266 | } |
| 3267 | |
| 3268 | if (parameters['firewall_rules'] === undefined) { |
| 3269 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 3270 | return deferred.promise; |
| 3271 | } |
| 3272 | |
| 3273 | if (parameters['url_filter_enable'] !== undefined) { |
| 3274 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 3275 | } |
| 3276 | |
| 3277 | if (parameters['url_filter_enable'] === undefined) { |
| 3278 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 3279 | return deferred.promise; |
| 3280 | } |
| 3281 | |
| 3282 | if (parameters['url_filter_rules'] !== undefined) { |
| 3283 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 3284 | } |
| 3285 | |
| 3286 | if (parameters['url_filter_rules'] === undefined) { |
| 3287 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 3288 | return deferred.promise; |
| 3289 | } |
| 3290 | |
| 3291 | if (parameters['url_filter_level'] !== undefined) { |
| 3292 | form['url_filter_level'] = parameters['url_filter_level']; |
| 3293 | } |
| 3294 | |
| 3295 | if (parameters['vcpe_synced'] !== undefined) { |
| 3296 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 3297 | } |
| 3298 | |
| 3299 | if (parameters['vcpe_synced'] === undefined) { |
| 3300 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 3301 | return deferred.promise; |
| 3302 | } |
| 3303 | |
| 3304 | if (parameters['cdn_enable'] !== undefined) { |
| 3305 | form['cdn_enable'] = parameters['cdn_enable']; |
| 3306 | } |
| 3307 | |
| 3308 | if (parameters['cdn_enable'] === undefined) { |
| 3309 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 3310 | return deferred.promise; |
| 3311 | } |
| 3312 | |
| 3313 | if (parameters['routeable_subnet'] !== undefined) { |
| 3314 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 3315 | } |
| 3316 | |
| 3317 | if (parameters.$queryParameters) { |
| 3318 | Object.keys(parameters.$queryParameters) |
| 3319 | .forEach(function(parameterName) { |
| 3320 | var parameter = parameters.$queryParameters[parameterName]; |
| 3321 | queryParameters[parameterName] = parameter; |
| 3322 | }); |
| 3323 | } |
| 3324 | |
| 3325 | var url = domain + path; |
| 3326 | var options = { |
| 3327 | timeout: parameters.$timeout, |
| 3328 | method: 'PUT', |
| 3329 | url: url, |
| 3330 | params: queryParameters, |
| 3331 | data: body, |
| 3332 | headers: headers |
| 3333 | }; |
| 3334 | if (Object.keys(form).length > 0) { |
| 3335 | options.data = form; |
| 3336 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3337 | options.transformRequest = xoslib.transformRequest; |
| 3338 | } |
| 3339 | $http(options) |
| 3340 | .success(function(data, status, headers, config) { |
| 3341 | deferred.resolve(data); |
| 3342 | if (parameters.$cache !== undefined) { |
| 3343 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3344 | } |
| 3345 | }) |
| 3346 | .error(function(data, status, headers, config) { |
| 3347 | deferred.reject({ |
| 3348 | status: status, |
| 3349 | headers: headers, |
| 3350 | config: config, |
| 3351 | body: data |
| 3352 | }); |
| 3353 | }); |
| 3354 | |
| 3355 | return deferred.promise; |
| 3356 | }; |
| 3357 | /** |
| 3358 | * |
| 3359 | * @method |
| 3360 | * @name xoslib#Cord_Subscriber_clear_users |
| 3361 | * @param {string} pk - |
| 3362 | * @param {boolean} firewall_enable - |
| 3363 | * @param {string} firewall_rules - |
| 3364 | * @param {boolean} url_filter_enable - |
| 3365 | * @param {string} url_filter_rules - |
| 3366 | * @param {string} url_filter_level - |
| 3367 | * @param {boolean} vcpe_synced - |
| 3368 | * @param {boolean} cdn_enable - |
| 3369 | * @param {string} routeable_subnet - |
| 3370 | * |
| 3371 | */ |
| 3372 | xoslib.prototype.Cord_Subscriber_clear_users = function(parameters) { |
| 3373 | if (parameters === undefined) { |
| 3374 | parameters = {}; |
| 3375 | } |
| 3376 | var deferred = $q.defer(); |
| 3377 | |
| 3378 | var domain = this.domain; |
| 3379 | var path = '/xoslib/rs/subscriber/{pk}/users/clearusers/'; |
| 3380 | |
| 3381 | var body; |
| 3382 | var queryParameters = {}; |
| 3383 | var headers = {}; |
| 3384 | var form = {}; |
| 3385 | |
| 3386 | path = path.replace('{pk}', parameters['pk']); |
| 3387 | |
| 3388 | if (parameters['pk'] === undefined) { |
| 3389 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3390 | return deferred.promise; |
| 3391 | } |
| 3392 | |
| 3393 | if (parameters['firewall_enable'] !== undefined) { |
| 3394 | form['firewall_enable'] = parameters['firewall_enable']; |
| 3395 | } |
| 3396 | |
| 3397 | if (parameters['firewall_enable'] === undefined) { |
| 3398 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 3399 | return deferred.promise; |
| 3400 | } |
| 3401 | |
| 3402 | if (parameters['firewall_rules'] !== undefined) { |
| 3403 | form['firewall_rules'] = parameters['firewall_rules']; |
| 3404 | } |
| 3405 | |
| 3406 | if (parameters['firewall_rules'] === undefined) { |
| 3407 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 3408 | return deferred.promise; |
| 3409 | } |
| 3410 | |
| 3411 | if (parameters['url_filter_enable'] !== undefined) { |
| 3412 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 3413 | } |
| 3414 | |
| 3415 | if (parameters['url_filter_enable'] === undefined) { |
| 3416 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 3417 | return deferred.promise; |
| 3418 | } |
| 3419 | |
| 3420 | if (parameters['url_filter_rules'] !== undefined) { |
| 3421 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 3422 | } |
| 3423 | |
| 3424 | if (parameters['url_filter_rules'] === undefined) { |
| 3425 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 3426 | return deferred.promise; |
| 3427 | } |
| 3428 | |
| 3429 | if (parameters['url_filter_level'] !== undefined) { |
| 3430 | form['url_filter_level'] = parameters['url_filter_level']; |
| 3431 | } |
| 3432 | |
| 3433 | if (parameters['vcpe_synced'] !== undefined) { |
| 3434 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 3435 | } |
| 3436 | |
| 3437 | if (parameters['vcpe_synced'] === undefined) { |
| 3438 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 3439 | return deferred.promise; |
| 3440 | } |
| 3441 | |
| 3442 | if (parameters['cdn_enable'] !== undefined) { |
| 3443 | form['cdn_enable'] = parameters['cdn_enable']; |
| 3444 | } |
| 3445 | |
| 3446 | if (parameters['cdn_enable'] === undefined) { |
| 3447 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 3448 | return deferred.promise; |
| 3449 | } |
| 3450 | |
| 3451 | if (parameters['routeable_subnet'] !== undefined) { |
| 3452 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 3453 | } |
| 3454 | |
| 3455 | if (parameters.$queryParameters) { |
| 3456 | Object.keys(parameters.$queryParameters) |
| 3457 | .forEach(function(parameterName) { |
| 3458 | var parameter = parameters.$queryParameters[parameterName]; |
| 3459 | queryParameters[parameterName] = parameter; |
| 3460 | }); |
| 3461 | } |
| 3462 | |
| 3463 | var url = domain + path; |
| 3464 | var options = { |
| 3465 | timeout: parameters.$timeout, |
| 3466 | method: 'POST', |
| 3467 | url: url, |
| 3468 | params: queryParameters, |
| 3469 | data: body, |
| 3470 | headers: headers |
| 3471 | }; |
| 3472 | if (Object.keys(form).length > 0) { |
| 3473 | options.data = form; |
| 3474 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3475 | options.transformRequest = xoslib.transformRequest; |
| 3476 | } |
| 3477 | $http(options) |
| 3478 | .success(function(data, status, headers, config) { |
| 3479 | deferred.resolve(data); |
| 3480 | if (parameters.$cache !== undefined) { |
| 3481 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3482 | } |
| 3483 | }) |
| 3484 | .error(function(data, status, headers, config) { |
| 3485 | deferred.reject({ |
| 3486 | status: status, |
| 3487 | headers: headers, |
| 3488 | config: config, |
| 3489 | body: data |
| 3490 | }); |
| 3491 | }); |
| 3492 | |
| 3493 | return deferred.promise; |
| 3494 | }; |
| 3495 | /** |
| 3496 | * |
| 3497 | * @method |
| 3498 | * @name xoslib#Cord_Subscriber_clear_users |
| 3499 | * @param {string} pk - |
| 3500 | * |
| 3501 | */ |
| 3502 | xoslib.prototype.Cord_Subscriber_clear_users = function(parameters) { |
| 3503 | if (parameters === undefined) { |
| 3504 | parameters = {}; |
| 3505 | } |
| 3506 | var deferred = $q.defer(); |
| 3507 | |
| 3508 | var domain = this.domain; |
| 3509 | var path = '/xoslib/rs/subscriber/{pk}/users/clearusers/'; |
| 3510 | |
| 3511 | var body; |
| 3512 | var queryParameters = {}; |
| 3513 | var headers = {}; |
| 3514 | var form = {}; |
| 3515 | |
| 3516 | path = path.replace('{pk}', parameters['pk']); |
| 3517 | |
| 3518 | if (parameters['pk'] === undefined) { |
| 3519 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3520 | return deferred.promise; |
| 3521 | } |
| 3522 | |
| 3523 | if (parameters.$queryParameters) { |
| 3524 | Object.keys(parameters.$queryParameters) |
| 3525 | .forEach(function(parameterName) { |
| 3526 | var parameter = parameters.$queryParameters[parameterName]; |
| 3527 | queryParameters[parameterName] = parameter; |
| 3528 | }); |
| 3529 | } |
| 3530 | |
| 3531 | var url = domain + path; |
| 3532 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 3533 | if (cached !== undefined && parameters.$refresh !== true) { |
| 3534 | deferred.resolve(cached); |
| 3535 | return deferred.promise; |
| 3536 | } |
| 3537 | var options = { |
| 3538 | timeout: parameters.$timeout, |
| 3539 | method: 'GET', |
| 3540 | url: url, |
| 3541 | params: queryParameters, |
| 3542 | data: body, |
| 3543 | headers: headers |
| 3544 | }; |
| 3545 | if (Object.keys(form).length > 0) { |
| 3546 | options.data = form; |
| 3547 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3548 | options.transformRequest = xoslib.transformRequest; |
| 3549 | } |
| 3550 | $http(options) |
| 3551 | .success(function(data, status, headers, config) { |
| 3552 | deferred.resolve(data); |
| 3553 | if (parameters.$cache !== undefined) { |
| 3554 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3555 | } |
| 3556 | }) |
| 3557 | .error(function(data, status, headers, config) { |
| 3558 | deferred.reject({ |
| 3559 | status: status, |
| 3560 | headers: headers, |
| 3561 | config: config, |
| 3562 | body: data |
| 3563 | }); |
| 3564 | }); |
| 3565 | |
| 3566 | return deferred.promise; |
| 3567 | }; |
| 3568 | /** |
| 3569 | * |
| 3570 | * @method |
| 3571 | * @name xoslib#Cord_Subscriber_create_user |
| 3572 | * @param {string} pk - |
| 3573 | * @param {boolean} firewall_enable - |
| 3574 | * @param {string} firewall_rules - |
| 3575 | * @param {boolean} url_filter_enable - |
| 3576 | * @param {string} url_filter_rules - |
| 3577 | * @param {string} url_filter_level - |
| 3578 | * @param {boolean} vcpe_synced - |
| 3579 | * @param {boolean} cdn_enable - |
| 3580 | * @param {string} routeable_subnet - |
| 3581 | * |
| 3582 | */ |
| 3583 | xoslib.prototype.Cord_Subscriber_create_user = function(parameters) { |
| 3584 | if (parameters === undefined) { |
| 3585 | parameters = {}; |
| 3586 | } |
| 3587 | var deferred = $q.defer(); |
| 3588 | |
| 3589 | var domain = this.domain; |
| 3590 | var path = '/xoslib/rs/subscriber/{pk}/users/newuser/'; |
| 3591 | |
| 3592 | var body; |
| 3593 | var queryParameters = {}; |
| 3594 | var headers = {}; |
| 3595 | var form = {}; |
| 3596 | |
| 3597 | path = path.replace('{pk}', parameters['pk']); |
| 3598 | |
| 3599 | if (parameters['pk'] === undefined) { |
| 3600 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3601 | return deferred.promise; |
| 3602 | } |
| 3603 | |
| 3604 | if (parameters['firewall_enable'] !== undefined) { |
| 3605 | form['firewall_enable'] = parameters['firewall_enable']; |
| 3606 | } |
| 3607 | |
| 3608 | if (parameters['firewall_enable'] === undefined) { |
| 3609 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 3610 | return deferred.promise; |
| 3611 | } |
| 3612 | |
| 3613 | if (parameters['firewall_rules'] !== undefined) { |
| 3614 | form['firewall_rules'] = parameters['firewall_rules']; |
| 3615 | } |
| 3616 | |
| 3617 | if (parameters['firewall_rules'] === undefined) { |
| 3618 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 3619 | return deferred.promise; |
| 3620 | } |
| 3621 | |
| 3622 | if (parameters['url_filter_enable'] !== undefined) { |
| 3623 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 3624 | } |
| 3625 | |
| 3626 | if (parameters['url_filter_enable'] === undefined) { |
| 3627 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 3628 | return deferred.promise; |
| 3629 | } |
| 3630 | |
| 3631 | if (parameters['url_filter_rules'] !== undefined) { |
| 3632 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 3633 | } |
| 3634 | |
| 3635 | if (parameters['url_filter_rules'] === undefined) { |
| 3636 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 3637 | return deferred.promise; |
| 3638 | } |
| 3639 | |
| 3640 | if (parameters['url_filter_level'] !== undefined) { |
| 3641 | form['url_filter_level'] = parameters['url_filter_level']; |
| 3642 | } |
| 3643 | |
| 3644 | if (parameters['vcpe_synced'] !== undefined) { |
| 3645 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 3646 | } |
| 3647 | |
| 3648 | if (parameters['vcpe_synced'] === undefined) { |
| 3649 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 3650 | return deferred.promise; |
| 3651 | } |
| 3652 | |
| 3653 | if (parameters['cdn_enable'] !== undefined) { |
| 3654 | form['cdn_enable'] = parameters['cdn_enable']; |
| 3655 | } |
| 3656 | |
| 3657 | if (parameters['cdn_enable'] === undefined) { |
| 3658 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 3659 | return deferred.promise; |
| 3660 | } |
| 3661 | |
| 3662 | if (parameters['routeable_subnet'] !== undefined) { |
| 3663 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 3664 | } |
| 3665 | |
| 3666 | if (parameters.$queryParameters) { |
| 3667 | Object.keys(parameters.$queryParameters) |
| 3668 | .forEach(function(parameterName) { |
| 3669 | var parameter = parameters.$queryParameters[parameterName]; |
| 3670 | queryParameters[parameterName] = parameter; |
| 3671 | }); |
| 3672 | } |
| 3673 | |
| 3674 | var url = domain + path; |
| 3675 | var options = { |
| 3676 | timeout: parameters.$timeout, |
| 3677 | method: 'PUT', |
| 3678 | url: url, |
| 3679 | params: queryParameters, |
| 3680 | data: body, |
| 3681 | headers: headers |
| 3682 | }; |
| 3683 | if (Object.keys(form).length > 0) { |
| 3684 | options.data = form; |
| 3685 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3686 | options.transformRequest = xoslib.transformRequest; |
| 3687 | } |
| 3688 | $http(options) |
| 3689 | .success(function(data, status, headers, config) { |
| 3690 | deferred.resolve(data); |
| 3691 | if (parameters.$cache !== undefined) { |
| 3692 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3693 | } |
| 3694 | }) |
| 3695 | .error(function(data, status, headers, config) { |
| 3696 | deferred.reject({ |
| 3697 | status: status, |
| 3698 | headers: headers, |
| 3699 | config: config, |
| 3700 | body: data |
| 3701 | }); |
| 3702 | }); |
| 3703 | |
| 3704 | return deferred.promise; |
| 3705 | }; |
| 3706 | /** |
| 3707 | * |
| 3708 | * @method |
| 3709 | * @name xoslib#Cord_Subscriber_create_user |
| 3710 | * @param {string} pk - |
| 3711 | * @param {boolean} firewall_enable - |
| 3712 | * @param {string} firewall_rules - |
| 3713 | * @param {boolean} url_filter_enable - |
| 3714 | * @param {string} url_filter_rules - |
| 3715 | * @param {string} url_filter_level - |
| 3716 | * @param {boolean} vcpe_synced - |
| 3717 | * @param {boolean} cdn_enable - |
| 3718 | * @param {string} routeable_subnet - |
| 3719 | * |
| 3720 | */ |
| 3721 | xoslib.prototype.Cord_Subscriber_create_user = function(parameters) { |
| 3722 | if (parameters === undefined) { |
| 3723 | parameters = {}; |
| 3724 | } |
| 3725 | var deferred = $q.defer(); |
| 3726 | |
| 3727 | var domain = this.domain; |
| 3728 | var path = '/xoslib/rs/subscriber/{pk}/users/newuser/'; |
| 3729 | |
| 3730 | var body; |
| 3731 | var queryParameters = {}; |
| 3732 | var headers = {}; |
| 3733 | var form = {}; |
| 3734 | |
| 3735 | path = path.replace('{pk}', parameters['pk']); |
| 3736 | |
| 3737 | if (parameters['pk'] === undefined) { |
| 3738 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3739 | return deferred.promise; |
| 3740 | } |
| 3741 | |
| 3742 | if (parameters['firewall_enable'] !== undefined) { |
| 3743 | form['firewall_enable'] = parameters['firewall_enable']; |
| 3744 | } |
| 3745 | |
| 3746 | if (parameters['firewall_enable'] === undefined) { |
| 3747 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 3748 | return deferred.promise; |
| 3749 | } |
| 3750 | |
| 3751 | if (parameters['firewall_rules'] !== undefined) { |
| 3752 | form['firewall_rules'] = parameters['firewall_rules']; |
| 3753 | } |
| 3754 | |
| 3755 | if (parameters['firewall_rules'] === undefined) { |
| 3756 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 3757 | return deferred.promise; |
| 3758 | } |
| 3759 | |
| 3760 | if (parameters['url_filter_enable'] !== undefined) { |
| 3761 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 3762 | } |
| 3763 | |
| 3764 | if (parameters['url_filter_enable'] === undefined) { |
| 3765 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 3766 | return deferred.promise; |
| 3767 | } |
| 3768 | |
| 3769 | if (parameters['url_filter_rules'] !== undefined) { |
| 3770 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 3771 | } |
| 3772 | |
| 3773 | if (parameters['url_filter_rules'] === undefined) { |
| 3774 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 3775 | return deferred.promise; |
| 3776 | } |
| 3777 | |
| 3778 | if (parameters['url_filter_level'] !== undefined) { |
| 3779 | form['url_filter_level'] = parameters['url_filter_level']; |
| 3780 | } |
| 3781 | |
| 3782 | if (parameters['vcpe_synced'] !== undefined) { |
| 3783 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 3784 | } |
| 3785 | |
| 3786 | if (parameters['vcpe_synced'] === undefined) { |
| 3787 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 3788 | return deferred.promise; |
| 3789 | } |
| 3790 | |
| 3791 | if (parameters['cdn_enable'] !== undefined) { |
| 3792 | form['cdn_enable'] = parameters['cdn_enable']; |
| 3793 | } |
| 3794 | |
| 3795 | if (parameters['cdn_enable'] === undefined) { |
| 3796 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 3797 | return deferred.promise; |
| 3798 | } |
| 3799 | |
| 3800 | if (parameters['routeable_subnet'] !== undefined) { |
| 3801 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 3802 | } |
| 3803 | |
| 3804 | if (parameters.$queryParameters) { |
| 3805 | Object.keys(parameters.$queryParameters) |
| 3806 | .forEach(function(parameterName) { |
| 3807 | var parameter = parameters.$queryParameters[parameterName]; |
| 3808 | queryParameters[parameterName] = parameter; |
| 3809 | }); |
| 3810 | } |
| 3811 | |
| 3812 | var url = domain + path; |
| 3813 | var options = { |
| 3814 | timeout: parameters.$timeout, |
| 3815 | method: 'POST', |
| 3816 | url: url, |
| 3817 | params: queryParameters, |
| 3818 | data: body, |
| 3819 | headers: headers |
| 3820 | }; |
| 3821 | if (Object.keys(form).length > 0) { |
| 3822 | options.data = form; |
| 3823 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3824 | options.transformRequest = xoslib.transformRequest; |
| 3825 | } |
| 3826 | $http(options) |
| 3827 | .success(function(data, status, headers, config) { |
| 3828 | deferred.resolve(data); |
| 3829 | if (parameters.$cache !== undefined) { |
| 3830 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3831 | } |
| 3832 | }) |
| 3833 | .error(function(data, status, headers, config) { |
| 3834 | deferred.reject({ |
| 3835 | status: status, |
| 3836 | headers: headers, |
| 3837 | config: config, |
| 3838 | body: data |
| 3839 | }); |
| 3840 | }); |
| 3841 | |
| 3842 | return deferred.promise; |
| 3843 | }; |
| 3844 | /** |
| 3845 | * |
| 3846 | * @method |
| 3847 | * @name xoslib#Cord_Subscriber_delete_user |
| 3848 | * @param {string} pk - |
| 3849 | * @param {string} uid - |
| 3850 | * |
| 3851 | */ |
| 3852 | xoslib.prototype.Cord_Subscriber_delete_user = function(parameters) { |
| 3853 | if (parameters === undefined) { |
| 3854 | parameters = {}; |
| 3855 | } |
| 3856 | var deferred = $q.defer(); |
| 3857 | |
| 3858 | var domain = this.domain; |
| 3859 | var path = '/xoslib/rs/subscriber/{pk}/users/{uid}/'; |
| 3860 | |
| 3861 | var body; |
| 3862 | var queryParameters = {}; |
| 3863 | var headers = {}; |
| 3864 | var form = {}; |
| 3865 | |
| 3866 | path = path.replace('{pk}', parameters['pk']); |
| 3867 | |
| 3868 | if (parameters['pk'] === undefined) { |
| 3869 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3870 | return deferred.promise; |
| 3871 | } |
| 3872 | |
| 3873 | path = path.replace('{uid}', parameters['uid']); |
| 3874 | |
| 3875 | if (parameters['uid'] === undefined) { |
| 3876 | deferred.reject(new Error('Missing required path parameter: uid')); |
| 3877 | return deferred.promise; |
| 3878 | } |
| 3879 | |
| 3880 | if (parameters.$queryParameters) { |
| 3881 | Object.keys(parameters.$queryParameters) |
| 3882 | .forEach(function(parameterName) { |
| 3883 | var parameter = parameters.$queryParameters[parameterName]; |
| 3884 | queryParameters[parameterName] = parameter; |
| 3885 | }); |
| 3886 | } |
| 3887 | |
| 3888 | var url = domain + path; |
| 3889 | var options = { |
| 3890 | timeout: parameters.$timeout, |
| 3891 | method: 'DELETE', |
| 3892 | url: url, |
| 3893 | params: queryParameters, |
| 3894 | data: body, |
| 3895 | headers: headers |
| 3896 | }; |
| 3897 | if (Object.keys(form).length > 0) { |
| 3898 | options.data = form; |
| 3899 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3900 | options.transformRequest = xoslib.transformRequest; |
| 3901 | } |
| 3902 | $http(options) |
| 3903 | .success(function(data, status, headers, config) { |
| 3904 | deferred.resolve(data); |
| 3905 | if (parameters.$cache !== undefined) { |
| 3906 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3907 | } |
| 3908 | }) |
| 3909 | .error(function(data, status, headers, config) { |
| 3910 | deferred.reject({ |
| 3911 | status: status, |
| 3912 | headers: headers, |
| 3913 | config: config, |
| 3914 | body: data |
| 3915 | }); |
| 3916 | }); |
| 3917 | |
| 3918 | return deferred.promise; |
| 3919 | }; |
| 3920 | /** |
| 3921 | * |
| 3922 | * @method |
| 3923 | * @name xoslib#Cord_Subscriber_get_user_level |
| 3924 | * @param {string} pk - |
| 3925 | * @param {string} uid - |
| 3926 | * |
| 3927 | */ |
| 3928 | xoslib.prototype.Cord_Subscriber_get_user_level = function(parameters) { |
| 3929 | if (parameters === undefined) { |
| 3930 | parameters = {}; |
| 3931 | } |
| 3932 | var deferred = $q.defer(); |
| 3933 | |
| 3934 | var domain = this.domain; |
| 3935 | var path = '/xoslib/rs/subscriber/{pk}/users/{uid}/url_filter/'; |
| 3936 | |
| 3937 | var body; |
| 3938 | var queryParameters = {}; |
| 3939 | var headers = {}; |
| 3940 | var form = {}; |
| 3941 | |
| 3942 | path = path.replace('{pk}', parameters['pk']); |
| 3943 | |
| 3944 | if (parameters['pk'] === undefined) { |
| 3945 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 3946 | return deferred.promise; |
| 3947 | } |
| 3948 | |
| 3949 | path = path.replace('{uid}', parameters['uid']); |
| 3950 | |
| 3951 | if (parameters['uid'] === undefined) { |
| 3952 | deferred.reject(new Error('Missing required path parameter: uid')); |
| 3953 | return deferred.promise; |
| 3954 | } |
| 3955 | |
| 3956 | if (parameters.$queryParameters) { |
| 3957 | Object.keys(parameters.$queryParameters) |
| 3958 | .forEach(function(parameterName) { |
| 3959 | var parameter = parameters.$queryParameters[parameterName]; |
| 3960 | queryParameters[parameterName] = parameter; |
| 3961 | }); |
| 3962 | } |
| 3963 | |
| 3964 | var url = domain + path; |
| 3965 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 3966 | if (cached !== undefined && parameters.$refresh !== true) { |
| 3967 | deferred.resolve(cached); |
| 3968 | return deferred.promise; |
| 3969 | } |
| 3970 | var options = { |
| 3971 | timeout: parameters.$timeout, |
| 3972 | method: 'GET', |
| 3973 | url: url, |
| 3974 | params: queryParameters, |
| 3975 | data: body, |
| 3976 | headers: headers |
| 3977 | }; |
| 3978 | if (Object.keys(form).length > 0) { |
| 3979 | options.data = form; |
| 3980 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 3981 | options.transformRequest = xoslib.transformRequest; |
| 3982 | } |
| 3983 | $http(options) |
| 3984 | .success(function(data, status, headers, config) { |
| 3985 | deferred.resolve(data); |
| 3986 | if (parameters.$cache !== undefined) { |
| 3987 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 3988 | } |
| 3989 | }) |
| 3990 | .error(function(data, status, headers, config) { |
| 3991 | deferred.reject({ |
| 3992 | status: status, |
| 3993 | headers: headers, |
| 3994 | config: config, |
| 3995 | body: data |
| 3996 | }); |
| 3997 | }); |
| 3998 | |
| 3999 | return deferred.promise; |
| 4000 | }; |
| 4001 | /** |
| 4002 | * |
| 4003 | * @method |
| 4004 | * @name xoslib#Cord_Subscriber_set_user_level |
| 4005 | * @param {string} pk - |
| 4006 | * @param {string} uid - |
| 4007 | * @param {string} level - |
| 4008 | * @param {boolean} firewall_enable - |
| 4009 | * @param {string} firewall_rules - |
| 4010 | * @param {boolean} url_filter_enable - |
| 4011 | * @param {string} url_filter_rules - |
| 4012 | * @param {string} url_filter_level - |
| 4013 | * @param {boolean} vcpe_synced - |
| 4014 | * @param {boolean} cdn_enable - |
| 4015 | * @param {string} routeable_subnet - |
| 4016 | * |
| 4017 | */ |
| 4018 | xoslib.prototype.Cord_Subscriber_set_user_level = function(parameters) { |
| 4019 | if (parameters === undefined) { |
| 4020 | parameters = {}; |
| 4021 | } |
| 4022 | var deferred = $q.defer(); |
| 4023 | |
| 4024 | var domain = this.domain; |
| 4025 | var path = '/xoslib/rs/subscriber/{pk}/users/{uid}/url_filter/{level}/'; |
| 4026 | |
| 4027 | var body; |
| 4028 | var queryParameters = {}; |
| 4029 | var headers = {}; |
| 4030 | var form = {}; |
| 4031 | |
| 4032 | path = path.replace('{pk}', parameters['pk']); |
| 4033 | |
| 4034 | if (parameters['pk'] === undefined) { |
| 4035 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 4036 | return deferred.promise; |
| 4037 | } |
| 4038 | |
| 4039 | path = path.replace('{uid}', parameters['uid']); |
| 4040 | |
| 4041 | if (parameters['uid'] === undefined) { |
| 4042 | deferred.reject(new Error('Missing required path parameter: uid')); |
| 4043 | return deferred.promise; |
| 4044 | } |
| 4045 | |
| 4046 | path = path.replace('{level}', parameters['level']); |
| 4047 | |
| 4048 | if (parameters['level'] === undefined) { |
| 4049 | deferred.reject(new Error('Missing required path parameter: level')); |
| 4050 | return deferred.promise; |
| 4051 | } |
| 4052 | |
| 4053 | if (parameters['firewall_enable'] !== undefined) { |
| 4054 | form['firewall_enable'] = parameters['firewall_enable']; |
| 4055 | } |
| 4056 | |
| 4057 | if (parameters['firewall_enable'] === undefined) { |
| 4058 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 4059 | return deferred.promise; |
| 4060 | } |
| 4061 | |
| 4062 | if (parameters['firewall_rules'] !== undefined) { |
| 4063 | form['firewall_rules'] = parameters['firewall_rules']; |
| 4064 | } |
| 4065 | |
| 4066 | if (parameters['firewall_rules'] === undefined) { |
| 4067 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 4068 | return deferred.promise; |
| 4069 | } |
| 4070 | |
| 4071 | if (parameters['url_filter_enable'] !== undefined) { |
| 4072 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 4073 | } |
| 4074 | |
| 4075 | if (parameters['url_filter_enable'] === undefined) { |
| 4076 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 4077 | return deferred.promise; |
| 4078 | } |
| 4079 | |
| 4080 | if (parameters['url_filter_rules'] !== undefined) { |
| 4081 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 4082 | } |
| 4083 | |
| 4084 | if (parameters['url_filter_rules'] === undefined) { |
| 4085 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 4086 | return deferred.promise; |
| 4087 | } |
| 4088 | |
| 4089 | if (parameters['url_filter_level'] !== undefined) { |
| 4090 | form['url_filter_level'] = parameters['url_filter_level']; |
| 4091 | } |
| 4092 | |
| 4093 | if (parameters['vcpe_synced'] !== undefined) { |
| 4094 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 4095 | } |
| 4096 | |
| 4097 | if (parameters['vcpe_synced'] === undefined) { |
| 4098 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 4099 | return deferred.promise; |
| 4100 | } |
| 4101 | |
| 4102 | if (parameters['cdn_enable'] !== undefined) { |
| 4103 | form['cdn_enable'] = parameters['cdn_enable']; |
| 4104 | } |
| 4105 | |
| 4106 | if (parameters['cdn_enable'] === undefined) { |
| 4107 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 4108 | return deferred.promise; |
| 4109 | } |
| 4110 | |
| 4111 | if (parameters['routeable_subnet'] !== undefined) { |
| 4112 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 4113 | } |
| 4114 | |
| 4115 | if (parameters.$queryParameters) { |
| 4116 | Object.keys(parameters.$queryParameters) |
| 4117 | .forEach(function(parameterName) { |
| 4118 | var parameter = parameters.$queryParameters[parameterName]; |
| 4119 | queryParameters[parameterName] = parameter; |
| 4120 | }); |
| 4121 | } |
| 4122 | |
| 4123 | var url = domain + path; |
| 4124 | var options = { |
| 4125 | timeout: parameters.$timeout, |
| 4126 | method: 'PUT', |
| 4127 | url: url, |
| 4128 | params: queryParameters, |
| 4129 | data: body, |
| 4130 | headers: headers |
| 4131 | }; |
| 4132 | if (Object.keys(form).length > 0) { |
| 4133 | options.data = form; |
| 4134 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4135 | options.transformRequest = xoslib.transformRequest; |
| 4136 | } |
| 4137 | $http(options) |
| 4138 | .success(function(data, status, headers, config) { |
| 4139 | deferred.resolve(data); |
| 4140 | if (parameters.$cache !== undefined) { |
| 4141 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4142 | } |
| 4143 | }) |
| 4144 | .error(function(data, status, headers, config) { |
| 4145 | deferred.reject({ |
| 4146 | status: status, |
| 4147 | headers: headers, |
| 4148 | config: config, |
| 4149 | body: data |
| 4150 | }); |
| 4151 | }); |
| 4152 | |
| 4153 | return deferred.promise; |
| 4154 | }; |
| 4155 | /** |
| 4156 | * |
| 4157 | * @method |
| 4158 | * @name xoslib#Cord_Subscriber_get_bbsdump |
| 4159 | * @param {string} pk - |
| 4160 | * |
| 4161 | */ |
| 4162 | xoslib.prototype.Cord_Subscriber_get_bbsdump = function(parameters) { |
| 4163 | if (parameters === undefined) { |
| 4164 | parameters = {}; |
| 4165 | } |
| 4166 | var deferred = $q.defer(); |
| 4167 | |
| 4168 | var domain = this.domain; |
| 4169 | var path = '/xoslib/rs/subscriber/{pk}/bbsdump/'; |
| 4170 | |
| 4171 | var body; |
| 4172 | var queryParameters = {}; |
| 4173 | var headers = {}; |
| 4174 | var form = {}; |
| 4175 | |
| 4176 | path = path.replace('{pk}', parameters['pk']); |
| 4177 | |
| 4178 | if (parameters['pk'] === undefined) { |
| 4179 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 4180 | return deferred.promise; |
| 4181 | } |
| 4182 | |
| 4183 | if (parameters.$queryParameters) { |
| 4184 | Object.keys(parameters.$queryParameters) |
| 4185 | .forEach(function(parameterName) { |
| 4186 | var parameter = parameters.$queryParameters[parameterName]; |
| 4187 | queryParameters[parameterName] = parameter; |
| 4188 | }); |
| 4189 | } |
| 4190 | |
| 4191 | var url = domain + path; |
| 4192 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4193 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4194 | deferred.resolve(cached); |
| 4195 | return deferred.promise; |
| 4196 | } |
| 4197 | var options = { |
| 4198 | timeout: parameters.$timeout, |
| 4199 | method: 'GET', |
| 4200 | url: url, |
| 4201 | params: queryParameters, |
| 4202 | data: body, |
| 4203 | headers: headers |
| 4204 | }; |
| 4205 | if (Object.keys(form).length > 0) { |
| 4206 | options.data = form; |
| 4207 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4208 | options.transformRequest = xoslib.transformRequest; |
| 4209 | } |
| 4210 | $http(options) |
| 4211 | .success(function(data, status, headers, config) { |
| 4212 | deferred.resolve(data); |
| 4213 | if (parameters.$cache !== undefined) { |
| 4214 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4215 | } |
| 4216 | }) |
| 4217 | .error(function(data, status, headers, config) { |
| 4218 | deferred.reject({ |
| 4219 | status: status, |
| 4220 | headers: headers, |
| 4221 | config: config, |
| 4222 | body: data |
| 4223 | }); |
| 4224 | }); |
| 4225 | |
| 4226 | return deferred.promise; |
| 4227 | }; |
| 4228 | /** |
| 4229 | * |
| 4230 | * @method |
| 4231 | * @name xoslib#Cord_Subscriber_initdemo |
| 4232 | * @param {boolean} firewall_enable - |
| 4233 | * @param {string} firewall_rules - |
| 4234 | * @param {boolean} url_filter_enable - |
| 4235 | * @param {string} url_filter_rules - |
| 4236 | * @param {string} url_filter_level - |
| 4237 | * @param {boolean} vcpe_synced - |
| 4238 | * @param {boolean} cdn_enable - |
| 4239 | * @param {string} routeable_subnet - |
| 4240 | * |
| 4241 | */ |
| 4242 | xoslib.prototype.Cord_Subscriber_initdemo = function(parameters) { |
| 4243 | if (parameters === undefined) { |
| 4244 | parameters = {}; |
| 4245 | } |
| 4246 | var deferred = $q.defer(); |
| 4247 | |
| 4248 | var domain = this.domain; |
| 4249 | var path = '/xoslib/rs/initdemo/'; |
| 4250 | |
| 4251 | var body; |
| 4252 | var queryParameters = {}; |
| 4253 | var headers = {}; |
| 4254 | var form = {}; |
| 4255 | |
| 4256 | if (parameters['firewall_enable'] !== undefined) { |
| 4257 | form['firewall_enable'] = parameters['firewall_enable']; |
| 4258 | } |
| 4259 | |
| 4260 | if (parameters['firewall_enable'] === undefined) { |
| 4261 | deferred.reject(new Error('Missing required form parameter: firewall_enable')); |
| 4262 | return deferred.promise; |
| 4263 | } |
| 4264 | |
| 4265 | if (parameters['firewall_rules'] !== undefined) { |
| 4266 | form['firewall_rules'] = parameters['firewall_rules']; |
| 4267 | } |
| 4268 | |
| 4269 | if (parameters['firewall_rules'] === undefined) { |
| 4270 | deferred.reject(new Error('Missing required form parameter: firewall_rules')); |
| 4271 | return deferred.promise; |
| 4272 | } |
| 4273 | |
| 4274 | if (parameters['url_filter_enable'] !== undefined) { |
| 4275 | form['url_filter_enable'] = parameters['url_filter_enable']; |
| 4276 | } |
| 4277 | |
| 4278 | if (parameters['url_filter_enable'] === undefined) { |
| 4279 | deferred.reject(new Error('Missing required form parameter: url_filter_enable')); |
| 4280 | return deferred.promise; |
| 4281 | } |
| 4282 | |
| 4283 | if (parameters['url_filter_rules'] !== undefined) { |
| 4284 | form['url_filter_rules'] = parameters['url_filter_rules']; |
| 4285 | } |
| 4286 | |
| 4287 | if (parameters['url_filter_rules'] === undefined) { |
| 4288 | deferred.reject(new Error('Missing required form parameter: url_filter_rules')); |
| 4289 | return deferred.promise; |
| 4290 | } |
| 4291 | |
| 4292 | if (parameters['url_filter_level'] !== undefined) { |
| 4293 | form['url_filter_level'] = parameters['url_filter_level']; |
| 4294 | } |
| 4295 | |
| 4296 | if (parameters['vcpe_synced'] !== undefined) { |
| 4297 | form['vcpe_synced'] = parameters['vcpe_synced']; |
| 4298 | } |
| 4299 | |
| 4300 | if (parameters['vcpe_synced'] === undefined) { |
| 4301 | deferred.reject(new Error('Missing required form parameter: vcpe_synced')); |
| 4302 | return deferred.promise; |
| 4303 | } |
| 4304 | |
| 4305 | if (parameters['cdn_enable'] !== undefined) { |
| 4306 | form['cdn_enable'] = parameters['cdn_enable']; |
| 4307 | } |
| 4308 | |
| 4309 | if (parameters['cdn_enable'] === undefined) { |
| 4310 | deferred.reject(new Error('Missing required form parameter: cdn_enable')); |
| 4311 | return deferred.promise; |
| 4312 | } |
| 4313 | |
| 4314 | if (parameters['routeable_subnet'] !== undefined) { |
| 4315 | form['routeable_subnet'] = parameters['routeable_subnet']; |
| 4316 | } |
| 4317 | |
| 4318 | if (parameters.$queryParameters) { |
| 4319 | Object.keys(parameters.$queryParameters) |
| 4320 | .forEach(function(parameterName) { |
| 4321 | var parameter = parameters.$queryParameters[parameterName]; |
| 4322 | queryParameters[parameterName] = parameter; |
| 4323 | }); |
| 4324 | } |
| 4325 | |
| 4326 | var url = domain + path; |
| 4327 | var options = { |
| 4328 | timeout: parameters.$timeout, |
| 4329 | method: 'PUT', |
| 4330 | url: url, |
| 4331 | params: queryParameters, |
| 4332 | data: body, |
| 4333 | headers: headers |
| 4334 | }; |
| 4335 | if (Object.keys(form).length > 0) { |
| 4336 | options.data = form; |
| 4337 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4338 | options.transformRequest = xoslib.transformRequest; |
| 4339 | } |
| 4340 | $http(options) |
| 4341 | .success(function(data, status, headers, config) { |
| 4342 | deferred.resolve(data); |
| 4343 | if (parameters.$cache !== undefined) { |
| 4344 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4345 | } |
| 4346 | }) |
| 4347 | .error(function(data, status, headers, config) { |
| 4348 | deferred.reject({ |
| 4349 | status: status, |
| 4350 | headers: headers, |
| 4351 | config: config, |
| 4352 | body: data |
| 4353 | }); |
| 4354 | }); |
| 4355 | |
| 4356 | return deferred.promise; |
| 4357 | }; |
| 4358 | /** |
| 4359 | * |
| 4360 | * @method |
| 4361 | * @name xoslib#Cord_Subscriber_initdemo |
| 4362 | * |
| 4363 | */ |
| 4364 | xoslib.prototype.Cord_Subscriber_initdemo = function(parameters) { |
| 4365 | if (parameters === undefined) { |
| 4366 | parameters = {}; |
| 4367 | } |
| 4368 | var deferred = $q.defer(); |
| 4369 | |
| 4370 | var domain = this.domain; |
| 4371 | var path = '/xoslib/rs/initdemo/'; |
| 4372 | |
| 4373 | var body; |
| 4374 | var queryParameters = {}; |
| 4375 | var headers = {}; |
| 4376 | var form = {}; |
| 4377 | |
| 4378 | if (parameters.$queryParameters) { |
| 4379 | Object.keys(parameters.$queryParameters) |
| 4380 | .forEach(function(parameterName) { |
| 4381 | var parameter = parameters.$queryParameters[parameterName]; |
| 4382 | queryParameters[parameterName] = parameter; |
| 4383 | }); |
| 4384 | } |
| 4385 | |
| 4386 | var url = domain + path; |
| 4387 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4388 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4389 | deferred.resolve(cached); |
| 4390 | return deferred.promise; |
| 4391 | } |
| 4392 | var options = { |
| 4393 | timeout: parameters.$timeout, |
| 4394 | method: 'GET', |
| 4395 | url: url, |
| 4396 | params: queryParameters, |
| 4397 | data: body, |
| 4398 | headers: headers |
| 4399 | }; |
| 4400 | if (Object.keys(form).length > 0) { |
| 4401 | options.data = form; |
| 4402 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4403 | options.transformRequest = xoslib.transformRequest; |
| 4404 | } |
| 4405 | $http(options) |
| 4406 | .success(function(data, status, headers, config) { |
| 4407 | deferred.resolve(data); |
| 4408 | if (parameters.$cache !== undefined) { |
| 4409 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4410 | } |
| 4411 | }) |
| 4412 | .error(function(data, status, headers, config) { |
| 4413 | deferred.reject({ |
| 4414 | status: status, |
| 4415 | headers: headers, |
| 4416 | config: config, |
| 4417 | body: data |
| 4418 | }); |
| 4419 | }); |
| 4420 | |
| 4421 | return deferred.promise; |
| 4422 | }; |
| 4423 | /** |
| 4424 | * |
| 4425 | * @method |
| 4426 | * @name xoslib#Cord_Subscriber_ssiddetail |
| 4427 | * @param {string} ssid - |
| 4428 | * |
| 4429 | */ |
| 4430 | xoslib.prototype.Cord_Subscriber_ssiddetail = function(parameters) { |
| 4431 | if (parameters === undefined) { |
| 4432 | parameters = {}; |
| 4433 | } |
| 4434 | var deferred = $q.defer(); |
| 4435 | |
| 4436 | var domain = this.domain; |
| 4437 | var path = '/xoslib/rs/subidlookup/{ssid}/'; |
| 4438 | |
| 4439 | var body; |
| 4440 | var queryParameters = {}; |
| 4441 | var headers = {}; |
| 4442 | var form = {}; |
| 4443 | |
| 4444 | path = path.replace('{ssid}', parameters['ssid']); |
| 4445 | |
| 4446 | if (parameters['ssid'] === undefined) { |
| 4447 | deferred.reject(new Error('Missing required path parameter: ssid')); |
| 4448 | return deferred.promise; |
| 4449 | } |
| 4450 | |
| 4451 | if (parameters.$queryParameters) { |
| 4452 | Object.keys(parameters.$queryParameters) |
| 4453 | .forEach(function(parameterName) { |
| 4454 | var parameter = parameters.$queryParameters[parameterName]; |
| 4455 | queryParameters[parameterName] = parameter; |
| 4456 | }); |
| 4457 | } |
| 4458 | |
| 4459 | var url = domain + path; |
| 4460 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4461 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4462 | deferred.resolve(cached); |
| 4463 | return deferred.promise; |
| 4464 | } |
| 4465 | var options = { |
| 4466 | timeout: parameters.$timeout, |
| 4467 | method: 'GET', |
| 4468 | url: url, |
| 4469 | params: queryParameters, |
| 4470 | data: body, |
| 4471 | headers: headers |
| 4472 | }; |
| 4473 | if (Object.keys(form).length > 0) { |
| 4474 | options.data = form; |
| 4475 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4476 | options.transformRequest = xoslib.transformRequest; |
| 4477 | } |
| 4478 | $http(options) |
| 4479 | .success(function(data, status, headers, config) { |
| 4480 | deferred.resolve(data); |
| 4481 | if (parameters.$cache !== undefined) { |
| 4482 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4483 | } |
| 4484 | }) |
| 4485 | .error(function(data, status, headers, config) { |
| 4486 | deferred.reject({ |
| 4487 | status: status, |
| 4488 | headers: headers, |
| 4489 | config: config, |
| 4490 | body: data |
| 4491 | }); |
| 4492 | }); |
| 4493 | |
| 4494 | return deferred.promise; |
| 4495 | }; |
| 4496 | /** |
| 4497 | * |
| 4498 | * @method |
| 4499 | * @name xoslib#Cord_Subscriber_ssidlist |
| 4500 | * |
| 4501 | */ |
| 4502 | xoslib.prototype.Cord_Subscriber_ssidlist = function(parameters) { |
| 4503 | if (parameters === undefined) { |
| 4504 | parameters = {}; |
| 4505 | } |
| 4506 | var deferred = $q.defer(); |
| 4507 | |
| 4508 | var domain = this.domain; |
| 4509 | var path = '/xoslib/rs/subidlookup/'; |
| 4510 | |
| 4511 | var body; |
| 4512 | var queryParameters = {}; |
| 4513 | var headers = {}; |
| 4514 | var form = {}; |
| 4515 | |
| 4516 | if (parameters.$queryParameters) { |
| 4517 | Object.keys(parameters.$queryParameters) |
| 4518 | .forEach(function(parameterName) { |
| 4519 | var parameter = parameters.$queryParameters[parameterName]; |
| 4520 | queryParameters[parameterName] = parameter; |
| 4521 | }); |
| 4522 | } |
| 4523 | |
| 4524 | var url = domain + path; |
| 4525 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4526 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4527 | deferred.resolve(cached); |
| 4528 | return deferred.promise; |
| 4529 | } |
| 4530 | var options = { |
| 4531 | timeout: parameters.$timeout, |
| 4532 | method: 'GET', |
| 4533 | url: url, |
| 4534 | params: queryParameters, |
| 4535 | data: body, |
| 4536 | headers: headers |
| 4537 | }; |
| 4538 | if (Object.keys(form).length > 0) { |
| 4539 | options.data = form; |
| 4540 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4541 | options.transformRequest = xoslib.transformRequest; |
| 4542 | } |
| 4543 | $http(options) |
| 4544 | .success(function(data, status, headers, config) { |
| 4545 | deferred.resolve(data); |
| 4546 | if (parameters.$cache !== undefined) { |
| 4547 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4548 | } |
| 4549 | }) |
| 4550 | .error(function(data, status, headers, config) { |
| 4551 | deferred.reject({ |
| 4552 | status: status, |
| 4553 | headers: headers, |
| 4554 | config: config, |
| 4555 | body: data |
| 4556 | }); |
| 4557 | }); |
| 4558 | |
| 4559 | return deferred.promise; |
| 4560 | }; |
| 4561 | /** |
| 4562 | * |
| 4563 | * @method |
| 4564 | * @name xoslib#Cord_Subscriber_get_vbng_mapping |
| 4565 | * |
| 4566 | */ |
| 4567 | xoslib.prototype.Cord_Subscriber_get_vbng_mapping = function(parameters) { |
| 4568 | if (parameters === undefined) { |
| 4569 | parameters = {}; |
| 4570 | } |
| 4571 | var deferred = $q.defer(); |
| 4572 | |
| 4573 | var domain = this.domain; |
| 4574 | var path = '/xoslib/rs/vbng_mapping/'; |
| 4575 | |
| 4576 | var body; |
| 4577 | var queryParameters = {}; |
| 4578 | var headers = {}; |
| 4579 | var form = {}; |
| 4580 | |
| 4581 | if (parameters.$queryParameters) { |
| 4582 | Object.keys(parameters.$queryParameters) |
| 4583 | .forEach(function(parameterName) { |
| 4584 | var parameter = parameters.$queryParameters[parameterName]; |
| 4585 | queryParameters[parameterName] = parameter; |
| 4586 | }); |
| 4587 | } |
| 4588 | |
| 4589 | var url = domain + path; |
| 4590 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4591 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4592 | deferred.resolve(cached); |
| 4593 | return deferred.promise; |
| 4594 | } |
| 4595 | var options = { |
| 4596 | timeout: parameters.$timeout, |
| 4597 | method: 'GET', |
| 4598 | url: url, |
| 4599 | params: queryParameters, |
| 4600 | data: body, |
| 4601 | headers: headers |
| 4602 | }; |
| 4603 | if (Object.keys(form).length > 0) { |
| 4604 | options.data = form; |
| 4605 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4606 | options.transformRequest = xoslib.transformRequest; |
| 4607 | } |
| 4608 | $http(options) |
| 4609 | .success(function(data, status, headers, config) { |
| 4610 | deferred.resolve(data); |
| 4611 | if (parameters.$cache !== undefined) { |
| 4612 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4613 | } |
| 4614 | }) |
| 4615 | .error(function(data, status, headers, config) { |
| 4616 | deferred.reject({ |
| 4617 | status: status, |
| 4618 | headers: headers, |
| 4619 | config: config, |
| 4620 | body: data |
| 4621 | }); |
| 4622 | }); |
| 4623 | |
| 4624 | return deferred.promise; |
| 4625 | }; |
| 4626 | /** |
| 4627 | * |
| 4628 | * @method |
| 4629 | * @name xoslib#Cord_User_Detail_GET |
| 4630 | * @param {string} pk - |
| 4631 | * |
| 4632 | */ |
| 4633 | xoslib.prototype.Cord_User_Detail_GET = function(parameters) { |
| 4634 | if (parameters === undefined) { |
| 4635 | parameters = {}; |
| 4636 | } |
| 4637 | var deferred = $q.defer(); |
| 4638 | |
| 4639 | var domain = this.domain; |
| 4640 | var path = '/xoslib/corduser/{pk}/'; |
| 4641 | |
| 4642 | var body; |
| 4643 | var queryParameters = {}; |
| 4644 | var headers = {}; |
| 4645 | var form = {}; |
| 4646 | |
| 4647 | path = path.replace('{pk}', parameters['pk']); |
| 4648 | |
| 4649 | if (parameters['pk'] === undefined) { |
| 4650 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 4651 | return deferred.promise; |
| 4652 | } |
| 4653 | |
| 4654 | if (parameters.$queryParameters) { |
| 4655 | Object.keys(parameters.$queryParameters) |
| 4656 | .forEach(function(parameterName) { |
| 4657 | var parameter = parameters.$queryParameters[parameterName]; |
| 4658 | queryParameters[parameterName] = parameter; |
| 4659 | }); |
| 4660 | } |
| 4661 | |
| 4662 | var url = domain + path; |
| 4663 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4664 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4665 | deferred.resolve(cached); |
| 4666 | return deferred.promise; |
| 4667 | } |
| 4668 | var options = { |
| 4669 | timeout: parameters.$timeout, |
| 4670 | method: 'GET', |
| 4671 | url: url, |
| 4672 | params: queryParameters, |
| 4673 | data: body, |
| 4674 | headers: headers |
| 4675 | }; |
| 4676 | if (Object.keys(form).length > 0) { |
| 4677 | options.data = form; |
| 4678 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4679 | options.transformRequest = xoslib.transformRequest; |
| 4680 | } |
| 4681 | $http(options) |
| 4682 | .success(function(data, status, headers, config) { |
| 4683 | deferred.resolve(data); |
| 4684 | if (parameters.$cache !== undefined) { |
| 4685 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4686 | } |
| 4687 | }) |
| 4688 | .error(function(data, status, headers, config) { |
| 4689 | deferred.reject({ |
| 4690 | status: status, |
| 4691 | headers: headers, |
| 4692 | config: config, |
| 4693 | body: data |
| 4694 | }); |
| 4695 | }); |
| 4696 | |
| 4697 | return deferred.promise; |
| 4698 | }; |
| 4699 | /** |
| 4700 | * |
| 4701 | * @method |
| 4702 | * @name xoslib#Cord_User_Detail_PUT |
| 4703 | * @param {string} pk - |
| 4704 | * |
| 4705 | */ |
| 4706 | xoslib.prototype.Cord_User_Detail_PUT = function(parameters) { |
| 4707 | if (parameters === undefined) { |
| 4708 | parameters = {}; |
| 4709 | } |
| 4710 | var deferred = $q.defer(); |
| 4711 | |
| 4712 | var domain = this.domain; |
| 4713 | var path = '/xoslib/corduser/{pk}/'; |
| 4714 | |
| 4715 | var body; |
| 4716 | var queryParameters = {}; |
| 4717 | var headers = {}; |
| 4718 | var form = {}; |
| 4719 | |
| 4720 | path = path.replace('{pk}', parameters['pk']); |
| 4721 | |
| 4722 | if (parameters['pk'] === undefined) { |
| 4723 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 4724 | return deferred.promise; |
| 4725 | } |
| 4726 | |
| 4727 | if (parameters.$queryParameters) { |
| 4728 | Object.keys(parameters.$queryParameters) |
| 4729 | .forEach(function(parameterName) { |
| 4730 | var parameter = parameters.$queryParameters[parameterName]; |
| 4731 | queryParameters[parameterName] = parameter; |
| 4732 | }); |
| 4733 | } |
| 4734 | |
| 4735 | var url = domain + path; |
| 4736 | var options = { |
| 4737 | timeout: parameters.$timeout, |
| 4738 | method: 'PUT', |
| 4739 | url: url, |
| 4740 | params: queryParameters, |
| 4741 | data: body, |
| 4742 | headers: headers |
| 4743 | }; |
| 4744 | if (Object.keys(form).length > 0) { |
| 4745 | options.data = form; |
| 4746 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4747 | options.transformRequest = xoslib.transformRequest; |
| 4748 | } |
| 4749 | $http(options) |
| 4750 | .success(function(data, status, headers, config) { |
| 4751 | deferred.resolve(data); |
| 4752 | if (parameters.$cache !== undefined) { |
| 4753 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4754 | } |
| 4755 | }) |
| 4756 | .error(function(data, status, headers, config) { |
| 4757 | deferred.reject({ |
| 4758 | status: status, |
| 4759 | headers: headers, |
| 4760 | config: config, |
| 4761 | body: data |
| 4762 | }); |
| 4763 | }); |
| 4764 | |
| 4765 | return deferred.promise; |
| 4766 | }; |
| 4767 | /** |
| 4768 | * |
| 4769 | * @method |
| 4770 | * @name xoslib#Cord_User_Detail_DELETE |
| 4771 | * @param {string} pk - |
| 4772 | * |
| 4773 | */ |
| 4774 | xoslib.prototype.Cord_User_Detail_DELETE = function(parameters) { |
| 4775 | if (parameters === undefined) { |
| 4776 | parameters = {}; |
| 4777 | } |
| 4778 | var deferred = $q.defer(); |
| 4779 | |
| 4780 | var domain = this.domain; |
| 4781 | var path = '/xoslib/corduser/{pk}/'; |
| 4782 | |
| 4783 | var body; |
| 4784 | var queryParameters = {}; |
| 4785 | var headers = {}; |
| 4786 | var form = {}; |
| 4787 | |
| 4788 | path = path.replace('{pk}', parameters['pk']); |
| 4789 | |
| 4790 | if (parameters['pk'] === undefined) { |
| 4791 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 4792 | return deferred.promise; |
| 4793 | } |
| 4794 | |
| 4795 | if (parameters.$queryParameters) { |
| 4796 | Object.keys(parameters.$queryParameters) |
| 4797 | .forEach(function(parameterName) { |
| 4798 | var parameter = parameters.$queryParameters[parameterName]; |
| 4799 | queryParameters[parameterName] = parameter; |
| 4800 | }); |
| 4801 | } |
| 4802 | |
| 4803 | var url = domain + path; |
| 4804 | var options = { |
| 4805 | timeout: parameters.$timeout, |
| 4806 | method: 'DELETE', |
| 4807 | url: url, |
| 4808 | params: queryParameters, |
| 4809 | data: body, |
| 4810 | headers: headers |
| 4811 | }; |
| 4812 | if (Object.keys(form).length > 0) { |
| 4813 | options.data = form; |
| 4814 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4815 | options.transformRequest = xoslib.transformRequest; |
| 4816 | } |
| 4817 | $http(options) |
| 4818 | .success(function(data, status, headers, config) { |
| 4819 | deferred.resolve(data); |
| 4820 | if (parameters.$cache !== undefined) { |
| 4821 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4822 | } |
| 4823 | }) |
| 4824 | .error(function(data, status, headers, config) { |
| 4825 | deferred.reject({ |
| 4826 | status: status, |
| 4827 | headers: headers, |
| 4828 | config: config, |
| 4829 | body: data |
| 4830 | }); |
| 4831 | }); |
| 4832 | |
| 4833 | return deferred.promise; |
| 4834 | }; |
| 4835 | /** |
| 4836 | * |
| 4837 | * @method |
| 4838 | * @name xoslib#Cord_User_List_GET |
| 4839 | * |
| 4840 | */ |
| 4841 | xoslib.prototype.Cord_User_List_GET = function(parameters) { |
| 4842 | if (parameters === undefined) { |
| 4843 | parameters = {}; |
| 4844 | } |
| 4845 | var deferred = $q.defer(); |
| 4846 | |
| 4847 | var domain = this.domain; |
| 4848 | var path = '/xoslib/corduser/'; |
| 4849 | |
| 4850 | var body; |
| 4851 | var queryParameters = {}; |
| 4852 | var headers = {}; |
| 4853 | var form = {}; |
| 4854 | |
| 4855 | if (parameters.$queryParameters) { |
| 4856 | Object.keys(parameters.$queryParameters) |
| 4857 | .forEach(function(parameterName) { |
| 4858 | var parameter = parameters.$queryParameters[parameterName]; |
| 4859 | queryParameters[parameterName] = parameter; |
| 4860 | }); |
| 4861 | } |
| 4862 | |
| 4863 | var url = domain + path; |
| 4864 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4865 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4866 | deferred.resolve(cached); |
| 4867 | return deferred.promise; |
| 4868 | } |
| 4869 | var options = { |
| 4870 | timeout: parameters.$timeout, |
| 4871 | method: 'GET', |
| 4872 | url: url, |
| 4873 | params: queryParameters, |
| 4874 | data: body, |
| 4875 | headers: headers |
| 4876 | }; |
| 4877 | if (Object.keys(form).length > 0) { |
| 4878 | options.data = form; |
| 4879 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4880 | options.transformRequest = xoslib.transformRequest; |
| 4881 | } |
| 4882 | $http(options) |
| 4883 | .success(function(data, status, headers, config) { |
| 4884 | deferred.resolve(data); |
| 4885 | if (parameters.$cache !== undefined) { |
| 4886 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4887 | } |
| 4888 | }) |
| 4889 | .error(function(data, status, headers, config) { |
| 4890 | deferred.reject({ |
| 4891 | status: status, |
| 4892 | headers: headers, |
| 4893 | config: config, |
| 4894 | body: data |
| 4895 | }); |
| 4896 | }); |
| 4897 | |
| 4898 | return deferred.promise; |
| 4899 | }; |
| 4900 | /** |
| 4901 | * |
| 4902 | * @method |
| 4903 | * @name xoslib#Cord_User_List_POST |
| 4904 | * |
| 4905 | */ |
| 4906 | xoslib.prototype.Cord_User_List_POST = function(parameters) { |
| 4907 | if (parameters === undefined) { |
| 4908 | parameters = {}; |
| 4909 | } |
| 4910 | var deferred = $q.defer(); |
| 4911 | |
| 4912 | var domain = this.domain; |
| 4913 | var path = '/xoslib/corduser/'; |
| 4914 | |
| 4915 | var body; |
| 4916 | var queryParameters = {}; |
| 4917 | var headers = {}; |
| 4918 | var form = {}; |
| 4919 | |
| 4920 | if (parameters.$queryParameters) { |
| 4921 | Object.keys(parameters.$queryParameters) |
| 4922 | .forEach(function(parameterName) { |
| 4923 | var parameter = parameters.$queryParameters[parameterName]; |
| 4924 | queryParameters[parameterName] = parameter; |
| 4925 | }); |
| 4926 | } |
| 4927 | |
| 4928 | var url = domain + path; |
| 4929 | var options = { |
| 4930 | timeout: parameters.$timeout, |
| 4931 | method: 'POST', |
| 4932 | url: url, |
| 4933 | params: queryParameters, |
| 4934 | data: body, |
| 4935 | headers: headers |
| 4936 | }; |
| 4937 | if (Object.keys(form).length > 0) { |
| 4938 | options.data = form; |
| 4939 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 4940 | options.transformRequest = xoslib.transformRequest; |
| 4941 | } |
| 4942 | $http(options) |
| 4943 | .success(function(data, status, headers, config) { |
| 4944 | deferred.resolve(data); |
| 4945 | if (parameters.$cache !== undefined) { |
| 4946 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 4947 | } |
| 4948 | }) |
| 4949 | .error(function(data, status, headers, config) { |
| 4950 | deferred.reject({ |
| 4951 | status: status, |
| 4952 | headers: headers, |
| 4953 | config: config, |
| 4954 | body: data |
| 4955 | }); |
| 4956 | }); |
| 4957 | |
| 4958 | return deferred.promise; |
| 4959 | }; |
| 4960 | /** |
| 4961 | * |
| 4962 | * @method |
| 4963 | * @name xoslib#Volt_Tenant_Detail_GET |
| 4964 | * @param {string} pk - |
| 4965 | * |
| 4966 | */ |
| 4967 | xoslib.prototype.Volt_Tenant_Detail_GET = function(parameters) { |
| 4968 | if (parameters === undefined) { |
| 4969 | parameters = {}; |
| 4970 | } |
| 4971 | var deferred = $q.defer(); |
| 4972 | |
| 4973 | var domain = this.domain; |
| 4974 | var path = '/xoslib/volttenant/{pk}/'; |
| 4975 | |
| 4976 | var body; |
| 4977 | var queryParameters = {}; |
| 4978 | var headers = {}; |
| 4979 | var form = {}; |
| 4980 | |
| 4981 | path = path.replace('{pk}', parameters['pk']); |
| 4982 | |
| 4983 | if (parameters['pk'] === undefined) { |
| 4984 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 4985 | return deferred.promise; |
| 4986 | } |
| 4987 | |
| 4988 | if (parameters.$queryParameters) { |
| 4989 | Object.keys(parameters.$queryParameters) |
| 4990 | .forEach(function(parameterName) { |
| 4991 | var parameter = parameters.$queryParameters[parameterName]; |
| 4992 | queryParameters[parameterName] = parameter; |
| 4993 | }); |
| 4994 | } |
| 4995 | |
| 4996 | var url = domain + path; |
| 4997 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 4998 | if (cached !== undefined && parameters.$refresh !== true) { |
| 4999 | deferred.resolve(cached); |
| 5000 | return deferred.promise; |
| 5001 | } |
| 5002 | var options = { |
| 5003 | timeout: parameters.$timeout, |
| 5004 | method: 'GET', |
| 5005 | url: url, |
| 5006 | params: queryParameters, |
| 5007 | data: body, |
| 5008 | headers: headers |
| 5009 | }; |
| 5010 | if (Object.keys(form).length > 0) { |
| 5011 | options.data = form; |
| 5012 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5013 | options.transformRequest = xoslib.transformRequest; |
| 5014 | } |
| 5015 | $http(options) |
| 5016 | .success(function(data, status, headers, config) { |
| 5017 | deferred.resolve(data); |
| 5018 | if (parameters.$cache !== undefined) { |
| 5019 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5020 | } |
| 5021 | }) |
| 5022 | .error(function(data, status, headers, config) { |
| 5023 | deferred.reject({ |
| 5024 | status: status, |
| 5025 | headers: headers, |
| 5026 | config: config, |
| 5027 | body: data |
| 5028 | }); |
| 5029 | }); |
| 5030 | |
| 5031 | return deferred.promise; |
| 5032 | }; |
| 5033 | /** |
| 5034 | * |
| 5035 | * @method |
| 5036 | * @name xoslib#Volt_Tenant_Detail_PUT |
| 5037 | * @param {string} pk - |
| 5038 | * @param {string} provider_service - |
| 5039 | * @param {string} service_specific_id - |
| 5040 | * @param {string} vlan_id - |
| 5041 | * |
| 5042 | */ |
| 5043 | xoslib.prototype.Volt_Tenant_Detail_PUT = function(parameters) { |
| 5044 | if (parameters === undefined) { |
| 5045 | parameters = {}; |
| 5046 | } |
| 5047 | var deferred = $q.defer(); |
| 5048 | |
| 5049 | var domain = this.domain; |
| 5050 | var path = '/xoslib/volttenant/{pk}/'; |
| 5051 | |
| 5052 | var body; |
| 5053 | var queryParameters = {}; |
| 5054 | var headers = {}; |
| 5055 | var form = {}; |
| 5056 | |
| 5057 | path = path.replace('{pk}', parameters['pk']); |
| 5058 | |
| 5059 | if (parameters['pk'] === undefined) { |
| 5060 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5061 | return deferred.promise; |
| 5062 | } |
| 5063 | |
| 5064 | if (parameters['provider_service'] !== undefined) { |
| 5065 | form['provider_service'] = parameters['provider_service']; |
| 5066 | } |
| 5067 | |
| 5068 | if (parameters['provider_service'] === undefined) { |
| 5069 | deferred.reject(new Error('Missing required form parameter: provider_service')); |
| 5070 | return deferred.promise; |
| 5071 | } |
| 5072 | |
| 5073 | if (parameters['service_specific_id'] !== undefined) { |
| 5074 | form['service_specific_id'] = parameters['service_specific_id']; |
| 5075 | } |
| 5076 | |
| 5077 | if (parameters['service_specific_id'] === undefined) { |
| 5078 | deferred.reject(new Error('Missing required form parameter: service_specific_id')); |
| 5079 | return deferred.promise; |
| 5080 | } |
| 5081 | |
| 5082 | if (parameters['vlan_id'] !== undefined) { |
| 5083 | form['vlan_id'] = parameters['vlan_id']; |
| 5084 | } |
| 5085 | |
| 5086 | if (parameters['vlan_id'] === undefined) { |
| 5087 | deferred.reject(new Error('Missing required form parameter: vlan_id')); |
| 5088 | return deferred.promise; |
| 5089 | } |
| 5090 | |
| 5091 | if (parameters.$queryParameters) { |
| 5092 | Object.keys(parameters.$queryParameters) |
| 5093 | .forEach(function(parameterName) { |
| 5094 | var parameter = parameters.$queryParameters[parameterName]; |
| 5095 | queryParameters[parameterName] = parameter; |
| 5096 | }); |
| 5097 | } |
| 5098 | |
| 5099 | var url = domain + path; |
| 5100 | var options = { |
| 5101 | timeout: parameters.$timeout, |
| 5102 | method: 'PUT', |
| 5103 | url: url, |
| 5104 | params: queryParameters, |
| 5105 | data: body, |
| 5106 | headers: headers |
| 5107 | }; |
| 5108 | if (Object.keys(form).length > 0) { |
| 5109 | options.data = form; |
| 5110 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5111 | options.transformRequest = xoslib.transformRequest; |
| 5112 | } |
| 5113 | $http(options) |
| 5114 | .success(function(data, status, headers, config) { |
| 5115 | deferred.resolve(data); |
| 5116 | if (parameters.$cache !== undefined) { |
| 5117 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5118 | } |
| 5119 | }) |
| 5120 | .error(function(data, status, headers, config) { |
| 5121 | deferred.reject({ |
| 5122 | status: status, |
| 5123 | headers: headers, |
| 5124 | config: config, |
| 5125 | body: data |
| 5126 | }); |
| 5127 | }); |
| 5128 | |
| 5129 | return deferred.promise; |
| 5130 | }; |
| 5131 | /** |
| 5132 | * |
| 5133 | * @method |
| 5134 | * @name xoslib#Volt_Tenant_Detail_PATCH |
| 5135 | * @param {string} pk - |
| 5136 | * @param {string} provider_service - |
| 5137 | * @param {string} service_specific_id - |
| 5138 | * @param {string} vlan_id - |
| 5139 | * |
| 5140 | */ |
| 5141 | xoslib.prototype.Volt_Tenant_Detail_PATCH = function(parameters) { |
| 5142 | if (parameters === undefined) { |
| 5143 | parameters = {}; |
| 5144 | } |
| 5145 | var deferred = $q.defer(); |
| 5146 | |
| 5147 | var domain = this.domain; |
| 5148 | var path = '/xoslib/volttenant/{pk}/'; |
| 5149 | |
| 5150 | var body; |
| 5151 | var queryParameters = {}; |
| 5152 | var headers = {}; |
| 5153 | var form = {}; |
| 5154 | |
| 5155 | path = path.replace('{pk}', parameters['pk']); |
| 5156 | |
| 5157 | if (parameters['pk'] === undefined) { |
| 5158 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5159 | return deferred.promise; |
| 5160 | } |
| 5161 | |
| 5162 | if (parameters['provider_service'] !== undefined) { |
| 5163 | form['provider_service'] = parameters['provider_service']; |
| 5164 | } |
| 5165 | |
| 5166 | if (parameters['service_specific_id'] !== undefined) { |
| 5167 | form['service_specific_id'] = parameters['service_specific_id']; |
| 5168 | } |
| 5169 | |
| 5170 | if (parameters['vlan_id'] !== undefined) { |
| 5171 | form['vlan_id'] = parameters['vlan_id']; |
| 5172 | } |
| 5173 | |
| 5174 | if (parameters.$queryParameters) { |
| 5175 | Object.keys(parameters.$queryParameters) |
| 5176 | .forEach(function(parameterName) { |
| 5177 | var parameter = parameters.$queryParameters[parameterName]; |
| 5178 | queryParameters[parameterName] = parameter; |
| 5179 | }); |
| 5180 | } |
| 5181 | |
| 5182 | var url = domain + path; |
| 5183 | var options = { |
| 5184 | timeout: parameters.$timeout, |
| 5185 | method: 'PATCH', |
| 5186 | url: url, |
| 5187 | params: queryParameters, |
| 5188 | data: body, |
| 5189 | headers: headers |
| 5190 | }; |
| 5191 | if (Object.keys(form).length > 0) { |
| 5192 | options.data = form; |
| 5193 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5194 | options.transformRequest = xoslib.transformRequest; |
| 5195 | } |
| 5196 | $http(options) |
| 5197 | .success(function(data, status, headers, config) { |
| 5198 | deferred.resolve(data); |
| 5199 | if (parameters.$cache !== undefined) { |
| 5200 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5201 | } |
| 5202 | }) |
| 5203 | .error(function(data, status, headers, config) { |
| 5204 | deferred.reject({ |
| 5205 | status: status, |
| 5206 | headers: headers, |
| 5207 | config: config, |
| 5208 | body: data |
| 5209 | }); |
| 5210 | }); |
| 5211 | |
| 5212 | return deferred.promise; |
| 5213 | }; |
| 5214 | /** |
| 5215 | * |
| 5216 | * @method |
| 5217 | * @name xoslib#Volt_Tenant_Detail_DELETE |
| 5218 | * @param {string} pk - |
| 5219 | * |
| 5220 | */ |
| 5221 | xoslib.prototype.Volt_Tenant_Detail_DELETE = function(parameters) { |
| 5222 | if (parameters === undefined) { |
| 5223 | parameters = {}; |
| 5224 | } |
| 5225 | var deferred = $q.defer(); |
| 5226 | |
| 5227 | var domain = this.domain; |
| 5228 | var path = '/xoslib/volttenant/{pk}/'; |
| 5229 | |
| 5230 | var body; |
| 5231 | var queryParameters = {}; |
| 5232 | var headers = {}; |
| 5233 | var form = {}; |
| 5234 | |
| 5235 | path = path.replace('{pk}', parameters['pk']); |
| 5236 | |
| 5237 | if (parameters['pk'] === undefined) { |
| 5238 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5239 | return deferred.promise; |
| 5240 | } |
| 5241 | |
| 5242 | if (parameters.$queryParameters) { |
| 5243 | Object.keys(parameters.$queryParameters) |
| 5244 | .forEach(function(parameterName) { |
| 5245 | var parameter = parameters.$queryParameters[parameterName]; |
| 5246 | queryParameters[parameterName] = parameter; |
| 5247 | }); |
| 5248 | } |
| 5249 | |
| 5250 | var url = domain + path; |
| 5251 | var options = { |
| 5252 | timeout: parameters.$timeout, |
| 5253 | method: 'DELETE', |
| 5254 | url: url, |
| 5255 | params: queryParameters, |
| 5256 | data: body, |
| 5257 | headers: headers |
| 5258 | }; |
| 5259 | if (Object.keys(form).length > 0) { |
| 5260 | options.data = form; |
| 5261 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5262 | options.transformRequest = xoslib.transformRequest; |
| 5263 | } |
| 5264 | $http(options) |
| 5265 | .success(function(data, status, headers, config) { |
| 5266 | deferred.resolve(data); |
| 5267 | if (parameters.$cache !== undefined) { |
| 5268 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5269 | } |
| 5270 | }) |
| 5271 | .error(function(data, status, headers, config) { |
| 5272 | deferred.reject({ |
| 5273 | status: status, |
| 5274 | headers: headers, |
| 5275 | config: config, |
| 5276 | body: data |
| 5277 | }); |
| 5278 | }); |
| 5279 | |
| 5280 | return deferred.promise; |
| 5281 | }; |
| 5282 | /** |
| 5283 | * |
| 5284 | * @method |
| 5285 | * @name xoslib#Volt_Tenant_List_GET |
| 5286 | * |
| 5287 | */ |
| 5288 | xoslib.prototype.Volt_Tenant_List_GET = function(parameters) { |
| 5289 | if (parameters === undefined) { |
| 5290 | parameters = {}; |
| 5291 | } |
| 5292 | var deferred = $q.defer(); |
| 5293 | |
| 5294 | var domain = this.domain; |
| 5295 | var path = '/xoslib/volttenant/'; |
| 5296 | |
| 5297 | var body; |
| 5298 | var queryParameters = {}; |
| 5299 | var headers = {}; |
| 5300 | var form = {}; |
| 5301 | |
| 5302 | if (parameters.$queryParameters) { |
| 5303 | Object.keys(parameters.$queryParameters) |
| 5304 | .forEach(function(parameterName) { |
| 5305 | var parameter = parameters.$queryParameters[parameterName]; |
| 5306 | queryParameters[parameterName] = parameter; |
| 5307 | }); |
| 5308 | } |
| 5309 | |
| 5310 | var url = domain + path; |
| 5311 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 5312 | if (cached !== undefined && parameters.$refresh !== true) { |
| 5313 | deferred.resolve(cached); |
| 5314 | return deferred.promise; |
| 5315 | } |
| 5316 | var options = { |
| 5317 | timeout: parameters.$timeout, |
| 5318 | method: 'GET', |
| 5319 | url: url, |
| 5320 | params: queryParameters, |
| 5321 | data: body, |
| 5322 | headers: headers |
| 5323 | }; |
| 5324 | if (Object.keys(form).length > 0) { |
| 5325 | options.data = form; |
| 5326 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5327 | options.transformRequest = xoslib.transformRequest; |
| 5328 | } |
| 5329 | $http(options) |
| 5330 | .success(function(data, status, headers, config) { |
| 5331 | deferred.resolve(data); |
| 5332 | if (parameters.$cache !== undefined) { |
| 5333 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5334 | } |
| 5335 | }) |
| 5336 | .error(function(data, status, headers, config) { |
| 5337 | deferred.reject({ |
| 5338 | status: status, |
| 5339 | headers: headers, |
| 5340 | config: config, |
| 5341 | body: data |
| 5342 | }); |
| 5343 | }); |
| 5344 | |
| 5345 | return deferred.promise; |
| 5346 | }; |
| 5347 | /** |
| 5348 | * |
| 5349 | * @method |
| 5350 | * @name xoslib#Volt_Tenant_List_POST |
| 5351 | * @param {string} provider_service - |
| 5352 | * @param {string} service_specific_id - |
| 5353 | * @param {string} vlan_id - |
| 5354 | * |
| 5355 | */ |
| 5356 | xoslib.prototype.Volt_Tenant_List_POST = function(parameters) { |
| 5357 | if (parameters === undefined) { |
| 5358 | parameters = {}; |
| 5359 | } |
| 5360 | var deferred = $q.defer(); |
| 5361 | |
| 5362 | var domain = this.domain; |
| 5363 | var path = '/xoslib/volttenant/'; |
| 5364 | |
| 5365 | var body; |
| 5366 | var queryParameters = {}; |
| 5367 | var headers = {}; |
| 5368 | var form = {}; |
| 5369 | |
| 5370 | if (parameters['provider_service'] !== undefined) { |
| 5371 | form['provider_service'] = parameters['provider_service']; |
| 5372 | } |
| 5373 | |
| 5374 | if (parameters['provider_service'] === undefined) { |
| 5375 | deferred.reject(new Error('Missing required form parameter: provider_service')); |
| 5376 | return deferred.promise; |
| 5377 | } |
| 5378 | |
| 5379 | if (parameters['service_specific_id'] !== undefined) { |
| 5380 | form['service_specific_id'] = parameters['service_specific_id']; |
| 5381 | } |
| 5382 | |
| 5383 | if (parameters['service_specific_id'] === undefined) { |
| 5384 | deferred.reject(new Error('Missing required form parameter: service_specific_id')); |
| 5385 | return deferred.promise; |
| 5386 | } |
| 5387 | |
| 5388 | if (parameters['vlan_id'] !== undefined) { |
| 5389 | form['vlan_id'] = parameters['vlan_id']; |
| 5390 | } |
| 5391 | |
| 5392 | if (parameters['vlan_id'] === undefined) { |
| 5393 | deferred.reject(new Error('Missing required form parameter: vlan_id')); |
| 5394 | return deferred.promise; |
| 5395 | } |
| 5396 | |
| 5397 | if (parameters.$queryParameters) { |
| 5398 | Object.keys(parameters.$queryParameters) |
| 5399 | .forEach(function(parameterName) { |
| 5400 | var parameter = parameters.$queryParameters[parameterName]; |
| 5401 | queryParameters[parameterName] = parameter; |
| 5402 | }); |
| 5403 | } |
| 5404 | |
| 5405 | var url = domain + path; |
| 5406 | var options = { |
| 5407 | timeout: parameters.$timeout, |
| 5408 | method: 'POST', |
| 5409 | url: url, |
| 5410 | params: queryParameters, |
| 5411 | data: body, |
| 5412 | headers: headers |
| 5413 | }; |
| 5414 | if (Object.keys(form).length > 0) { |
| 5415 | options.data = form; |
| 5416 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5417 | options.transformRequest = xoslib.transformRequest; |
| 5418 | } |
| 5419 | $http(options) |
| 5420 | .success(function(data, status, headers, config) { |
| 5421 | deferred.resolve(data); |
| 5422 | if (parameters.$cache !== undefined) { |
| 5423 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5424 | } |
| 5425 | }) |
| 5426 | .error(function(data, status, headers, config) { |
| 5427 | deferred.reject({ |
| 5428 | status: status, |
| 5429 | headers: headers, |
| 5430 | config: config, |
| 5431 | body: data |
| 5432 | }); |
| 5433 | }); |
| 5434 | |
| 5435 | return deferred.promise; |
| 5436 | }; |
| 5437 | /** |
| 5438 | * |
| 5439 | * @method |
| 5440 | * @name xoslib#Slice_Plus_Detail_GET |
| 5441 | * @param {string} pk - |
| 5442 | * |
| 5443 | */ |
| 5444 | xoslib.prototype.Slice_Plus_Detail_GET = function(parameters) { |
| 5445 | if (parameters === undefined) { |
| 5446 | parameters = {}; |
| 5447 | } |
| 5448 | var deferred = $q.defer(); |
| 5449 | |
| 5450 | var domain = this.domain; |
| 5451 | var path = '/xoslib/slicesplus/{pk}/'; |
| 5452 | |
| 5453 | var body; |
| 5454 | var queryParameters = {}; |
| 5455 | var headers = {}; |
| 5456 | var form = {}; |
| 5457 | |
| 5458 | path = path.replace('{pk}', parameters['pk']); |
| 5459 | |
| 5460 | if (parameters['pk'] === undefined) { |
| 5461 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5462 | return deferred.promise; |
| 5463 | } |
| 5464 | |
| 5465 | if (parameters.$queryParameters) { |
| 5466 | Object.keys(parameters.$queryParameters) |
| 5467 | .forEach(function(parameterName) { |
| 5468 | var parameter = parameters.$queryParameters[parameterName]; |
| 5469 | queryParameters[parameterName] = parameter; |
| 5470 | }); |
| 5471 | } |
| 5472 | |
| 5473 | var url = domain + path; |
| 5474 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 5475 | if (cached !== undefined && parameters.$refresh !== true) { |
| 5476 | deferred.resolve(cached); |
| 5477 | return deferred.promise; |
| 5478 | } |
| 5479 | var options = { |
| 5480 | timeout: parameters.$timeout, |
| 5481 | method: 'GET', |
| 5482 | url: url, |
| 5483 | params: queryParameters, |
| 5484 | data: body, |
| 5485 | headers: headers |
| 5486 | }; |
| 5487 | if (Object.keys(form).length > 0) { |
| 5488 | options.data = form; |
| 5489 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5490 | options.transformRequest = xoslib.transformRequest; |
| 5491 | } |
| 5492 | $http(options) |
| 5493 | .success(function(data, status, headers, config) { |
| 5494 | deferred.resolve(data); |
| 5495 | if (parameters.$cache !== undefined) { |
| 5496 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5497 | } |
| 5498 | }) |
| 5499 | .error(function(data, status, headers, config) { |
| 5500 | deferred.reject({ |
| 5501 | status: status, |
| 5502 | headers: headers, |
| 5503 | config: config, |
| 5504 | body: data |
| 5505 | }); |
| 5506 | }); |
| 5507 | |
| 5508 | return deferred.promise; |
| 5509 | }; |
| 5510 | /** |
| 5511 | * |
| 5512 | * @method |
| 5513 | * @name xoslib#Slice_Plus_Detail_PUT |
| 5514 | * @param {string} pk - |
| 5515 | * @param {string} enacted - |
| 5516 | * @param {string} name - The Name of the Slice |
| 5517 | * @param {boolean} enabled - Status for this Slice |
| 5518 | * @param {boolean} omf_friendly - |
| 5519 | * @param {string} description - High level description of the slice and expected activities |
| 5520 | * @param {string} slice_url - |
| 5521 | * @param {string} site - The Site this Slice belongs to |
| 5522 | * @param {integer} max_instances - |
| 5523 | * @param {string} service - |
| 5524 | * @param {string} network - |
| 5525 | * @param {string} mount_data_sets - |
| 5526 | * @param {string} default_image - |
| 5527 | * @param {string} default_flavor - |
| 5528 | * @param {string} serviceClass - |
| 5529 | * @param {string} creator - |
| 5530 | * @param {string} network_ports - |
| 5531 | * @param {string} site_allocation - |
| 5532 | * @param {string} site_ready - |
| 5533 | * @param {string} users - |
| 5534 | * @param {string} user_names - |
| 5535 | * |
| 5536 | */ |
| 5537 | xoslib.prototype.Slice_Plus_Detail_PUT = function(parameters) { |
| 5538 | if (parameters === undefined) { |
| 5539 | parameters = {}; |
| 5540 | } |
| 5541 | var deferred = $q.defer(); |
| 5542 | |
| 5543 | var domain = this.domain; |
| 5544 | var path = '/xoslib/slicesplus/{pk}/'; |
| 5545 | |
| 5546 | var body; |
| 5547 | var queryParameters = {}; |
| 5548 | var headers = {}; |
| 5549 | var form = {}; |
| 5550 | |
| 5551 | path = path.replace('{pk}', parameters['pk']); |
| 5552 | |
| 5553 | if (parameters['pk'] === undefined) { |
| 5554 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5555 | return deferred.promise; |
| 5556 | } |
| 5557 | |
| 5558 | if (parameters['enacted'] !== undefined) { |
| 5559 | form['enacted'] = parameters['enacted']; |
| 5560 | } |
| 5561 | |
| 5562 | if (parameters['name'] !== undefined) { |
| 5563 | form['name'] = parameters['name']; |
| 5564 | } |
| 5565 | |
| 5566 | if (parameters['name'] === undefined) { |
| 5567 | deferred.reject(new Error('Missing required form parameter: name')); |
| 5568 | return deferred.promise; |
| 5569 | } |
| 5570 | |
| 5571 | if (parameters['enabled'] !== undefined) { |
| 5572 | form['enabled'] = parameters['enabled']; |
| 5573 | } |
| 5574 | |
| 5575 | if (parameters['omf_friendly'] !== undefined) { |
| 5576 | form['omf_friendly'] = parameters['omf_friendly']; |
| 5577 | } |
| 5578 | |
| 5579 | if (parameters['description'] !== undefined) { |
| 5580 | form['description'] = parameters['description']; |
| 5581 | } |
| 5582 | |
| 5583 | if (parameters['slice_url'] !== undefined) { |
| 5584 | form['slice_url'] = parameters['slice_url']; |
| 5585 | } |
| 5586 | |
| 5587 | if (parameters['site'] !== undefined) { |
| 5588 | form['site'] = parameters['site']; |
| 5589 | } |
| 5590 | |
| 5591 | if (parameters['site'] === undefined) { |
| 5592 | deferred.reject(new Error('Missing required form parameter: site')); |
| 5593 | return deferred.promise; |
| 5594 | } |
| 5595 | |
| 5596 | if (parameters['max_instances'] !== undefined) { |
| 5597 | form['max_instances'] = parameters['max_instances']; |
| 5598 | } |
| 5599 | |
| 5600 | if (parameters['max_instances'] === undefined) { |
| 5601 | deferred.reject(new Error('Missing required form parameter: max_instances')); |
| 5602 | return deferred.promise; |
| 5603 | } |
| 5604 | |
| 5605 | if (parameters['service'] !== undefined) { |
| 5606 | form['service'] = parameters['service']; |
| 5607 | } |
| 5608 | |
| 5609 | if (parameters['network'] !== undefined) { |
| 5610 | form['network'] = parameters['network']; |
| 5611 | } |
| 5612 | |
| 5613 | if (parameters['mount_data_sets'] !== undefined) { |
| 5614 | form['mount_data_sets'] = parameters['mount_data_sets']; |
| 5615 | } |
| 5616 | |
| 5617 | if (parameters['default_image'] !== undefined) { |
| 5618 | form['default_image'] = parameters['default_image']; |
| 5619 | } |
| 5620 | |
| 5621 | if (parameters['default_flavor'] !== undefined) { |
| 5622 | form['default_flavor'] = parameters['default_flavor']; |
| 5623 | } |
| 5624 | |
| 5625 | if (parameters['serviceClass'] !== undefined) { |
| 5626 | form['serviceClass'] = parameters['serviceClass']; |
| 5627 | } |
| 5628 | |
| 5629 | if (parameters['creator'] !== undefined) { |
| 5630 | form['creator'] = parameters['creator']; |
| 5631 | } |
| 5632 | |
| 5633 | if (parameters['network_ports'] !== undefined) { |
| 5634 | form['network_ports'] = parameters['network_ports']; |
| 5635 | } |
| 5636 | |
| 5637 | if (parameters['site_allocation'] !== undefined) { |
| 5638 | form['site_allocation'] = parameters['site_allocation']; |
| 5639 | } |
| 5640 | |
| 5641 | if (parameters['site_ready'] !== undefined) { |
| 5642 | form['site_ready'] = parameters['site_ready']; |
| 5643 | } |
| 5644 | |
| 5645 | if (parameters['users'] !== undefined) { |
| 5646 | form['users'] = parameters['users']; |
| 5647 | } |
| 5648 | |
| 5649 | if (parameters['user_names'] !== undefined) { |
| 5650 | form['user_names'] = parameters['user_names']; |
| 5651 | } |
| 5652 | |
| 5653 | if (parameters.$queryParameters) { |
| 5654 | Object.keys(parameters.$queryParameters) |
| 5655 | .forEach(function(parameterName) { |
| 5656 | var parameter = parameters.$queryParameters[parameterName]; |
| 5657 | queryParameters[parameterName] = parameter; |
| 5658 | }); |
| 5659 | } |
| 5660 | |
| 5661 | var url = domain + path; |
| 5662 | var options = { |
| 5663 | timeout: parameters.$timeout, |
| 5664 | method: 'PUT', |
| 5665 | url: url, |
| 5666 | params: queryParameters, |
| 5667 | data: body, |
| 5668 | headers: headers |
| 5669 | }; |
| 5670 | if (Object.keys(form).length > 0) { |
| 5671 | options.data = form; |
| 5672 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5673 | options.transformRequest = xoslib.transformRequest; |
| 5674 | } |
| 5675 | $http(options) |
| 5676 | .success(function(data, status, headers, config) { |
| 5677 | deferred.resolve(data); |
| 5678 | if (parameters.$cache !== undefined) { |
| 5679 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5680 | } |
| 5681 | }) |
| 5682 | .error(function(data, status, headers, config) { |
| 5683 | deferred.reject({ |
| 5684 | status: status, |
| 5685 | headers: headers, |
| 5686 | config: config, |
| 5687 | body: data |
| 5688 | }); |
| 5689 | }); |
| 5690 | |
| 5691 | return deferred.promise; |
| 5692 | }; |
| 5693 | /** |
| 5694 | * |
| 5695 | * @method |
| 5696 | * @name xoslib#Slice_Plus_Detail_PATCH |
| 5697 | * @param {string} pk - |
| 5698 | * @param {string} enacted - |
| 5699 | * @param {string} name - The Name of the Slice |
| 5700 | * @param {boolean} enabled - Status for this Slice |
| 5701 | * @param {boolean} omf_friendly - |
| 5702 | * @param {string} description - High level description of the slice and expected activities |
| 5703 | * @param {string} slice_url - |
| 5704 | * @param {string} site - The Site this Slice belongs to |
| 5705 | * @param {integer} max_instances - |
| 5706 | * @param {string} service - |
| 5707 | * @param {string} network - |
| 5708 | * @param {string} mount_data_sets - |
| 5709 | * @param {string} default_image - |
| 5710 | * @param {string} default_flavor - |
| 5711 | * @param {string} serviceClass - |
| 5712 | * @param {string} creator - |
| 5713 | * @param {string} network_ports - |
| 5714 | * @param {string} site_allocation - |
| 5715 | * @param {string} site_ready - |
| 5716 | * @param {string} users - |
| 5717 | * @param {string} user_names - |
| 5718 | * |
| 5719 | */ |
| 5720 | xoslib.prototype.Slice_Plus_Detail_PATCH = function(parameters) { |
| 5721 | if (parameters === undefined) { |
| 5722 | parameters = {}; |
| 5723 | } |
| 5724 | var deferred = $q.defer(); |
| 5725 | |
| 5726 | var domain = this.domain; |
| 5727 | var path = '/xoslib/slicesplus/{pk}/'; |
| 5728 | |
| 5729 | var body; |
| 5730 | var queryParameters = {}; |
| 5731 | var headers = {}; |
| 5732 | var form = {}; |
| 5733 | |
| 5734 | path = path.replace('{pk}', parameters['pk']); |
| 5735 | |
| 5736 | if (parameters['pk'] === undefined) { |
| 5737 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5738 | return deferred.promise; |
| 5739 | } |
| 5740 | |
| 5741 | if (parameters['enacted'] !== undefined) { |
| 5742 | form['enacted'] = parameters['enacted']; |
| 5743 | } |
| 5744 | |
| 5745 | if (parameters['name'] !== undefined) { |
| 5746 | form['name'] = parameters['name']; |
| 5747 | } |
| 5748 | |
| 5749 | if (parameters['enabled'] !== undefined) { |
| 5750 | form['enabled'] = parameters['enabled']; |
| 5751 | } |
| 5752 | |
| 5753 | if (parameters['omf_friendly'] !== undefined) { |
| 5754 | form['omf_friendly'] = parameters['omf_friendly']; |
| 5755 | } |
| 5756 | |
| 5757 | if (parameters['description'] !== undefined) { |
| 5758 | form['description'] = parameters['description']; |
| 5759 | } |
| 5760 | |
| 5761 | if (parameters['slice_url'] !== undefined) { |
| 5762 | form['slice_url'] = parameters['slice_url']; |
| 5763 | } |
| 5764 | |
| 5765 | if (parameters['site'] !== undefined) { |
| 5766 | form['site'] = parameters['site']; |
| 5767 | } |
| 5768 | |
| 5769 | if (parameters['max_instances'] !== undefined) { |
| 5770 | form['max_instances'] = parameters['max_instances']; |
| 5771 | } |
| 5772 | |
| 5773 | if (parameters['service'] !== undefined) { |
| 5774 | form['service'] = parameters['service']; |
| 5775 | } |
| 5776 | |
| 5777 | if (parameters['network'] !== undefined) { |
| 5778 | form['network'] = parameters['network']; |
| 5779 | } |
| 5780 | |
| 5781 | if (parameters['mount_data_sets'] !== undefined) { |
| 5782 | form['mount_data_sets'] = parameters['mount_data_sets']; |
| 5783 | } |
| 5784 | |
| 5785 | if (parameters['default_image'] !== undefined) { |
| 5786 | form['default_image'] = parameters['default_image']; |
| 5787 | } |
| 5788 | |
| 5789 | if (parameters['default_flavor'] !== undefined) { |
| 5790 | form['default_flavor'] = parameters['default_flavor']; |
| 5791 | } |
| 5792 | |
| 5793 | if (parameters['serviceClass'] !== undefined) { |
| 5794 | form['serviceClass'] = parameters['serviceClass']; |
| 5795 | } |
| 5796 | |
| 5797 | if (parameters['creator'] !== undefined) { |
| 5798 | form['creator'] = parameters['creator']; |
| 5799 | } |
| 5800 | |
| 5801 | if (parameters['network_ports'] !== undefined) { |
| 5802 | form['network_ports'] = parameters['network_ports']; |
| 5803 | } |
| 5804 | |
| 5805 | if (parameters['site_allocation'] !== undefined) { |
| 5806 | form['site_allocation'] = parameters['site_allocation']; |
| 5807 | } |
| 5808 | |
| 5809 | if (parameters['site_ready'] !== undefined) { |
| 5810 | form['site_ready'] = parameters['site_ready']; |
| 5811 | } |
| 5812 | |
| 5813 | if (parameters['users'] !== undefined) { |
| 5814 | form['users'] = parameters['users']; |
| 5815 | } |
| 5816 | |
| 5817 | if (parameters['user_names'] !== undefined) { |
| 5818 | form['user_names'] = parameters['user_names']; |
| 5819 | } |
| 5820 | |
| 5821 | if (parameters.$queryParameters) { |
| 5822 | Object.keys(parameters.$queryParameters) |
| 5823 | .forEach(function(parameterName) { |
| 5824 | var parameter = parameters.$queryParameters[parameterName]; |
| 5825 | queryParameters[parameterName] = parameter; |
| 5826 | }); |
| 5827 | } |
| 5828 | |
| 5829 | var url = domain + path; |
| 5830 | var options = { |
| 5831 | timeout: parameters.$timeout, |
| 5832 | method: 'PATCH', |
| 5833 | url: url, |
| 5834 | params: queryParameters, |
| 5835 | data: body, |
| 5836 | headers: headers |
| 5837 | }; |
| 5838 | if (Object.keys(form).length > 0) { |
| 5839 | options.data = form; |
| 5840 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5841 | options.transformRequest = xoslib.transformRequest; |
| 5842 | } |
| 5843 | $http(options) |
| 5844 | .success(function(data, status, headers, config) { |
| 5845 | deferred.resolve(data); |
| 5846 | if (parameters.$cache !== undefined) { |
| 5847 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5848 | } |
| 5849 | }) |
| 5850 | .error(function(data, status, headers, config) { |
| 5851 | deferred.reject({ |
| 5852 | status: status, |
| 5853 | headers: headers, |
| 5854 | config: config, |
| 5855 | body: data |
| 5856 | }); |
| 5857 | }); |
| 5858 | |
| 5859 | return deferred.promise; |
| 5860 | }; |
| 5861 | /** |
| 5862 | * |
| 5863 | * @method |
| 5864 | * @name xoslib#Slice_Plus_Detail_DELETE |
| 5865 | * @param {string} pk - |
| 5866 | * |
| 5867 | */ |
| 5868 | xoslib.prototype.Slice_Plus_Detail_DELETE = function(parameters) { |
| 5869 | if (parameters === undefined) { |
| 5870 | parameters = {}; |
| 5871 | } |
| 5872 | var deferred = $q.defer(); |
| 5873 | |
| 5874 | var domain = this.domain; |
| 5875 | var path = '/xoslib/slicesplus/{pk}/'; |
| 5876 | |
| 5877 | var body; |
| 5878 | var queryParameters = {}; |
| 5879 | var headers = {}; |
| 5880 | var form = {}; |
| 5881 | |
| 5882 | path = path.replace('{pk}', parameters['pk']); |
| 5883 | |
| 5884 | if (parameters['pk'] === undefined) { |
| 5885 | deferred.reject(new Error('Missing required path parameter: pk')); |
| 5886 | return deferred.promise; |
| 5887 | } |
| 5888 | |
| 5889 | if (parameters.$queryParameters) { |
| 5890 | Object.keys(parameters.$queryParameters) |
| 5891 | .forEach(function(parameterName) { |
| 5892 | var parameter = parameters.$queryParameters[parameterName]; |
| 5893 | queryParameters[parameterName] = parameter; |
| 5894 | }); |
| 5895 | } |
| 5896 | |
| 5897 | var url = domain + path; |
| 5898 | var options = { |
| 5899 | timeout: parameters.$timeout, |
| 5900 | method: 'DELETE', |
| 5901 | url: url, |
| 5902 | params: queryParameters, |
| 5903 | data: body, |
| 5904 | headers: headers |
| 5905 | }; |
| 5906 | if (Object.keys(form).length > 0) { |
| 5907 | options.data = form; |
| 5908 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5909 | options.transformRequest = xoslib.transformRequest; |
| 5910 | } |
| 5911 | $http(options) |
| 5912 | .success(function(data, status, headers, config) { |
| 5913 | deferred.resolve(data); |
| 5914 | if (parameters.$cache !== undefined) { |
| 5915 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5916 | } |
| 5917 | }) |
| 5918 | .error(function(data, status, headers, config) { |
| 5919 | deferred.reject({ |
| 5920 | status: status, |
| 5921 | headers: headers, |
| 5922 | config: config, |
| 5923 | body: data |
| 5924 | }); |
| 5925 | }); |
| 5926 | |
| 5927 | return deferred.promise; |
| 5928 | }; |
| 5929 | /** |
| 5930 | * |
| 5931 | * @method |
| 5932 | * @name xoslib#Slice_Plus_List_GET |
| 5933 | * |
| 5934 | */ |
| 5935 | xoslib.prototype.Slice_Plus_List_GET = function(parameters) { |
| 5936 | if (parameters === undefined) { |
| 5937 | parameters = {}; |
| 5938 | } |
| 5939 | var deferred = $q.defer(); |
| 5940 | |
| 5941 | var domain = this.domain; |
| 5942 | var path = '/xoslib/slicesplus/'; |
| 5943 | |
| 5944 | var body; |
| 5945 | var queryParameters = {}; |
| 5946 | var headers = {}; |
| 5947 | var form = {}; |
| 5948 | |
| 5949 | if (parameters.$queryParameters) { |
| 5950 | Object.keys(parameters.$queryParameters) |
| 5951 | .forEach(function(parameterName) { |
| 5952 | var parameter = parameters.$queryParameters[parameterName]; |
| 5953 | queryParameters[parameterName] = parameter; |
| 5954 | }); |
| 5955 | } |
| 5956 | |
| 5957 | var url = domain + path; |
| 5958 | var cached = parameters.$cache && parameters.$cache.get(url); |
| 5959 | if (cached !== undefined && parameters.$refresh !== true) { |
| 5960 | deferred.resolve(cached); |
| 5961 | return deferred.promise; |
| 5962 | } |
| 5963 | var options = { |
| 5964 | timeout: parameters.$timeout, |
| 5965 | method: 'GET', |
| 5966 | url: url, |
| 5967 | params: queryParameters, |
| 5968 | data: body, |
| 5969 | headers: headers |
| 5970 | }; |
| 5971 | if (Object.keys(form).length > 0) { |
| 5972 | options.data = form; |
| 5973 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 5974 | options.transformRequest = xoslib.transformRequest; |
| 5975 | } |
| 5976 | $http(options) |
| 5977 | .success(function(data, status, headers, config) { |
| 5978 | deferred.resolve(data); |
| 5979 | if (parameters.$cache !== undefined) { |
| 5980 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 5981 | } |
| 5982 | }) |
| 5983 | .error(function(data, status, headers, config) { |
| 5984 | deferred.reject({ |
| 5985 | status: status, |
| 5986 | headers: headers, |
| 5987 | config: config, |
| 5988 | body: data |
| 5989 | }); |
| 5990 | }); |
| 5991 | |
| 5992 | return deferred.promise; |
| 5993 | }; |
| 5994 | /** |
| 5995 | * |
| 5996 | * @method |
| 5997 | * @name xoslib#Slice_Plus_List_POST |
| 5998 | * @param {string} enacted - |
| 5999 | * @param {string} name - The Name of the Slice |
| 6000 | * @param {boolean} enabled - Status for this Slice |
| 6001 | * @param {boolean} omf_friendly - |
| 6002 | * @param {string} description - High level description of the slice and expected activities |
| 6003 | * @param {string} slice_url - |
| 6004 | * @param {string} site - The Site this Slice belongs to |
| 6005 | * @param {integer} max_instances - |
| 6006 | * @param {string} service - |
| 6007 | * @param {string} network - |
| 6008 | * @param {string} mount_data_sets - |
| 6009 | * @param {string} default_image - |
| 6010 | * @param {string} default_flavor - |
| 6011 | * @param {string} serviceClass - |
| 6012 | * @param {string} creator - |
| 6013 | * @param {string} network_ports - |
| 6014 | * @param {string} site_allocation - |
| 6015 | * @param {string} site_ready - |
| 6016 | * @param {string} users - |
| 6017 | * @param {string} user_names - |
| 6018 | * |
| 6019 | */ |
| 6020 | xoslib.prototype.Slice_Plus_List_POST = function(parameters) { |
| 6021 | if (parameters === undefined) { |
| 6022 | parameters = {}; |
| 6023 | } |
| 6024 | var deferred = $q.defer(); |
| 6025 | |
| 6026 | var domain = this.domain; |
| 6027 | var path = '/xoslib/slicesplus/'; |
| 6028 | |
| 6029 | var body; |
| 6030 | var queryParameters = {}; |
| 6031 | var headers = {}; |
| 6032 | var form = {}; |
| 6033 | |
| 6034 | if (parameters['enacted'] !== undefined) { |
| 6035 | form['enacted'] = parameters['enacted']; |
| 6036 | } |
| 6037 | |
| 6038 | if (parameters['name'] !== undefined) { |
| 6039 | form['name'] = parameters['name']; |
| 6040 | } |
| 6041 | |
| 6042 | if (parameters['name'] === undefined) { |
| 6043 | deferred.reject(new Error('Missing required form parameter: name')); |
| 6044 | return deferred.promise; |
| 6045 | } |
| 6046 | |
| 6047 | if (parameters['enabled'] !== undefined) { |
| 6048 | form['enabled'] = parameters['enabled']; |
| 6049 | } |
| 6050 | |
| 6051 | if (parameters['omf_friendly'] !== undefined) { |
| 6052 | form['omf_friendly'] = parameters['omf_friendly']; |
| 6053 | } |
| 6054 | |
| 6055 | if (parameters['description'] !== undefined) { |
| 6056 | form['description'] = parameters['description']; |
| 6057 | } |
| 6058 | |
| 6059 | if (parameters['slice_url'] !== undefined) { |
| 6060 | form['slice_url'] = parameters['slice_url']; |
| 6061 | } |
| 6062 | |
| 6063 | if (parameters['site'] !== undefined) { |
| 6064 | form['site'] = parameters['site']; |
| 6065 | } |
| 6066 | |
| 6067 | if (parameters['site'] === undefined) { |
| 6068 | deferred.reject(new Error('Missing required form parameter: site')); |
| 6069 | return deferred.promise; |
| 6070 | } |
| 6071 | |
| 6072 | if (parameters['max_instances'] !== undefined) { |
| 6073 | form['max_instances'] = parameters['max_instances']; |
| 6074 | } |
| 6075 | |
| 6076 | if (parameters['max_instances'] === undefined) { |
| 6077 | deferred.reject(new Error('Missing required form parameter: max_instances')); |
| 6078 | return deferred.promise; |
| 6079 | } |
| 6080 | |
| 6081 | if (parameters['service'] !== undefined) { |
| 6082 | form['service'] = parameters['service']; |
| 6083 | } |
| 6084 | |
| 6085 | if (parameters['network'] !== undefined) { |
| 6086 | form['network'] = parameters['network']; |
| 6087 | } |
| 6088 | |
| 6089 | if (parameters['mount_data_sets'] !== undefined) { |
| 6090 | form['mount_data_sets'] = parameters['mount_data_sets']; |
| 6091 | } |
| 6092 | |
| 6093 | if (parameters['default_image'] !== undefined) { |
| 6094 | form['default_image'] = parameters['default_image']; |
| 6095 | } |
| 6096 | |
| 6097 | if (parameters['default_flavor'] !== undefined) { |
| 6098 | form['default_flavor'] = parameters['default_flavor']; |
| 6099 | } |
| 6100 | |
| 6101 | if (parameters['serviceClass'] !== undefined) { |
| 6102 | form['serviceClass'] = parameters['serviceClass']; |
| 6103 | } |
| 6104 | |
| 6105 | if (parameters['creator'] !== undefined) { |
| 6106 | form['creator'] = parameters['creator']; |
| 6107 | } |
| 6108 | |
| 6109 | if (parameters['network_ports'] !== undefined) { |
| 6110 | form['network_ports'] = parameters['network_ports']; |
| 6111 | } |
| 6112 | |
| 6113 | if (parameters['site_allocation'] !== undefined) { |
| 6114 | form['site_allocation'] = parameters['site_allocation']; |
| 6115 | } |
| 6116 | |
| 6117 | if (parameters['site_ready'] !== undefined) { |
| 6118 | form['site_ready'] = parameters['site_ready']; |
| 6119 | } |
| 6120 | |
| 6121 | if (parameters['users'] !== undefined) { |
| 6122 | form['users'] = parameters['users']; |
| 6123 | } |
| 6124 | |
| 6125 | if (parameters['user_names'] !== undefined) { |
| 6126 | form['user_names'] = parameters['user_names']; |
| 6127 | } |
| 6128 | |
| 6129 | if (parameters.$queryParameters) { |
| 6130 | Object.keys(parameters.$queryParameters) |
| 6131 | .forEach(function(parameterName) { |
| 6132 | var parameter = parameters.$queryParameters[parameterName]; |
| 6133 | queryParameters[parameterName] = parameter; |
| 6134 | }); |
| 6135 | } |
| 6136 | |
| 6137 | var url = domain + path; |
| 6138 | var options = { |
| 6139 | timeout: parameters.$timeout, |
| 6140 | method: 'POST', |
| 6141 | url: url, |
| 6142 | params: queryParameters, |
| 6143 | data: body, |
| 6144 | headers: headers |
| 6145 | }; |
| 6146 | if (Object.keys(form).length > 0) { |
| 6147 | options.data = form; |
| 6148 | options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 6149 | options.transformRequest = xoslib.transformRequest; |
| 6150 | } |
| 6151 | $http(options) |
| 6152 | .success(function(data, status, headers, config) { |
| 6153 | deferred.resolve(data); |
| 6154 | if (parameters.$cache !== undefined) { |
| 6155 | parameters.$cache.put(url, data, parameters.$cacheItemOpts ? parameters.$cacheItemOpts : {}); |
| 6156 | } |
| 6157 | }) |
| 6158 | .error(function(data, status, headers, config) { |
| 6159 | deferred.reject({ |
| 6160 | status: status, |
| 6161 | headers: headers, |
| 6162 | config: config, |
| 6163 | body: data |
| 6164 | }); |
| 6165 | }); |
| 6166 | |
| 6167 | return deferred.promise; |
| 6168 | }; |
| 6169 | |
| 6170 | return xoslib; |
| 6171 | })(); |
| 6172 | |
| 6173 | return xoslib; |
| 6174 | }]); |