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