forked from jasonhancock/cloudstack-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.py
More file actions
5215 lines (4138 loc) · 198 KB
/
Client.py
File metadata and controls
5215 lines (4138 loc) · 198 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from BaseClient import BaseClient
class Client(BaseClient):
def createNetworkOffering(self, args={}):
'''
Creates a network offering.
args - A dictionary. The following are options for keys:
displaytext - the display text of the network offering
guestiptype - guest type of the network offering: Shared or Isolated
name - the name of the network offering
supportedservices - services supported by the network offering
traffictype - the traffic type for the network offering. Supported type in
current release is GUEST only
availability - the availability of network offering. Default value is
Optional
conservemode - true if the network offering is IP conserve mode enabled
networkrate - data transfer rate in megabits per second allowed
servicecapabilitylist - desired service capabilities as part of network
offering
serviceofferingid - the service offering ID used by virtual router provider
serviceproviderlist - provider to service mapping. If not specified, the
provider for the service will be mapped to the default provider on the physical
network
specifyipranges - true if network offering supports specifying ip ranges;
defaulted to false if not specified
specifyvlan - true if network offering supports vlans
tags - the tags for the network offering.
'''
if not 'displaytext' in args:
raise RuntimeError("Missing required argument 'displaytext'")
if not 'guestiptype' in args:
raise RuntimeError("Missing required argument 'guestiptype'")
if not 'name' in args:
raise RuntimeError("Missing required argument 'name'")
if not 'supportedservices' in args:
raise RuntimeError("Missing required argument 'supportedservices'")
if not 'traffictype' in args:
raise RuntimeError("Missing required argument 'traffictype'")
return self.request('createNetworkOffering', args)
def updateNetworkOffering(self, args={}):
'''
Updates a network offering.
args - A dictionary. The following are options for keys:
availability - the availability of network offering. Default value is
Required for Guest Virtual network offering; Optional for Guest Direct network
offering
displaytext - the display text of the network offering
id - the id of the network offering
name - the name of the network offering
sortkey - sort key of the network offering, integer
state - update state for the network offering
'''
return self.request('updateNetworkOffering', args)
def deleteNetworkOffering(self, args={}):
'''
Deletes a network offering.
args - A dictionary. The following are options for keys:
id - the ID of the network offering
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteNetworkOffering', args)
def listNetworkOfferings(self, args={}):
'''
Lists all available network offerings.
args - A dictionary. The following are options for keys:
availability - the availability of network offering. Default value is
Required
displaytext - list network offerings by display text
guestiptype - list network offerings by guest type: Shared or Isolated
id - list network offerings by id
isdefault - true if need to list only default network offerings. Default
value is false
istagged - true if offering has tags specified
keyword - List by keyword
name - list network offerings by name
networkid - the ID of the network. Pass this in if you want to see the
available network offering that a network can be changed to.
page -
pagesize -
sourcenatsupported - true if need to list only netwok offerings where source
nat is supported, false otherwise
specifyipranges - true if need to list only network offerings which support
specifying ip ranges
specifyvlan - the tags for the network offering.
state - list network offerings by state
supportedservices - list network offerings supporting certain services
tags - list network offerings by tags
traffictype - list by traffic type
zoneid - list netowrk offerings available for network creation in specific
zone
page - Pagination
'''
return self.request('listNetworkOfferings', args)
def createNetwork(self, args={}):
'''
Creates a network
args - A dictionary. The following are options for keys:
displaytext - the display text of the network
name - the name of the network
networkofferingid - the network offering id
zoneid - the Zone ID for the network
account - account who will own the network
acltype - Access control type; supported values are account and domain. In
3.0 all shared networks should have aclType=Domain, and all Isolated networks -
Account. Account means that only the account owner can use the network, domain -
all accouns in the domain can use the network
domainid - domain ID of the account owning a network
endip - the ending IP address in the network IP range. If not specified,
will be defaulted to startIP
gateway - the gateway of the network
netmask - the netmask of the network
networkdomain - network domain
physicalnetworkid - the Physical Network ID the network belongs to
projectid - an optional project for the ssh key
startip - the beginning IP address in the network IP range
subdomainaccess - Defines whether to allow subdomains to use networks
dedicated to their parent domain(s). Should be used with aclType=Domain,
defaulted to allow.subdomain.network.access global config if not specified
vlan - the ID or VID of the network
'''
if not 'displaytext' in args:
raise RuntimeError("Missing required argument 'displaytext'")
if not 'name' in args:
raise RuntimeError("Missing required argument 'name'")
if not 'networkofferingid' in args:
raise RuntimeError("Missing required argument 'networkofferingid'")
if not 'zoneid' in args:
raise RuntimeError("Missing required argument 'zoneid'")
return self.request('createNetwork', args)
def deleteNetwork(self, args={}):
'''
Deletes a network
args - A dictionary. The following are options for keys:
id - the ID of the network
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteNetwork', args)
def listNetworks(self, args={}):
'''
Lists all available networks.
args - A dictionary. The following are options for keys:
account - List resources by account. Must be used with the domainId
parameter.
acltype - list networks by ACL (access control list) type. Supported values
are Account and Domain
domainid - list only resources belonging to the domain specified
id - list networks by id
isrecursive - defaults to false, but if true, lists all resources from the
parent specified by the domainId till leaves.
issystem - true if network is system, false otherwise
keyword - List by keyword
listall - If set to false, list only resources belonging to the command's
caller; if set to true - list resources that the caller is authorized to see.
Default value is false
page -
pagesize -
physicalnetworkid - list networks by physical network id
projectid - list firewall rules by project
restartrequired - list network offerings by restartRequired option
specifyipranges - true if need to list only networks which support
specifying ip ranges
supportedservices - list network offerings supporting certain services
traffictype - type of the traffic
type - the type of the network. Supported values are: Isolated and Shared
zoneid - the Zone ID of the network
page - Pagination
'''
return self.request('listNetworks', args)
def restartNetwork(self, args={}):
'''
Restarts the network; includes 1) restarting network elements - virtual routers,
dhcp servers 2) reapplying all public ips 3) reapplying
loadBalancing/portForwarding rules
args - A dictionary. The following are options for keys:
id - The id of the network to restart.
cleanup - If cleanup old network elements
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('restartNetwork', args)
def updateNetwork(self, args={}):
'''
Updates a network
args - A dictionary. The following are options for keys:
id - the ID of the network
changecidr - Force update even if cidr type is different
displaytext - the new display text for the network
name - the new name for the network
networkdomain - network domain
networkofferingid - network offering ID
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('updateNetwork', args)
def listNetworkACLs(self, args={}):
'''
args - A dictionary. The following are options for keys:
id - Lists network ACL with the specified ID
account - List resources by account. Must be used with the
domainId parameter.
domainid - list only resources belonging to the domain specified
isrecursive - defaults to false, but if true, lists all resources from
the parent specified by the domainId till leaves
keyword - List by keyword
listall - If set to false, list only resources belonging to the command's
caller; if set to true - list resources that the caller is authorized to see.
Default value is false
networkid - list network ACLs by network Id
projectid - list objects by project
tags - List resources by tags (key/value pairs)
traffictype - list network ACLs by traffic type - Ingress or Egress
'''
return self.request('listNetworkACLs', args)
def createPhysicalNetwork(self, args={}):
'''
Creates a physical network
args - A dictionary. The following are options for keys:
name - the name of the physical network
zoneid - the Zone ID for the physical network
broadcastdomainrange - the broadcast domain range for the physical
network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and
Pod in Basic
domainid - domain ID of the account owning a physical network
isolationmethods - the isolation method for the physical
network[VLAN/L3/GRE]
networkspeed - the speed for the physical network[1G/10G]
tags - Tag the physical network
vlan - the VLAN for the physical network
'''
if not 'name' in args:
raise RuntimeError("Missing required argument 'name'")
if not 'zoneid' in args:
raise RuntimeError("Missing required argument 'zoneid'")
return self.request('createPhysicalNetwork', args)
def deletePhysicalNetwork(self, args={}):
'''
Deletes a Physical Network.
args - A dictionary. The following are options for keys:
id - the ID of the Physical network
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deletePhysicalNetwork', args)
def listPhysicalNetworks(self, args={}):
'''
Lists physical networks
args - A dictionary. The following are options for keys:
id - list physical network by id
keyword - List by keyword
name - search by name
page -
pagesize -
zoneid - the Zone ID for the physical network
page - Pagination
'''
return self.request('listPhysicalNetworks', args)
def updatePhysicalNetwork(self, args={}):
'''
Updates a physical network
args - A dictionary. The following are options for keys:
id - physical network id
networkspeed - the speed for the physical network[1G/10G]
state - Enabled/Disabled
tags - Tag the physical network
vlan - the VLAN for the physical network
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('updatePhysicalNetwork', args)
def listSupportedNetworkServices(self, args={}):
'''
Lists all network services provided by CloudStack or for the given Provider.
args - A dictionary. The following are options for keys:
keyword - List by keyword
page -
pagesize -
provider - network service provider name
service - network service name to list providers and capabilities of
page - Pagination
'''
return self.request('listSupportedNetworkServices', args)
def addNetworkServiceProvider(self, args={}):
'''
Adds a network serviceProvider to a physical network
args - A dictionary. The following are options for keys:
name - the name for the physical network service provider
physicalnetworkid - the Physical Network ID to add the provider to
destinationphysicalnetworkid - the destination Physical Network ID to bridge
to
servicelist - the list of services to be enabled for this physical network
service provider
'''
if not 'name' in args:
raise RuntimeError("Missing required argument 'name'")
if not 'physicalnetworkid' in args:
raise RuntimeError("Missing required argument 'physicalnetworkid'")
return self.request('addNetworkServiceProvider', args)
def deleteNetworkServiceProvider(self, args={}):
'''
Deletes a Network Service Provider.
args - A dictionary. The following are options for keys:
id - the ID of the network service provider
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteNetworkServiceProvider', args)
def listNetworkServiceProviders(self, args={}):
'''
Lists network serviceproviders for a given physical network.
args - A dictionary. The following are options for keys:
keyword - List by keyword
name - list providers by name
page -
pagesize -
physicalnetworkid - the Physical Network ID
state - list providers by state
page - Pagination
'''
return self.request('listNetworkServiceProviders', args)
def updateNetworkServiceProvider(self, args={}):
'''
Updates a network serviceProvider of a physical network
args - A dictionary. The following are options for keys:
id - network service provider id
servicelist - the list of services to be enabled for this physical network
service provider
state - Enabled/Disabled/Shutdown the physical network service provider
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('updateNetworkServiceProvider', args)
def createStorageNetworkIpRange(self, args={}):
'''
Creates a Storage network IP range.
args - A dictionary. The following are options for keys:
gateway - the gateway for storage network
netmask - the netmask for storage network
podid - UUID of pod where the ip range belongs to
startip - the beginning IP address
endip - the ending IP address
vlan - Optional. The vlan the ip range sits on, default to Null when it is
not specificed which means you network is not on any Vlan. This is mainly for
Vmware as other hypervisors can directly reterive bridge from pyhsical network
traffic type table
'''
if not 'gateway' in args:
raise RuntimeError("Missing required argument 'gateway'")
if not 'netmask' in args:
raise RuntimeError("Missing required argument 'netmask'")
if not 'podid' in args:
raise RuntimeError("Missing required argument 'podid'")
if not 'startip' in args:
raise RuntimeError("Missing required argument 'startip'")
return self.request('createStorageNetworkIpRange', args)
def deleteStorageNetworkIpRange(self, args={}):
'''
Deletes a storage network IP Range.
args - A dictionary. The following are options for keys:
id - the uuid of the storage network ip range
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteStorageNetworkIpRange', args)
def listStorageNetworkIpRange(self, args={}):
'''
List a storage network IP range.
args - A dictionary. The following are options for keys:
id - optional parameter. Storaget network IP range uuid, if specicied, using
it to search the range.
keyword - List by keyword
page -
pagesize -
podid - optional parameter. Pod uuid, if specicied and range uuid is absent,
using it to search the range.
zoneid - optional parameter. Zone uuid, if specicied and both pod uuid and
range uuid are absent, using it to search the range.
page - Pagination
'''
return self.request('listStorageNetworkIpRange', args)
def updateStorageNetworkIpRange(self, args={}):
'''
Update a Storage network IP range, only allowed when no IPs in this range have
been allocated.
args - A dictionary. The following are options for keys:
id - UUID of storage network ip range
endip - the ending IP address
netmask - the netmask for storage network
startip - the beginning IP address
vlan - Optional. the vlan the ip range sits on
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('updateStorageNetworkIpRange', args)
def addNetworkDevice(self, args={}):
'''
Adds a network device of one of the following types: ExternalDhcp,
ExternalFirewall, ExternalLoadBalancer, PxeServer
args - A dictionary. The following are options for keys:
networkdeviceparameterlist - parameters for network device
networkdevicetype - Network device type, now supports ExternalDhcp,
PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer,
NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall
'''
return self.request('addNetworkDevice', args)
def listNetworkDevice(self, args={}):
'''
List network devices
args - A dictionary. The following are options for keys:
keyword - List by keyword
networkdeviceparameterlist - parameters for network device
networkdevicetype - Network device type, now supports ExternalDhcp,
PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer,
NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall
page -
pagesize -
page - Pagination
'''
return self.request('listNetworkDevice', args)
def deleteNetworkDevice(self, args={}):
'''
Deletes network device.
args - A dictionary. The following are options for keys:
id - Id of network device to delete
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteNetworkDevice', args)
def listF5LoadBalancerNetworks(self, args={}):
'''
lists network that are using a F5 load balancer device
args - A dictionary. The following are options for keys:
lbdeviceid - f5 load balancer device ID
keyword - List by keyword
page -
pagesize -
page - Pagination
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('listF5LoadBalancerNetworks', args)
def listSrxFirewallNetworks(self, args={}):
'''
lists network that are using SRX firewall device
args - A dictionary. The following are options for keys:
lbdeviceid - netscaler load balancer device ID
keyword - List by keyword
page -
pagesize -
page - Pagination
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('listSrxFirewallNetworks', args)
def listNetscalerLoadBalancerNetworks(self, args={}):
'''
lists network that are using a netscaler load balancer device
args - A dictionary. The following are options for keys:
lbdeviceid - netscaler load balancer device ID
keyword - List by keyword
page -
pagesize -
page - Pagination
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('listNetscalerLoadBalancerNetworks', args)
def createLoadBalancerRule(self, args={}):
'''
Creates a load balancer rule
args - A dictionary. The following are options for keys:
algorithm - load balancer algorithm (source, roundrobin, leastconn)
name - name of the load balancer rule
privateport - the private port of the private ip address/virtual machine
where the network traffic will be load balanced to
publicport - the public port from where the network traffic will be load
balanced from
account - the account associated with the load balancer. Must be used with
the domainId parameter.
cidrlist - the cidr list to forward traffic from
description - the description of the load balancer rule
domainid - the domain ID associated with the load balancer
networkid - The guest network this rule will be created for
openfirewall - if true, firewall rule for source/end pubic port is
automatically created; if false - firewall rule has to be created explicitely.
Has value true by default
publicipid - public ip address id from where the network traffic will be
load balanced from
zoneid - zone where the load balancer is going to be created. This parameter
is required when LB service provider is ElasticLoadBalancerVm
'''
if not 'algorithm' in args:
raise RuntimeError("Missing required argument 'algorithm'")
if not 'name' in args:
raise RuntimeError("Missing required argument 'name'")
if not 'privateport' in args:
raise RuntimeError("Missing required argument 'privateport'")
if not 'publicport' in args:
raise RuntimeError("Missing required argument 'publicport'")
return self.request('createLoadBalancerRule', args)
def deleteLoadBalancerRule(self, args={}):
'''
Deletes a load balancer rule.
args - A dictionary. The following are options for keys:
id - the ID of the load balancer rule
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteLoadBalancerRule', args)
def removeFromLoadBalancerRule(self, args={}):
'''
Removes a virtual machine or a list of virtual machines from a load balancer
rule.
args - A dictionary. The following are options for keys:
id - The ID of the load balancer rule
virtualmachineids - the list of IDs of the virtual machines that are being
removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
if not 'virtualmachineids' in args:
raise RuntimeError("Missing required argument 'virtualmachineids'")
return self.request('removeFromLoadBalancerRule', args)
def assignToLoadBalancerRule(self, args={}):
'''
Assigns virtual machine or a list of virtual machines to a load balancer rule.
args - A dictionary. The following are options for keys:
id - the ID of the load balancer rule
virtualmachineids - the list of IDs of the virtual machine that are being
assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
if not 'virtualmachineids' in args:
raise RuntimeError("Missing required argument 'virtualmachineids'")
return self.request('assignToLoadBalancerRule', args)
def createLBStickinessPolicy(self, args={}):
'''
Creates a Load Balancer stickiness policy
args - A dictionary. The following are options for keys:
lbruleid - the ID of the load balancer rule
methodname - name of the LB Stickiness policy method, possible values can be
obtained from ListNetworks API
name - name of the LB Stickiness policy
description - the description of the LB Stickiness policy
param - param list. Example:
param[0].name=cookiename¶m[0].value=LBCookie
'''
if not 'lbruleid' in args:
raise RuntimeError("Missing required argument 'lbruleid'")
if not 'methodname' in args:
raise RuntimeError("Missing required argument 'methodname'")
if not 'name' in args:
raise RuntimeError("Missing required argument 'name'")
return self.request('createLBStickinessPolicy', args)
def deleteLBStickinessPolicy(self, args={}):
'''
Deletes a LB stickiness policy.
args - A dictionary. The following are options for keys:
id - the ID of the LB stickiness policy
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('deleteLBStickinessPolicy', args)
def listLoadBalancerRules(self, args={}):
'''
Lists load balancer rules.
args - A dictionary. The following are options for keys:
account - List resources by account. Must be used with the domainId
parameter.
domainid - list only resources belonging to the domain specified
id - the ID of the load balancer rule
isrecursive - defaults to false, but if true, lists all resources from the
parent specified by the domainId till leaves.
keyword - List by keyword
listall - If set to false, list only resources belonging to the command's
caller; if set to true - list resources that the caller is authorized to see.
Default value is false
name - the name of the load balancer rule
page -
pagesize -
projectid - list firewall rules by project
publicipid - the public IP address id of the load balancer rule
virtualmachineid - the ID of the virtual machine of the load balancer rule
zoneid - the availability zone ID
page - Pagination
'''
return self.request('listLoadBalancerRules', args)
def listLBStickinessPolicies(self, args={}):
'''
Lists LBStickiness policies.
args - A dictionary. The following are options for keys:
lbruleid - the ID of the load balancer rule
keyword - List by keyword
page -
pagesize -
page - Pagination
'''
if not 'lbruleid' in args:
raise RuntimeError("Missing required argument 'lbruleid'")
return self.request('listLBStickinessPolicies', args)
def listLoadBalancerRuleInstances(self, args={}):
'''
List all virtual machine instances that are assigned to a load balancer rule.
args - A dictionary. The following are options for keys:
id - the ID of the load balancer rule
applied - true if listing all virtual machines currently applied to the load
balancer rule; default is true
keyword - List by keyword
page -
pagesize -
page - Pagination
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('listLoadBalancerRuleInstances', args)
def updateLoadBalancerRule(self, args={}):
'''
Updates load balancer
args - A dictionary. The following are options for keys:
id - the id of the load balancer rule to update
algorithm - load balancer algorithm (source, roundrobin, leastconn)
description - the description of the load balancer rule
name - the name of the load balancer rule
'''
if not 'id' in args:
raise RuntimeError("Missing required argument 'id'")
return self.request('updateLoadBalancerRule', args)
def addF5LoadBalancer(self, args={}):
'''
Adds a F5 BigIP load balancer device
args - A dictionary. The following are options for keys:
networkdevicetype - supports only F5BigIpLoadBalancer
password - Credentials to reach F5 BigIP load balancer device
physicalnetworkid - the Physical Network ID
url - URL of the F5 load balancer appliance.
username - Credentials to reach F5 BigIP load balancer device
'''
if not 'networkdevicetype' in args:
raise RuntimeError("Missing required argument 'networkdevicetype'")
if not 'password' in args:
raise RuntimeError("Missing required argument 'password'")
if not 'physicalnetworkid' in args:
raise RuntimeError("Missing required argument 'physicalnetworkid'")
if not 'url' in args:
raise RuntimeError("Missing required argument 'url'")
if not 'username' in args:
raise RuntimeError("Missing required argument 'username'")
return self.request('addF5LoadBalancer', args)
def configureF5LoadBalancer(self, args={}):
'''
configures a F5 load balancer device
args - A dictionary. The following are options for keys:
lbdeviceid - F5 load balancer device ID
lbdevicecapacity - capacity of the device, Capacity will be interpreted as
number of networks device can handle
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('configureF5LoadBalancer', args)
def deleteF5LoadBalancer(self, args={}):
'''
delete a F5 load balancer device
args - A dictionary. The following are options for keys:
lbdeviceid - netscaler load balancer device ID
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('deleteF5LoadBalancer', args)
def listF5LoadBalancers(self, args={}):
'''
lists F5 load balancer devices
args - A dictionary. The following are options for keys:
keyword - List by keyword
lbdeviceid - f5 load balancer device ID
page -
pagesize -
physicalnetworkid - the Physical Network ID
page - Pagination
'''
return self.request('listF5LoadBalancers', args)
def addNetscalerLoadBalancer(self, args={}):
'''
Adds a netscaler load balancer device
args - A dictionary. The following are options for keys:
networkdevicetype - Netscaler device type supports NetscalerMPXLoadBalancer,
NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer
password - Credentials to reach netscaler load balancer device
physicalnetworkid - the Physical Network ID
url - URL of the netscaler load balancer appliance.
username - Credentials to reach netscaler load balancer device
'''
if not 'networkdevicetype' in args:
raise RuntimeError("Missing required argument 'networkdevicetype'")
if not 'password' in args:
raise RuntimeError("Missing required argument 'password'")
if not 'physicalnetworkid' in args:
raise RuntimeError("Missing required argument 'physicalnetworkid'")
if not 'url' in args:
raise RuntimeError("Missing required argument 'url'")
if not 'username' in args:
raise RuntimeError("Missing required argument 'username'")
return self.request('addNetscalerLoadBalancer', args)
def deleteNetscalerLoadBalancer(self, args={}):
'''
delete a netscaler load balancer device
args - A dictionary. The following are options for keys:
lbdeviceid - netscaler load balancer device ID
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('deleteNetscalerLoadBalancer', args)
def configureNetscalerLoadBalancer(self, args={}):
'''
configures a netscaler load balancer device
args - A dictionary. The following are options for keys:
lbdeviceid - Netscaler load balancer device ID
inline - true if netscaler load balancer is intended to be used in in-line
with firewall, false if netscaler load balancer will side-by-side with firewall
lbdevicecapacity - capacity of the device, Capacity will be interpreted as
number of networks device can handle
lbdevicededicated - true if this netscaler device to dedicated for a
account, false if the netscaler device will be shared by multiple accounts
'''
if not 'lbdeviceid' in args:
raise RuntimeError("Missing required argument 'lbdeviceid'")
return self.request('configureNetscalerLoadBalancer', args)
def listNetscalerLoadBalancers(self, args={}):
'''
lists netscaler load balancer devices
args - A dictionary. The following are options for keys:
keyword - List by keyword
lbdeviceid - netscaler load balancer device ID
page -
pagesize -
physicalnetworkid - the Physical Network ID
page - Pagination
'''
return self.request('listNetscalerLoadBalancers', args)
def listVPCs(self,args={}):
'''
lists Virtual Private Clouds (VPCs) configured
args - A dictionary. The following are options for keys:
account - list by account associated with the VPC. Must be used
with the domainId parameter.
account - List resources by account. Must be used with the domainId parameter.
cidr - list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR
displaytext - List by display text of the VPC
domainid - list by domain ID associated with the VPC. If used with the account
parameter returns the VPC associated with the account for the specified domain.
domainid - list only resources belonging to the domain specified
id - list VPC by id false
isrecursive - defaults to false, but if true, lists all resources from the parent
specified by the domainId till leaves.
keyword - List by keyword
listall - If set to false, list only resources belonging to the command's caller;
if set to true - list resources that the caller is authorized to see. Default
value is false
name - list by name of the VPC
page -
pagesize -
projectid - list objects by project
restartrequired - list VPCs by restartRequired option
state - list VPCs by state
supportedservices - list VPC supporting certain services
tags - List resources by tags (key/value pairs)
vpcofferingid - list by ID of the VPC offering
zoneid - list by zone
'''
return self.request('listVPCs',args)
def deployVirtualMachine(self, args={}):
'''
Creates and automatically starts a virtual machine based on a service offering,
disk offering, and template.
args - A dictionary. The following are options for keys:
serviceofferingid - the ID of the service offering for the virtual machine
templateid - the ID of the template for the virtual machine
zoneid - availability zone for the virtual machine
account - an optional account for the virtual machine. Must be used with
domainId.
diskofferingid - the ID of the disk offering for the virtual machine. If the
template is of ISO format, the diskOfferingId is for the root disk volume.
Otherwise this parameter is used to indicate the offering for the data disk
volume. If the templateId parameter passed is from a Template object, the
diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter
passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume
created.
displayname - an optional user generated name for the virtual machine
domainid - an optional domainId for the virtual machine. If the account
parameter is used, domainId must also be used.
group - an optional group for the virtual machine
hostid - destination Host ID to deploy the VM to - parameter available for
root admin only
hypervisor - the hypervisor on which to deploy the virtual machine
ipaddress - the ip address for default vm's network
iptonetworklist - ip to network mapping. Can't be specified with networkIds
parameter. Example:
iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=204 - requests to
use ip 10.10.10.11 in network id=204
keyboard - an optional keyboard device type for the virtual machine. valid
value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us
keypair - name of the ssh key pair used to login to the virtual machine
name - host name for the virtual machine
networkids - list of network ids used by virtual machine. Can't be specified
with ipToNetworkList parameter
projectid - Deploy vm for the project
securitygroupids - comma separated list of security groups id that going to
be applied to the virtual machine. Should be passed only when vm is created from
a zone with Basic Network support. Mutually exclusive with securitygroupnames
parameter