Module slb_template
[hide private]
[frames] | no frames]

Source Code for Module slb_template

   1  # -*- encoding: utf8 -*-
 
   2  """
 
   3      SLB Template module:  aXAPI template configuration implementation.
 
   4          Support the object-oriented interface for the SLB templates such as:
 
   5              TemplateSmtp:            
 
   6              TemplateCache:            
 
   7              TemplateVirtualServer:    
 
   8              TemplateVipPort:            
 
   9              TemplateServer:
 
  10              TemplateServerPort
 
  11              TemplateHttp
 
  12              TemplatePbslb
 
  13              TemplateSip
 
  14              TemplateRtsp
 
  15              TemplateConnReuse
 
  16              TemplateTcp
 
  17              TemplateUdp
 
  18              TemplateCookiePersist
 
  19              TemplateSourceIpPersist
 
  20              TemplateDestinationIp
 
  21              TemplateSslPersist
 
  22              TemplateTcpProxy
 
  23              TemplateDns
 
  24              TemplateDiameter
 
  25      
 
  26      Author : Richard Zhang, A10 Networks (c)
 
  27      email  : rzhang@a10networks.com
 
  28      Date   : 03/07/2012
 
  29  """ 
  30  
 
  31  import method_call 
  32  from  base import AxObject, AxAPIError 
33 34 -class TemplateSmtp(AxObject):
35 """ 36 Implementation of the aXAPI slb.template.smtp.* method to 37 manage the SLB SMTP template as getAll/create/delete/update 38 39 Usage: 40 # SMTP template with options: 41 # name (required) 42 # starttls STARTTLS, disabled(0), enforced(2) or optional(1) 43 # EXPN SMTP command EXPN, enabled(0) or disabled(1) 44 # TURN SMTP command TURN, enabled(0) or disabled(1) 45 # VRFY SMTP command VRFY, enabled(0) or disabled(1) 46 # server_domain server domain 47 # service_ready_message service ready message 48 # client_domain_switching_list tag for the collection of client switchings 49 # client_domain client domain 50 # service_group service group name 51 # match_type match type, contains(0), starts with(1), ends with(2) 52 53 # Example: create a smtp template like 54 # ! 55 # slb template smtp my_smpt_temp1 56 # client-domain-switching contains domain1 service-group sg1 57 # ! 58 smtp = TemplateSmtp(name="my_smpt_templ") 59 smtp.client_domain_switching_list = [{"client_domain": "domain1", "service_group": "sg1", "match_type": 0}] 60 smtp.create() 61 # get all SMTP templates 62 a_list = TemplateSmtp.getAll() 63 for aSmtp in a_list: 64 # use aSmtp here 65 ... 66 """ 67 68 __display__ = ["name"] 69 __obj_name__ = 'smtp_template' 70 __xml_convrt__ = {"smtp_template_list": "smtp_template", "client_domain_switching_list": "client_domain_switching"} 71 72 @staticmethod
73 - def getAll():
74 """ method : slb.template.smtp.getAll 75 Returns a list of SMTP template in TemplateSmtp instance. 76 """ 77 try: 78 res = method_call.call_api(TemplateSmtp(), method = "slb.template.smtp.getAll", format = "url") 79 smtp_list = [] 80 for item in res["smtp_template_list"]: 81 smtp_list.append( TemplateSmtp(**item) ) 82 return smtp_list 83 except AxAPIError: 84 return None
85 86 @staticmethod
87 - def searchByName(name):
88 """ method: slb.template.smtp.search 89 Search the SMTP template by given name. 90 """ 91 try: 92 r = method_call.call_api(TemplateSmtp(), method = "slb.template.smtp.search", name = name, format = "url") 93 return TemplateSmtp(**r[TemplateSmtp.__obj_name__]) 94 except AxAPIError: 95 return None
96
97 - def create(self):
98 """ method: slb.template.smtp.create 99 Create the SMTP template. 100 """ 101 try: 102 method_call.call_api(self, method = "slb.template.smtp.create", format = "url", post_data = self.getRequestPostDataXml()) 103 return 0 104 except AxAPIError, e: 105 return e.code
106
107 - def delete(self):
108 """ method: slb.template.smtp.delete 109 Delete the SMTP template. 110 """ 111 try: 112 method_call.call_api(self, method = "slb.template.smtp.delete", format = "url", name = self.name) 113 return 0 114 except AxAPIError, e: 115 return e.code
116
117 - def update(self):
118 """ method: slb.template.smtp.update 119 Update the SMTP template. 120 """ 121 try: 122 method_call.call_api(self, method = "slb.template.smtp.update", format = "url", post_data = self.getRequestPostDataXml()) 123 return 0 124 except AxAPIError, e: 125 return e.code
126
127 -class TemplateCache(AxObject):
128 """ 129 Implementation of the aXAPI slb.template.cache.* method to 130 manage the SLB cache template as getAll/searchByName/create/delete/update 131 132 Usage: 133 # cache template with options: 134 # name (required) cache template name 135 # age (second) 136 # max_cache max cache size (MB) 137 # min_content min content size (Bytes) 138 # max_content max content size (Bytes) 139 # rep_policy least frequently used(0) 140 # acc_rel_req accept reload request, disabled(0) or enabled(1) 141 # veri_host verify host, disabled(0) or enabled(1) 142 # def_pol_no_cache default policy no cache, disabled(0) or enabled(1) 143 # insert_age insert age, disabled(0) or enabled(1) 144 # insert_via insert via, disabled(0) or enabled(1) 145 # policy_list XML tag for the collection of policys 146 # uri URI 147 # action cache(0), no cache(1) or invalidate(2) 148 # duration duration (second), only when act is cache(0) 149 # pattern only when act is invalidate(2) 150 151 # Example: create a cache template 152 # ! 153 # slb template cache my_cache_templ1 154 # policy uri abc nocache 155 # policy uri 123 nocache 156 # ! 157 cache1 = TemplateRamCache(name="my_cache_templ1") 158 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 159 cache1.create() 160 # get all cache templates 161 caches = TemplateRamCache.getAll() 162 for e in caches: 163 print e 164 # use aCache here 165 ... 166 """ 167 168 __display__ = ["name"] 169 __obj_name__ = 'cache_template' 170 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 171 172 @staticmethod
173 - def getAll():
174 """ method : slb.template.cache.getAll 175 Returns a list of cache template in TemplateCache instance. 176 """ 177 try: 178 res = method_call.call_api(TemplateCache(), method = "slb.template.cache.getAll", format = "url") 179 a_list = [] 180 for item in res["cache_template_list"]: 181 a_list.append( TemplateCache(**item) ) 182 return a_list 183 except AxAPIError: 184 return None
185 186 @staticmethod
187 - def searchByName(name):
188 """ method: slb.template.cache.search 189 Search the cache template by given name. 190 """ 191 try: 192 r = method_call.call_api(TemplateCache(), method = "slb.template.cache.search", name = name, format = "url") 193 return TemplateCache(**r[TemplateCache.__obj_name__]) 194 except AxAPIError: 195 return None
196
197 - def create(self):
198 """ method: slb.template.cache.create 199 Create the cache template. 200 """ 201 try: 202 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 203 return 0 204 except AxAPIError, e: 205 return e.code
206
207 - def delete(self):
208 """ method: slb.template.cache.delete 209 Delete the cache template. 210 """ 211 try: 212 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 213 return 0 214 except AxAPIError, e: 215 return e.code
216
217 - def update(self):
218 """ method: slb.template.cache.update 219 Update the cache template. 220 """ 221 try: 222 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 223 return 0 224 except AxAPIError, e: 225 return e.code
226
227 -class TemplateVirtualServer(AxObject):
228 """ 229 Implementation of the aXAPI slb.template.cache.* method to 230 manage the SLB virtual server template as getAll/searchByName/create/delete/update 231 232 Usage: 233 # cache template with options: 234 # name (required) cache template name 235 236 # Example: create a cache template 237 # ! 238 # slb template cache my_cache_templ1 239 # policy uri abc nocache 240 # policy uri 123 nocache 241 # ! 242 cache1 = TemplateRamCache(name="my_cache_templ1") 243 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 244 cache1.create() 245 # get all cache templates 246 caches = TemplateRamCache.getAll() 247 for e in caches: 248 print e 249 # use aCache here 250 ... 251 """ 252 253 __display__ = ["name"] 254 __obj_name__ = 'cache_template' 255 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 256 257 @staticmethod
258 - def getAll():
259 """ method : slb.template.cache.getAll 260 Returns a list of cache template in TemplateCache instance. 261 """ 262 try: 263 res = method_call.call_api(TemplateVirtualServer(), method = "slb.template.cache.getAll", format = "url") 264 a_list = [] 265 for item in res["cache_template_list"]: 266 a_list.append( TemplateVirtualServer(**item) ) 267 return a_list 268 except AxAPIError: 269 return None
270 271 @staticmethod
272 - def searchByName(name):
273 """ method: slb.template.cache.search 274 Search the cache template by given name. 275 """ 276 try: 277 r = method_call.call_api(TemplateVirtualServer(), method = "slb.template.cache.search", name = name, format = "url") 278 return TemplateVirtualServer(**r[TemplateVirtualServer.__obj_name__]) 279 except AxAPIError: 280 return None
281
282 - def create(self):
283 """ method: slb.template.cache.create 284 Create the cache template. 285 """ 286 try: 287 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 288 return 0 289 except AxAPIError, e: 290 return e.code
291
292 - def delete(self):
293 """ method: slb.template.cache.delete 294 Delete the cache template. 295 """ 296 try: 297 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 298 return 0 299 except AxAPIError, e: 300 return e.code
301
302 - def update(self):
303 """ method: slb.template.cache.update 304 Update the cache template. 305 """ 306 try: 307 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 308 return 0 309 except AxAPIError, e: 310 return e.code
311
312 -class TemplateVipPort(AxObject):
313 """ 314 Implementation of the aXAPI slb.template.cache.* method to 315 manage the SLB cache template as getAll/searchByName/create/delete/update 316 317 Usage: 318 # cache template with options: 319 # name (required) cache template name 320 321 # Example: create a cache template 322 # ! 323 # slb template cache my_cache_templ1 324 # policy uri abc nocache 325 # policy uri 123 nocache 326 # ! 327 cache1 = TemplateRamCache(name="my_cache_templ1") 328 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 329 cache1.create() 330 # get all cache templates 331 caches = TemplateRamCache.getAll() 332 for e in caches: 333 print e 334 # use aCache here 335 ... 336 """ 337 338 __display__ = ["name"] 339 __obj_name__ = 'cache_template' 340 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 341 342 @staticmethod
343 - def getAll():
344 """ method : slb.template.cache.getAll 345 Returns a list of cache template in TemplateCache instance. 346 """ 347 try: 348 res = method_call.call_api(TemplateVipPort(), method = "slb.template.cache.getAll", format = "url") 349 a_list = [] 350 for item in res["cache_template_list"]: 351 a_list.append( TemplateVipPort(**item) ) 352 return a_list 353 except AxAPIError: 354 return None
355 356 @staticmethod
357 - def searchByName(name):
358 """ method: slb.template.cache.search 359 Search the cache template by given name. 360 """ 361 try: 362 r = method_call.call_api(TemplateVipPort(), method = "slb.template.cache.search", name = name, format = "url") 363 return TemplateVipPort(**r[TemplateVipPort.__obj_name__]) 364 except AxAPIError: 365 return None
366
367 - def create(self):
368 """ method: slb.template.cache.create 369 Create the cache template. 370 """ 371 try: 372 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 373 return 0 374 except AxAPIError, e: 375 return e.code
376
377 - def delete(self):
378 """ method: slb.template.cache.delete 379 Delete the cache template. 380 """ 381 try: 382 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 383 return 0 384 except AxAPIError, e: 385 return e.code
386
387 - def update(self):
388 """ method: slb.template.cache.update 389 Update the cache template. 390 """ 391 try: 392 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 393 return 0 394 except AxAPIError, e: 395 return e.code
396
397 -class TemplateServer(AxObject):
398 """ 399 Implementation of the aXAPI slb.template.cache.* method to 400 manage the SLB cache template as getAll/searchByName/create/delete/update 401 402 Usage: 403 # cache template with options: 404 # name (required) cache template name 405 406 # Example: create a cache template 407 # ! 408 # slb template cache my_cache_templ1 409 # policy uri abc nocache 410 # policy uri 123 nocache 411 # ! 412 cache1 = TemplateRamCache(name="my_cache_templ1") 413 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 414 cache1.create() 415 # get all cache templates 416 caches = TemplateRamCache.getAll() 417 for e in caches: 418 print e 419 # use aCache here 420 ... 421 """ 422 423 __display__ = ["name"] 424 __obj_name__ = 'cache_template' 425 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 426 427 @staticmethod
428 - def getAll():
429 """ method : slb.template.cache.getAll 430 Returns a list of cache template in TemplateServer instance. 431 """ 432 try: 433 res = method_call.call_api(TemplateServer(), method = "slb.template.cache.getAll", format = "url") 434 a_list = [] 435 for item in res["cache_template_list"]: 436 a_list.append( TemplateServer(**item) ) 437 return a_list 438 except AxAPIError: 439 return None
440 441 @staticmethod
442 - def searchByName(name):
443 """ method: slb.template.cache.search 444 Search the cache template by given name. 445 """ 446 try: 447 r = method_call.call_api(TemplateServer(), method = "slb.template.cache.search", name = name, format = "url") 448 return TemplateServer(**r[TemplateServer.__obj_name__]) 449 except AxAPIError: 450 return None
451
452 - def create(self):
453 """ method: slb.template.cache.create 454 Create the cache template. 455 """ 456 try: 457 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 458 return 0 459 except AxAPIError, e: 460 return e.code
461
462 - def delete(self):
463 """ method: slb.template.cache.delete 464 Delete the cache template. 465 """ 466 try: 467 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 468 return 0 469 except AxAPIError, e: 470 return e.code
471
472 - def update(self):
473 """ method: slb.template.cache.update 474 Update the cache template. 475 """ 476 try: 477 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 478 return 0 479 except AxAPIError, e: 480 return e.code
481
482 -class TemplateServerPort(AxObject):
483 """ 484 Implementation of the aXAPI slb.template.cache.* method to 485 manage the SLB cache template as getAll/searchByName/create/delete/update 486 487 Usage: 488 # cache template with options: 489 # name (required) cache template name 490 491 # Example: create a cache template 492 # ! 493 # slb template cache my_cache_templ1 494 # policy uri abc nocache 495 # policy uri 123 nocache 496 # ! 497 cache1 = TemplateRamCache(name="my_cache_templ1") 498 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 499 cache1.create() 500 # get all cache templates 501 caches = TemplateRamCache.getAll() 502 for e in caches: 503 print e 504 # use aCache here 505 ... 506 """ 507 508 __display__ = ["name"] 509 __obj_name__ = 'cache_template' 510 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 511 512 @staticmethod
513 - def getAll():
514 """ method : slb.template.cache.getAll 515 Returns a list of cache template in TemplateServerPort instance. 516 """ 517 try: 518 res = method_call.call_api(TemplateServerPort(), method = "slb.template.cache.getAll", format = "url") 519 a_list = [] 520 for item in res["cache_template_list"]: 521 a_list.append( TemplateServerPort(**item) ) 522 return a_list 523 except AxAPIError: 524 return None
525 526 @staticmethod
527 - def searchByName(name):
528 """ method: slb.template.cache.search 529 Search the cache template by given name. 530 """ 531 try: 532 r = method_call.call_api(TemplateServerPort(), method = "slb.template.cache.search", name = name, format = "url") 533 return TemplateServerPort(**r[TemplateServerPort.__obj_name__]) 534 except AxAPIError: 535 return None
536
537 - def create(self):
538 """ method: slb.template.cache.create 539 Create the cache template. 540 """ 541 try: 542 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 543 return 0 544 except AxAPIError, e: 545 return e.code
546
547 - def delete(self):
548 """ method: slb.template.cache.delete 549 Delete the cache template. 550 """ 551 try: 552 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 553 return 0 554 except AxAPIError, e: 555 return e.code
556
557 - def update(self):
558 """ method: slb.template.cache.update 559 Update the cache template. 560 """ 561 try: 562 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 563 return 0 564 except AxAPIError, e: 565 return e.code
566
567 -class TemplateHttp(AxObject):
568 """ 569 Implementation of the aXAPI slb.template.cache.* method to 570 manage the SLB cache template as getAll/searchByName/create/delete/update 571 572 Usage: 573 # cache template with options: 574 # name (required) cache template name 575 576 # Example: create a cache template 577 # ! 578 # slb template cache my_cache_templ1 579 # policy uri abc nocache 580 # policy uri 123 nocache 581 # ! 582 cache1 = TemplateRamCache(name="my_cache_templ1") 583 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 584 cache1.create() 585 # get all cache templates 586 caches = TemplateRamCache.getAll() 587 for e in caches: 588 print e 589 # use aCache here 590 ... 591 """ 592 593 __display__ = ["name"] 594 __obj_name__ = 'cache_template' 595 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 596 597 @staticmethod
598 - def getAll():
599 """ method : slb.template.cache.getAll 600 Returns a list of cache template in TemplateHttp instance. 601 """ 602 try: 603 res = method_call.call_api(TemplateHttp(), method = "slb.template.cache.getAll", format = "url") 604 a_list = [] 605 for item in res["cache_template_list"]: 606 a_list.append( TemplateHttp(**item) ) 607 return a_list 608 except AxAPIError: 609 return None
610 611 @staticmethod
612 - def searchByName(name):
613 """ method: slb.template.cache.search 614 Search the cache template by given name. 615 """ 616 try: 617 r = method_call.call_api(TemplateHttp(), method = "slb.template.cache.search", name = name, format = "url") 618 return TemplateHttp(**r[TemplateHttp.__obj_name__]) 619 except AxAPIError: 620 return None
621
622 - def create(self):
623 """ method: slb.template.cache.create 624 Create the cache template. 625 """ 626 try: 627 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 628 return 0 629 except AxAPIError, e: 630 return e.code
631
632 - def delete(self):
633 """ method: slb.template.cache.delete 634 Delete the cache template. 635 """ 636 try: 637 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 638 return 0 639 except AxAPIError, e: 640 return e.code
641
642 - def update(self):
643 """ method: slb.template.cache.update 644 Update the cache template. 645 """ 646 try: 647 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 648 return 0 649 except AxAPIError, e: 650 return e.code
651
652 -class TemplatePbslb(AxObject):
653 """ 654 Implementation of the aXAPI slb.template.cache.* method to 655 manage the SLB cache template as getAll/searchByName/create/delete/update 656 657 Usage: 658 # cache template with options: 659 # name (required) cache template name 660 661 # Example: create a cache template 662 # ! 663 # slb template cache my_cache_templ1 664 # policy uri abc nocache 665 # policy uri 123 nocache 666 # ! 667 cache1 = TemplateRamCache(name="my_cache_templ1") 668 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 669 cache1.create() 670 # get all cache templates 671 caches = TemplateRamCache.getAll() 672 for e in caches: 673 print e 674 # use aCache here 675 ... 676 """ 677 678 __display__ = ["name"] 679 __obj_name__ = 'cache_template' 680 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 681 682 @staticmethod
683 - def getAll():
684 """ method : slb.template.cache.getAll 685 Returns a list of cache template in TemplatePbslb instance. 686 """ 687 try: 688 res = method_call.call_api(TemplatePbslb(), method = "slb.template.cache.getAll", format = "url") 689 a_list = [] 690 for item in res["cache_template_list"]: 691 a_list.append( TemplatePbslb(**item) ) 692 return a_list 693 except AxAPIError: 694 return None
695 696 @staticmethod
697 - def searchByName(name):
698 """ method: slb.template.cache.search 699 Search the cache template by given name. 700 """ 701 try: 702 r = method_call.call_api(TemplatePbslb(), method = "slb.template.cache.search", name = name, format = "url") 703 return TemplatePbslb(**r[TemplatePbslb.__obj_name__]) 704 except AxAPIError: 705 return None
706
707 - def create(self):
708 """ method: slb.template.cache.create 709 Create the cache template. 710 """ 711 try: 712 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 713 return 0 714 except AxAPIError, e: 715 return e.code
716
717 - def delete(self):
718 """ method: slb.template.cache.delete 719 Delete the cache template. 720 """ 721 try: 722 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 723 return 0 724 except AxAPIError, e: 725 return e.code
726
727 - def update(self):
728 """ method: slb.template.cache.update 729 Update the cache template. 730 """ 731 try: 732 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 733 return 0 734 except AxAPIError, e: 735 return e.code
736
737 -class TemplateSip(AxObject):
738 """ 739 Implementation of the aXAPI slb.template.cache.* method to 740 manage the SLB cache template as getAll/searchByName/create/delete/update 741 742 Usage: 743 # cache template with options: 744 # name (required) cache template name 745 746 # Example: create a cache template 747 # ! 748 # slb template cache my_cache_templ1 749 # policy uri abc nocache 750 # policy uri 123 nocache 751 # ! 752 cache1 = TemplateRamCache(name="my_cache_templ1") 753 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 754 cache1.create() 755 # get all cache templates 756 caches = TemplateRamCache.getAll() 757 for e in caches: 758 print e 759 # use aCache here 760 ... 761 """ 762 763 __display__ = ["name"] 764 __obj_name__ = 'cache_template' 765 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 766 767 @staticmethod
768 - def getAll():
769 """ method : slb.template.cache.getAll 770 Returns a list of cache template in TemplateCache instance. 771 """ 772 try: 773 res = method_call.call_api(TemplateSip(), method = "slb.template.cache.getAll", format = "url") 774 a_list = [] 775 for item in res["cache_template_list"]: 776 a_list.append( TemplateSip(**item) ) 777 return a_list 778 except AxAPIError: 779 return None
780 781 @staticmethod
782 - def searchByName(name):
783 """ method: slb.template.cache.search 784 Search the cache template by given name. 785 """ 786 try: 787 r = method_call.call_api(TemplateSip(), method = "slb.template.cache.search", name = name, format = "url") 788 return TemplateSip(**r[TemplateSip.__obj_name__]) 789 except AxAPIError: 790 return None
791
792 - def create(self):
793 """ method: slb.template.cache.create 794 Create the cache template. 795 """ 796 try: 797 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 798 return 0 799 except AxAPIError, e: 800 return e.code
801
802 - def delete(self):
803 """ method: slb.template.cache.delete 804 Delete the cache template. 805 """ 806 try: 807 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 808 return 0 809 except AxAPIError, e: 810 return e.code
811
812 - def update(self):
813 """ method: slb.template.cache.update 814 Update the cache template. 815 """ 816 try: 817 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 818 return 0 819 except AxAPIError, e: 820 return e.code
821
822 -class TemplateRtsp(AxObject):
823 """ 824 Implementation of the aXAPI slb.template.cache.* method to 825 manage the SLB cache template as getAll/searchByName/create/delete/update 826 827 Usage: 828 # cache template with options: 829 # name (required) cache template name 830 831 # Example: create a cache template 832 # ! 833 # slb template cache my_cache_templ1 834 # policy uri abc nocache 835 # policy uri 123 nocache 836 # ! 837 cache1 = TemplateRamCache(name="my_cache_templ1") 838 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 839 cache1.create() 840 # get all cache templates 841 caches = TemplateRamCache.getAll() 842 for e in caches: 843 print e 844 # use aCache here 845 ... 846 """ 847 848 __display__ = ["name"] 849 __obj_name__ = 'cache_template' 850 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 851 852 @staticmethod
853 - def getAll():
854 """ method : slb.template.cache.getAll 855 Returns a list of cache template in TemplateRtsp instance. 856 """ 857 try: 858 res = method_call.call_api(TemplateRtsp(), method = "slb.template.cache.getAll", format = "url") 859 a_list = [] 860 for item in res["cache_template_list"]: 861 a_list.append( TemplateRtsp(**item) ) 862 return a_list 863 except AxAPIError: 864 return None
865 866 @staticmethod
867 - def searchByName(name):
868 """ method: slb.template.cache.search 869 Search the cache template by given name. 870 """ 871 try: 872 r = method_call.call_api(TemplateRtsp(), method = "slb.template.cache.search", name = name, format = "url") 873 return TemplateRtsp(**r[TemplateRtsp.__obj_name__]) 874 except AxAPIError: 875 return None
876
877 - def create(self):
878 """ method: slb.template.cache.create 879 Create the cache template. 880 """ 881 try: 882 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 883 return 0 884 except AxAPIError, e: 885 return e.code
886
887 - def delete(self):
888 """ method: slb.template.cache.delete 889 Delete the cache template. 890 """ 891 try: 892 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 893 return 0 894 except AxAPIError, e: 895 return e.code
896
897 - def update(self):
898 """ method: slb.template.cache.update 899 Update the cache template. 900 """ 901 try: 902 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 903 return 0 904 except AxAPIError, e: 905 return e.code
906
907 -class TemplateConnReuse(AxObject):
908 """ 909 Implementation of the aXAPI slb.template.cache.* method to 910 manage the SLB cache template as getAll/searchByName/create/delete/update 911 912 Usage: 913 # cache template with options: 914 # name (required) cache template name 915 916 # Example: create a cache template 917 # ! 918 # slb template cache my_cache_templ1 919 # policy uri abc nocache 920 # policy uri 123 nocache 921 # ! 922 cache1 = TemplateRamCache(name="my_cache_templ1") 923 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 924 cache1.create() 925 # get all cache templates 926 caches = TemplateRamCache.getAll() 927 for e in caches: 928 print e 929 # use aCache here 930 ... 931 """ 932 933 __display__ = ["name"] 934 __obj_name__ = 'cache_template' 935 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 936 937 @staticmethod
938 - def getAll():
939 """ method : slb.template.cache.getAll 940 Returns a list of cache template in TemplateConnReuse instance. 941 """ 942 try: 943 res = method_call.call_api(TemplateConnReuse(), method = "slb.template.cache.getAll", format = "url") 944 a_list = [] 945 for item in res["cache_template_list"]: 946 a_list.append( TemplateConnReuse(**item) ) 947 return a_list 948 except AxAPIError: 949 return None
950 951 @staticmethod
952 - def searchByName(name):
953 """ method: slb.template.cache.search 954 Search the cache template by given name. 955 """ 956 try: 957 r = method_call.call_api(TemplateConnReuse(), method = "slb.template.cache.search", name = name, format = "url") 958 return TemplateConnReuse(**r[TemplateConnReuse.__obj_name__]) 959 except AxAPIError: 960 return None
961
962 - def create(self):
963 """ method: slb.template.cache.create 964 Create the cache template. 965 """ 966 try: 967 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 968 return 0 969 except AxAPIError, e: 970 return e.code
971
972 - def delete(self):
973 """ method: slb.template.cache.delete 974 Delete the cache template. 975 """ 976 try: 977 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 978 return 0 979 except AxAPIError, e: 980 return e.code
981
982 - def update(self):
983 """ method: slb.template.cache.update 984 Update the cache template. 985 """ 986 try: 987 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 988 return 0 989 except AxAPIError, e: 990 return e.code
991
992 -class TemplateTcp(AxObject):
993 """ 994 Implementation of the aXAPI slb.template.cache.* method to 995 manage the SLB cache template as getAll/searchByName/create/delete/update 996 997 Usage: 998 # cache template with options: 999 # name (required) cache template name 1000 1001 # Example: create a cache template 1002 # ! 1003 # slb template cache my_cache_templ1 1004 # policy uri abc nocache 1005 # policy uri 123 nocache 1006 # ! 1007 cache1 = TemplateRamCache(name="my_cache_templ1") 1008 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1009 cache1.create() 1010 # get all cache templates 1011 caches = TemplateRamCache.getAll() 1012 for e in caches: 1013 print e 1014 # use aCache here 1015 ... 1016 """ 1017 1018 __display__ = ["name"] 1019 __obj_name__ = 'cache_template' 1020 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1021 1022 @staticmethod
1023 - def getAll():
1024 """ method : slb.template.cache.getAll 1025 Returns a list of cache template in TemplateTcp instance. 1026 """ 1027 try: 1028 res = method_call.call_api(TemplateTcp(), method = "slb.template.cache.getAll", format = "url") 1029 a_list = [] 1030 for item in res["cache_template_list"]: 1031 a_list.append( TemplateTcp(**item) ) 1032 return a_list 1033 except AxAPIError: 1034 return None
1035 1036 @staticmethod
1037 - def searchByName(name):
1038 """ method: slb.template.cache.search 1039 Search the cache template by given name. 1040 """ 1041 try: 1042 r = method_call.call_api(TemplateTcp(), method = "slb.template.cache.search", name = name, format = "url") 1043 return TemplateTcp(**r[TemplateTcp.__obj_name__]) 1044 except AxAPIError: 1045 return None
1046
1047 - def create(self):
1048 """ method: slb.template.cache.create 1049 Create the cache template. 1050 """ 1051 try: 1052 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1053 return 0 1054 except AxAPIError, e: 1055 return e.code
1056
1057 - def delete(self):
1058 """ method: slb.template.cache.delete 1059 Delete the cache template. 1060 """ 1061 try: 1062 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1063 return 0 1064 except AxAPIError, e: 1065 return e.code
1066
1067 - def update(self):
1068 """ method: slb.template.cache.update 1069 Update the cache template. 1070 """ 1071 try: 1072 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1073 return 0 1074 except AxAPIError, e: 1075 return e.code
1076
1077 -class TemplateUdp(AxObject):
1078 """ 1079 Implementation of the aXAPI slb.template.cache.* method to 1080 manage the SLB cache template as getAll/searchByName/create/delete/update 1081 1082 Usage: 1083 # cache template with options: 1084 # name (required) cache template name 1085 1086 # Example: create a cache template 1087 # ! 1088 # slb template cache my_cache_templ1 1089 # policy uri abc nocache 1090 # policy uri 123 nocache 1091 # ! 1092 cache1 = TemplateRamCache(name="my_cache_templ1") 1093 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1094 cache1.create() 1095 # get all cache templates 1096 caches = TemplateRamCache.getAll() 1097 for e in caches: 1098 print e 1099 # use aCache here 1100 ... 1101 """ 1102 1103 __display__ = ["name"] 1104 __obj_name__ = 'cache_template' 1105 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1106 1107 @staticmethod
1108 - def getAll():
1109 """ method : slb.template.cache.getAll 1110 Returns a list of cache template in TemplateUdp instance. 1111 """ 1112 try: 1113 res = method_call.call_api(TemplateUdp(), method = "slb.template.cache.getAll", format = "url") 1114 a_list = [] 1115 for item in res["cache_template_list"]: 1116 a_list.append( TemplateUdp(**item) ) 1117 return a_list 1118 except AxAPIError: 1119 return None
1120 1121 @staticmethod
1122 - def searchByName(name):
1123 """ method: slb.template.cache.search 1124 Search the cache template by given name. 1125 """ 1126 try: 1127 r = method_call.call_api(TemplateUdp(), method = "slb.template.cache.search", name = name, format = "url") 1128 return TemplateUdp(**r[TemplateUdp.__obj_name__]) 1129 except AxAPIError: 1130 return None
1131
1132 - def create(self):
1133 """ method: slb.template.cache.create 1134 Create the cache template. 1135 """ 1136 try: 1137 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1138 return 0 1139 except AxAPIError, e: 1140 return e.code
1141
1142 - def delete(self):
1143 """ method: slb.template.cache.delete 1144 Delete the cache template. 1145 """ 1146 try: 1147 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1148 return 0 1149 except AxAPIError, e: 1150 return e.code
1151
1152 - def update(self):
1153 """ method: slb.template.cache.update 1154 Update the cache template. 1155 """ 1156 try: 1157 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1158 return 0 1159 except AxAPIError, e: 1160 return e.code
1161
1162 -class TemplateCookiePersist(AxObject):
1163 """ 1164 Implementation of the aXAPI slb.template.cache.* method to 1165 manage the SLB cache template as getAll/searchByName/create/delete/update 1166 1167 Usage: 1168 # cache template with options: 1169 # name (required) cache template name 1170 1171 # Example: create a cache template 1172 # ! 1173 # slb template cache my_cache_templ1 1174 # policy uri abc nocache 1175 # policy uri 123 nocache 1176 # ! 1177 cache1 = TemplateRamCache(name="my_cache_templ1") 1178 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1179 cache1.create() 1180 # get all cache templates 1181 caches = TemplateRamCache.getAll() 1182 for e in caches: 1183 print e 1184 # use aCache here 1185 ... 1186 """ 1187 1188 __display__ = ["name"] 1189 __obj_name__ = 'cache_template' 1190 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1191 1192 @staticmethod
1193 - def getAll():
1194 """ method : slb.template.cache.getAll 1195 Returns a list of cache template in TemplateCookiePersist instance. 1196 """ 1197 try: 1198 res = method_call.call_api(TemplateCookiePersist(), method = "slb.template.cache.getAll", format = "url") 1199 a_list = [] 1200 for item in res["cache_template_list"]: 1201 a_list.append( TemplateCookiePersist(**item) ) 1202 return a_list 1203 except AxAPIError: 1204 return None
1205 1206 @staticmethod
1207 - def searchByName(name):
1208 """ method: slb.template.cache.search 1209 Search the cache template by given name. 1210 """ 1211 try: 1212 r = method_call.call_api(TemplateCookiePersist(), method = "slb.template.cache.search", name = name, format = "url") 1213 return TemplateCookiePersist(**r[TemplateCookiePersist.__obj_name__]) 1214 except AxAPIError: 1215 return None
1216
1217 - def create(self):
1218 """ method: slb.template.cache.create 1219 Create the cache template. 1220 """ 1221 try: 1222 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1223 return 0 1224 except AxAPIError, e: 1225 return e.code
1226
1227 - def delete(self):
1228 """ method: slb.template.cache.delete 1229 Delete the cache template. 1230 """ 1231 try: 1232 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1233 return 0 1234 except AxAPIError, e: 1235 return e.code
1236
1237 - def update(self):
1238 """ method: slb.template.cache.update 1239 Update the cache template. 1240 """ 1241 try: 1242 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1243 return 0 1244 except AxAPIError, e: 1245 return e.code
1246
1247 -class TemplateSourceIpPersist(AxObject):
1248 """ 1249 Implementation of the aXAPI slb.template.cache.* method to 1250 manage the SLB cache template as getAll/searchByName/create/delete/update 1251 1252 Usage: 1253 # cache template with options: 1254 # name (required) cache template name 1255 1256 # Example: create a cache template 1257 # ! 1258 # slb template cache my_cache_templ1 1259 # policy uri abc nocache 1260 # policy uri 123 nocache 1261 # ! 1262 cache1 = TemplateRamCache(name="my_cache_templ1") 1263 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1264 cache1.create() 1265 # get all cache templates 1266 caches = TemplateRamCache.getAll() 1267 for e in caches: 1268 print e 1269 # use aCache here 1270 ... 1271 """ 1272 1273 __display__ = ["name"] 1274 __obj_name__ = 'cache_template' 1275 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1276 1277 @staticmethod
1278 - def getAll():
1279 """ method : slb.template.cache.getAll 1280 Returns a list of cache template in TemplateSourceIpPersist instance. 1281 """ 1282 try: 1283 res = method_call.call_api(TemplateSourceIpPersist(), method = "slb.template.cache.getAll", format = "url") 1284 a_list = [] 1285 for item in res["cache_template_list"]: 1286 a_list.append( TemplateSourceIpPersist(**item) ) 1287 return a_list 1288 except AxAPIError: 1289 return None
1290 1291 @staticmethod
1292 - def searchByName(name):
1293 """ method: slb.template.cache.search 1294 Search the cache template by given name. 1295 """ 1296 try: 1297 r = method_call.call_api(TemplateSourceIpPersist(), method = "slb.template.cache.search", name = name, format = "url") 1298 return TemplateSourceIpPersist(**r[TemplateSourceIpPersist.__obj_name__]) 1299 except AxAPIError: 1300 return None
1301
1302 - def create(self):
1303 """ method: slb.template.cache.create 1304 Create the cache template. 1305 """ 1306 try: 1307 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1308 return 0 1309 except AxAPIError, e: 1310 return e.code
1311
1312 - def delete(self):
1313 """ method: slb.template.cache.delete 1314 Delete the cache template. 1315 """ 1316 try: 1317 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1318 return 0 1319 except AxAPIError, e: 1320 return e.code
1321
1322 - def update(self):
1323 """ method: slb.template.cache.update 1324 Update the cache template. 1325 """ 1326 try: 1327 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1328 return 0 1329 except AxAPIError, e: 1330 return e.code
1331
1332 -class TemplateDestinationIp(AxObject):
1333 """ 1334 Implementation of the aXAPI slb.template.cache.* method to 1335 manage the SLB cache template as getAll/searchByName/create/delete/update 1336 1337 Usage: 1338 # cache template with options: 1339 # name (required) cache template name 1340 1341 # Example: create a cache template 1342 # ! 1343 # slb template cache my_cache_templ1 1344 # policy uri abc nocache 1345 # policy uri 123 nocache 1346 # ! 1347 cache1 = TemplateRamCache(name="my_cache_templ1") 1348 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1349 cache1.create() 1350 # get all cache templates 1351 caches = TemplateRamCache.getAll() 1352 for e in caches: 1353 print e 1354 # use aCache here 1355 ... 1356 """ 1357 1358 __display__ = ["name"] 1359 __obj_name__ = 'cache_template' 1360 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1361 1362 @staticmethod
1363 - def getAll():
1364 """ method : slb.template.cache.getAll 1365 Returns a list of cache template in TemplateDestinationIp instance. 1366 """ 1367 try: 1368 res = method_call.call_api(TemplateCache(), method = "slb.template.cache.getAll", format = "url") 1369 a_list = [] 1370 for item in res["cache_template_list"]: 1371 a_list.append( TemplateCache(**item) ) 1372 return a_list 1373 except AxAPIError: 1374 return None
1375 1376 @staticmethod
1377 - def searchByName(name):
1378 """ method: slb.template.cache.search 1379 Search the cache template by given name. 1380 """ 1381 try: 1382 r = method_call.call_api(TemplateCache(), method = "slb.template.cache.search", name = name, format = "url") 1383 return TemplateCache(**r[TemplateCache.__obj_name__]) 1384 except AxAPIError: 1385 return None
1386
1387 - def create(self):
1388 """ method: slb.template.cache.create 1389 Create the cache template. 1390 """ 1391 try: 1392 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1393 return 0 1394 except AxAPIError, e: 1395 return e.code
1396
1397 - def delete(self):
1398 """ method: slb.template.cache.delete 1399 Delete the cache template. 1400 """ 1401 try: 1402 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1403 return 0 1404 except AxAPIError, e: 1405 return e.code
1406
1407 - def update(self):
1408 """ method: slb.template.cache.update 1409 Update the cache template. 1410 """ 1411 try: 1412 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1413 return 0 1414 except AxAPIError, e: 1415 return e.code
1416
1417 -class Template(AxObject):
1418 """ 1419 Implementation of the aXAPI slb.template.cache.* method to 1420 manage the SLB cache template as getAll/searchByName/create/delete/update 1421 1422 Usage: 1423 # cache template with options: 1424 # name (required) cache template name 1425 1426 # Example: create a cache template 1427 # ! 1428 # slb template cache my_cache_templ1 1429 # policy uri abc nocache 1430 # policy uri 123 nocache 1431 # ! 1432 cache1 = TemplateRamCache(name="my_cache_templ1") 1433 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1434 cache1.create() 1435 # get all cache templates 1436 caches = TemplateRamCache.getAll() 1437 for e in caches: 1438 print e 1439 # use aCache here 1440 ... 1441 """ 1442 1443 __display__ = ["name"] 1444 __obj_name__ = 'cache_template' 1445 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1446 1447 @staticmethod
1448 - def getAll():
1449 """ method : slb.template.cache.getAll 1450 Returns a list of cache template in TemplateCache instance. 1451 """ 1452 try: 1453 res = method_call.call_api(TemplateDestinationIp(), method = "slb.template.cache.getAll", format = "url") 1454 a_list = [] 1455 for item in res["cache_template_list"]: 1456 a_list.append( TemplateDestinationIp(**item) ) 1457 return a_list 1458 except AxAPIError: 1459 return None
1460 1461 @staticmethod
1462 - def searchByName(name):
1463 """ method: slb.template.cache.search 1464 Search the cache template by given name. 1465 """ 1466 try: 1467 r = method_call.call_api(TemplateDestinationIp(), method = "slb.template.cache.search", name = name, format = "url") 1468 return TemplateDestinationIp(**r[TemplateDestinationIp.__obj_name__]) 1469 except AxAPIError: 1470 return None
1471
1472 - def create(self):
1473 """ method: slb.template.cache.create 1474 Create the cache template. 1475 """ 1476 try: 1477 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1478 return 0 1479 except AxAPIError, e: 1480 return e.code
1481
1482 - def delete(self):
1483 """ method: slb.template.cache.delete 1484 Delete the cache template. 1485 """ 1486 try: 1487 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1488 return 0 1489 except AxAPIError, e: 1490 return e.code
1491
1492 - def update(self):
1493 """ method: slb.template.cache.update 1494 Update the cache template. 1495 """ 1496 try: 1497 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1498 return 0 1499 except AxAPIError, e: 1500 return e.code
1501
1502 -class TemplateSslPersist(AxObject):
1503 """ 1504 Implementation of the aXAPI slb.template.cache.* method to 1505 manage the SLB cache template as getAll/searchByName/create/delete/update 1506 1507 Usage: 1508 # cache template with options: 1509 # name (required) cache template name 1510 1511 # Example: create a cache template 1512 # ! 1513 # slb template cache my_cache_templ1 1514 # policy uri abc nocache 1515 # policy uri 123 nocache 1516 # ! 1517 cache1 = TemplateRamCache(name="my_cache_templ1") 1518 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1519 cache1.create() 1520 # get all cache templates 1521 caches = TemplateRamCache.getAll() 1522 for e in caches: 1523 print e 1524 # use aCache here 1525 ... 1526 """ 1527 1528 __display__ = ["name"] 1529 __obj_name__ = 'cache_template' 1530 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1531 1532 @staticmethod
1533 - def getAll():
1534 """ method : slb.template.cache.getAll 1535 Returns a list of cache template in TemplateSslPersist instance. 1536 """ 1537 try: 1538 res = method_call.call_api(TemplateSslPersist(), method = "slb.template.cache.getAll", format = "url") 1539 a_list = [] 1540 for item in res["cache_template_list"]: 1541 a_list.append( TemplateSslPersist(**item) ) 1542 return a_list 1543 except AxAPIError: 1544 return None
1545 1546 @staticmethod
1547 - def searchByName(name):
1548 """ method: slb.template.cache.search 1549 Search the cache template by given name. 1550 """ 1551 try: 1552 r = method_call.call_api(TemplateSslPersist(), method = "slb.template.cache.search", name = name, format = "url") 1553 return TemplateSslPersist(**r[TemplateSslPersist.__obj_name__]) 1554 except AxAPIError: 1555 return None
1556
1557 - def create(self):
1558 """ method: slb.template.cache.create 1559 Create the cache template. 1560 """ 1561 try: 1562 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1563 return 0 1564 except AxAPIError, e: 1565 return e.code
1566
1567 - def delete(self):
1568 """ method: slb.template.cache.delete 1569 Delete the cache template. 1570 """ 1571 try: 1572 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1573 return 0 1574 except AxAPIError, e: 1575 return e.code
1576
1577 - def update(self):
1578 """ method: slb.template.cache.update 1579 Update the cache template. 1580 """ 1581 try: 1582 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1583 return 0 1584 except AxAPIError, e: 1585 return e.code
1586
1587 -class TemplateTcpProxy(AxObject):
1588 """ 1589 Implementation of the aXAPI slb.template.cache.* method to 1590 manage the SLB cache template as getAll/searchByName/create/delete/update 1591 1592 Usage: 1593 # cache template with options: 1594 # name (required) cache template name 1595 1596 # Example: create a cache template 1597 # ! 1598 # slb template cache my_cache_templ1 1599 # policy uri abc nocache 1600 # policy uri 123 nocache 1601 # ! 1602 cache1 = TemplateRamCache(name="my_cache_templ1") 1603 cache1.policy_list = [{"uri": "abc", "action": 1}, {"uri": "123", "action": 1}] 1604 cache1.create() 1605 # get all cache templates 1606 caches = TemplateRamCache.getAll() 1607 for e in caches: 1608 print e 1609 # use aCache here 1610 ... 1611 """ 1612 1613 __display__ = ["name"] 1614 __obj_name__ = 'cache_template' 1615 __xml_convrt__ = {"cache_template_list": "cache_template", "policys": "policy", "policy_list": "policy"} 1616 1617 @staticmethod
1618 - def getAll():
1619 """ method : slb.template.cache.getAll 1620 Returns a list of cache template in TemplateTcpProxy instance. 1621 """ 1622 try: 1623 res = method_call.call_api(TemplateTcpProxy(), method = "slb.template.cache.getAll", format = "url") 1624 a_list = [] 1625 for item in res["cache_template_list"]: 1626 a_list.append( TemplateTcpProxy(**item) ) 1627 return a_list 1628 except AxAPIError: 1629 return None
1630 1631 @staticmethod
1632 - def searchByName(name):
1633 """ method: slb.template.cache.search 1634 Search the cache template by given name. 1635 """ 1636 try: 1637 r = method_call.call_api(TemplateTcpProxy(), method = "slb.template.cache.search", name = name, format = "url") 1638 return TemplateTcpProxy(**r[TemplateTcpProxy.__obj_name__]) 1639 except AxAPIError: 1640 return None
1641
1642 - def create(self):
1643 """ method: slb.template.cache.create 1644 Create the cache template. 1645 """ 1646 try: 1647 method_call.call_api(self, method = "slb.template.cache.create", format = "url", post_data = self.getRequestPostDataXml()) 1648 return 0 1649 except AxAPIError, e: 1650 return e.code
1651
1652 - def delete(self):
1653 """ method: slb.template.cache.delete 1654 Delete the cache template. 1655 """ 1656 try: 1657 method_call.call_api(self, method = "slb.template.cache.delete", format = "url", name = self.name) 1658 return 0 1659 except AxAPIError, e: 1660 return e.code
1661
1662 - def update(self):
1663 """ method: slb.template.cache.update 1664 Update the cache template. 1665 """ 1666 try: 1667 method_call.call_api(self, method = "slb.template.cache.update", format = "url", post_data = self.getRequestPostDataXml()) 1668 return 0 1669 except AxAPIError, e: 1670 return e.code
1671
1672 -class TemplateDns(AxObject):
1673 """ 1674 Implementation of the aXAPI slb.template.dns.* method to 1675 manage the SLB dns template as getAll/searchByName/create/delete/update 1676 1677 Usage: 1678 # dns template with options: 1679 # name (required) cache template name 1680 # name dns template name 1681 # malformed_query malformed query, disabled(0), drop(1), forward to service group(2) 1682 # service_group_malformed_query service group name, only malformed_query is 2 1683 # status dns template status, disabled(0) or enabled(1) 1684 # def_policy default policy, no cache(0) or cache(1) 1685 # log_period log period (Minutes) 1686 # max_cache_size 1687 # class_list tag for the class list 1688 # name class list name 1689 # lid_list tag for the collection of LID 1690 # id LID id 1691 # dns_cache_status DNS cache status, enabled(1) or disabled(0) 1692 # ttl 1693 # weight 1694 # conn_rate_limit connection rate limit 1695 # conn_rate_limit_per connection rate limit interval 1696 # over_limit_action drop(0), forward(1), 1697 # enable DNS cache(2) or disable dns cache(3) 1698 # lockout lockout 1699 # log_status log status, enabled(1). disabled(0) 1700 # log_interval log interval 1701 """ 1702 1703 __display__ = ["name"] 1704 __obj_name__ = 'dns_template' 1705 __xml_convrt__ = {"dns_template_list": "dns_template", "lid_list": "lid"} 1706 1707 @staticmethod
1708 - def getAll():
1709 """ method : slb.template.dns.getAll 1710 Returns a list of dns template in TemplateDns instance. 1711 """ 1712 try: 1713 res = method_call.call_api(TemplateDns(), method = "slb.template.dns.getAll", format = "url") 1714 a_list = [] 1715 for item in res["dns_template_list"]: 1716 a_list.append( TemplateDns(**item) ) 1717 return a_list 1718 except AxAPIError: 1719 return None
1720 1721 @staticmethod
1722 - def searchByName(name):
1723 """ method: slb.template.dns.search 1724 Search the dns template by given name. 1725 """ 1726 try: 1727 r = method_call.call_api(TemplateDns(), method = "slb.template.dns.search", name = name, format = "url") 1728 return TemplateDns(**r[TemplateDns.__obj_name__]) 1729 except AxAPIError: 1730 return None
1731
1732 - def create(self):
1733 """ method: slb.template.dns.create 1734 Create the dns template. 1735 """ 1736 try: 1737 method_call.call_api(self, method = "slb.template.dns.create", format = "url", post_data = self.getRequestPostDataXml()) 1738 return 0 1739 except AxAPIError, e: 1740 return e.code
1741
1742 - def delete(self):
1743 """ method: slb.template.dns.delete 1744 Delete the dns template. 1745 """ 1746 try: 1747 method_call.call_api(self, method = "slb.template.dns.delete", format = "url", name = self.name) 1748 return 0 1749 except AxAPIError, e: 1750 return e.code
1751
1752 - def update(self):
1753 """ method: slb.template.dns.update 1754 Update the dns template. 1755 """ 1756 try: 1757 method_call.call_api(self, method = "slb.template.dns.update", format = "url", post_data = self.getRequestPostDataXml()) 1758 return 0 1759 except AxAPIError, e: 1760 return e.code
1761
1762 -class TemplateDiameter(AxObject):
1763 """ 1764 Implementation of the aXAPI slb.template.diameter.* method to 1765 manage the SLB diameter template as getAll/searchByName/create/delete/update 1766 1767 Usage: 1768 # diameter template with options: 1769 # name (required) cache template name 1770 # name diameter template name 1771 # multiple_origin_host multiple origin host 1772 # origin_host origin host 1773 # origin_realm origin realm 1774 # product_name product name 1775 # vendor_id vendor id 1776 # idle_timeout idle timeout 1777 # dwr_time_interval dwr time interval 1778 # session_age session age 1779 # customizing_cea_response customizing cea response 1780 # duplicate_avp_code duplicate avp code 1781 # duplicate_pattern duplicate pattern 1782 # duplicate_service_name duplicate service name 1783 # avps tag for collection of avps 1784 # code code 1785 # mandatory mandatory 1786 # type INT32 (1), INT64(2), String(3) 1787 # value value 1788 # message_codes tag for collection of message codes 1789 # value message code 1790 """ 1791 1792 __display__ = ["name"] 1793 __obj_name__ = 'diameter_template' 1794 __xml_convrt__ = {"diameter_template_list": "diameter_template", "avps": "avp", "message_codes": "code"} 1795 1796 @staticmethod
1797 - def getAll():
1798 """ method : slb.template.diameter.getAll 1799 Returns a list of diameter template in TemplateDiameter instance. 1800 """ 1801 try: 1802 res = method_call.call_api(TemplateDiameter(), method = "slb.template.diameter.getAll", format = "url") 1803 a_list = [] 1804 for item in res["diameter_template_list"]: 1805 a_list.append( TemplateDiameter(**item) ) 1806 return a_list 1807 except AxAPIError: 1808 return None
1809 1810 @staticmethod
1811 - def searchByName(name):
1812 """ method: slb.template.diameter.search 1813 Search the diameter template by given name. 1814 """ 1815 try: 1816 r = method_call.call_api(TemplateDiameter(), method = "slb.template.diameter.search", name = name, format = "url") 1817 return TemplateDiameter(**r[TemplateDiameter.__obj_name__]) 1818 except AxAPIError: 1819 return None
1820
1821 - def create(self):
1822 """ method: slb.template.diameter.create 1823 Create the diameter template. 1824 """ 1825 try: 1826 method_call.call_api(self, method = "slb.template.diameter.create", format = "url", post_data = self.getRequestPostDataXml()) 1827 return 0 1828 except AxAPIError, e: 1829 return e.code
1830
1831 - def delete(self):
1832 """ method: slb.template.diameter.delete 1833 Delete the diameter template. 1834 """ 1835 try: 1836 method_call.call_api(self, method = "slb.template.diameter.delete", format = "url", name = self.name) 1837 return 0 1838 except AxAPIError, e: 1839 return e.code
1840
1841 - def update(self):
1842 """ method: slb.template.diameter.update 1843 Update the diameter template. 1844 """ 1845 try: 1846 method_call.call_api(self, method = "slb.template.diameter.update", format = "url", post_data = self.getRequestPostDataXml()) 1847 return 0 1848 except AxAPIError, e: 1849 return e.code
1850