diff --git a/CloudStack/Client.py b/CloudStack/Client.py index f7563b8..7abc778 100644 --- a/CloudStack/Client.py +++ b/CloudStack/Client.py @@ -557,7 +557,38 @@ def listNetscalerLoadBalancerNetworks(self, args={}): raise RuntimeError("Missing required argument 'lbdeviceid'") return self.request('listNetscalerLoadBalancerNetworks', args) - + + def createLoadBalancer(self, args={}): + ''' + Create a load-balancer instance + args - A dictionary. The following are options for keys: + algorithm - load balancer algorithm (source, roundrobin, leastconn) + name - name of the load balancer rule + instanceport - the TCP port of the virtual machine where the network traffic will be load balanced to + networkid - The guest network the Load Balancer will be created for + scheme - the load balancer scheme. Supported value in this release is Internal + sourceipaddressnetworkid - the network id of the source ip address + sourceport - the source port the network traffic will be load balanced from + description - (optional) the description of the Load Balancer + sourceipaddress - (optional) the source ip address the network traffic will be load balanced from + ''' + + if not 'algorithm' in args: + raise RuntimeError("Missing required argument 'algorithm'") + if not 'name' in args: + raise RuntimeError("Missing required argument 'name'") + if not 'instanceport' in args: + raise RuntimeError("Missing required argument 'instanceport'") + if not 'networkid' in args: + raise RuntimeError("Missing required argument 'networkid'") + if not 'scheme' in args: + raise RuntimeError("Missing required argument 'scheme'") + if not 'sourceipaddressnetworkid' in args: + raise RuntimeError("Missing required argument 'sourceipaddressnetworkid'") + if not 'sourceport' in args: + raise RuntimeError("Missing required argument 'sourceport'") + + return self.request('createLoadBalancer', args) def createLoadBalancerRule(self, args={}): ''' @@ -5157,5 +5188,115 @@ def listAlerts(self, args={}): ''' return self.request('listAlerts', args) + + def createTags(self, args={}): + ''' + Creates resource tag(s) + args - A dictionary. The following are options for keys: + resourceids - list of resources to create the tags for + resourcetype - type of the resource + tags - Map of tags (key/value pairs) RE: tags[0].value, tags[0].key + customer - identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally. optional + ''' + if not 'resourceIds' in args: + raise RuntimeError("Missing required argument 'resourceIds'") + if not 'resourceType' in args: + raise RuntimeError("Missing required argument 'resourceType'") + if not 'tags[0].key' in args: + raise RuntimeError("Missing required argument 'tags[0].key'") + if not 'tags[0].value' in args: + raise RuntimeError("Missing required argument 'tags[0].value'") + + return self.request('createTags', args) + + def listTags(self, args={}): + ''' + List resource tag(s) + + args - A dictionary. The following are options for keys: + accountList - resources by account. Must be used with the domainId parameter. Optional + customer - list by customer name. Optional + domainid - list only resources belonging to the domain specified. Optional + isrecursive - defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves. Optional + key - list by key. Optional + keyword - List by keyword. Optional + 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. Optional + page - Optional + pagesize - Optional + projectid - list objects by project. Optional + resourceid - list by resource id. Optional + resourcetype - list by resource type. Optional + value - list by value. Optional + ''' + return self.request('listTags', args) + + def deleteTags(self, args={}): + ''' + Delete resource tag(s) + + args - A dictionary. The following are options for keys: + resourceids - list of resources to create the tags for + resourcetype - type of the resource + tags - Map of tags (key/value pairs). Optional + ''' + if not 'resourceIds' in args: + raise RuntimeError("Missing required argument 'resourceIds'") + if not 'resourceType' in args: + raise RuntimeError("Missing required argument 'resourceType'") + + return self.request('deleteTags', args) + + def createAffinityGroup(self, args={}): + ''' + Create affinity group + + args - A dictionary. The following are options for keys: + name - name of the affinity group + type - Type of the affinity group from the available affinity/anti-affinity group types + account - an account for the affinity group. Must be used with domainId. Optional + description - optional description of the affinity group. Optional + domainid - domainId of the account owning the affinity group. Optional + ''' + if not 'name' in args: + raise RuntimeError("Missing required argument 'name'") + if not 'type' in args: + raise RuntimeError("Missing required argument 'type'") + + return self.request('createAffinityGroup', args) + + def deleteAffinityGroup(self, args={}): + ''' + Delete affinity group + + args - A dictionary. The following are options for keys: + name - name of the affinity group. Optional + account - an account for the affinity group. Must be used with domainId. Optional + domainid - domainId of the account owning the affinity group. Optional + id - The ID of the affinity group. Mutually exclusive with name parameter. Optional + ''' + if not 'name' in args: + raise RuntimeError("Missing required argument 'name'") + + return self.request('deleteAffinityGroup', args) + + + def listAffinityGroups(self, args={}): + ''' + List affinity group + + args - A dictionary. The following are options for keys: + account - list resources by account. Must be used with the domainId parameter. default: false + domainid - list only resources belonging to the domain specified. default: false + id - list the affinity group by the id provided. default: false + isrecursive - defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves. default: false + keyword - List by keyword. default: false + 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: false + name - lists affinity groups by name. default: false + page - default: false + pagesize - default: false + type - lists affinity groups by type. default: false + virtualmachineid - lists affinity groups by virtual machine id. default: false + ''' + return self.request('listAffinityGroups', args) diff --git a/setup.py b/setup.py index 33d7ad3..1016e6a 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( name = 'CloudStack', - version = '0.1', + version = '0.2.3', description = "CloudStack API v2.2 Client", long_description = "Python interface CloudStack v2.2 API", author = "Jason Hancock",