From f8ec179446a8881e255fa62937a4b92faa725f28 Mon Sep 17 00:00:00 2001 From: Douglas Land Date: Fri, 31 Jan 2014 14:49:37 -0600 Subject: [PATCH 1/8] updated Client to support tags --- CloudStack/Client.py | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/CloudStack/Client.py b/CloudStack/Client.py index f7563b8..b851ee1 100644 --- a/CloudStack/Client.py +++ b/CloudStack/Client.py @@ -5157,5 +5157,61 @@ 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) From 2cdbfbb6bffd90fc074ac196bd798091323cebdf Mon Sep 17 00:00:00 2001 From: Douglas Land Date: Tue, 8 Apr 2014 11:47:37 -0500 Subject: [PATCH 2/8] added createLoadBalancer --- CloudStack/Client.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/CloudStack/Client.py b/CloudStack/Client.py index b851ee1..9b6fb9c 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={}): ''' From d8fea79551a39edf3f9f7397d6d8fffc77abf265 Mon Sep 17 00:00:00 2001 From: Douglas Land Date: Thu, 18 Aug 2016 21:52:00 -0500 Subject: [PATCH 3/8] added support of for creating affinity groups --- CloudStack/Client.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CloudStack/Client.py b/CloudStack/Client.py index 9b6fb9c..cbca277 100644 --- a/CloudStack/Client.py +++ b/CloudStack/Client.py @@ -5246,3 +5246,40 @@ def deleteTags(self, args={}): raise RuntimeError("Missing required argument 'resourceType'") return self.request('deleteTags', args) + + def createAffinityGroup(self, args={}): + ''' + Delete resource tag(s) + + 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 createAffinityGroup(self, args={}): + ''' + Delete resource tag(s) + + 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) + From b678bfe9e17f830c8410f14d4e302eb5253f6abe Mon Sep 17 00:00:00 2001 From: Douglas Land Date: Fri, 19 Aug 2016 11:27:21 -0500 Subject: [PATCH 4/8] added function to delete affinity groups --- CloudStack/Client.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CloudStack/Client.py b/CloudStack/Client.py index cbca277..5cd402f 100644 --- a/CloudStack/Client.py +++ b/CloudStack/Client.py @@ -5267,7 +5267,7 @@ def createAffinityGroup(self, args={}): def createAffinityGroup(self, args={}): ''' - Delete resource tag(s) + Create affinity group args - A dictionary. The following are options for keys: name - name of the affinity group @@ -5283,3 +5283,20 @@ def createAffinityGroup(self, args={}): 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'") + if not 'type' in args: + raise RuntimeError("Missing required argument 'type'") + + return self.request('deleteAffinityGroup', args) + From ea5dc47eaac4622fdf160f370f27aee469330464 Mon Sep 17 00:00:00 2001 From: Michael Brock Date: Wed, 14 Sep 2016 11:34:35 -0500 Subject: [PATCH 5/8] Remove duplicate "createAffinityGroup" function, remove "type" requirement from "deleteAffinityGroup" function. --- CloudStack/Client.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/CloudStack/Client.py b/CloudStack/Client.py index 5cd402f..dce557a 100644 --- a/CloudStack/Client.py +++ b/CloudStack/Client.py @@ -5247,24 +5247,6 @@ def deleteTags(self, args={}): return self.request('deleteTags', args) - def createAffinityGroup(self, args={}): - ''' - Delete resource tag(s) - - 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 createAffinityGroup(self, args={}): ''' Create affinity group @@ -5295,8 +5277,6 @@ def deleteAffinityGroup(self, args={}): ''' 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('deleteAffinityGroup', args) From 32995bb9ad022d5d39d81ea042ebbfa61ef3b031 Mon Sep 17 00:00:00 2001 From: Michael Brock Date: Wed, 14 Sep 2016 12:03:37 -0500 Subject: [PATCH 6/8] Update version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 33d7ad3..96fff90 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( name = 'CloudStack', - version = '0.1', + version = '0.2.2', description = "CloudStack API v2.2 Client", long_description = "Python interface CloudStack v2.2 API", author = "Jason Hancock", From 417c579030da74e803f3b27c5b256906646c2ab3 Mon Sep 17 00:00:00 2001 From: Douglas Land Date: Wed, 28 Sep 2016 14:21:29 -0500 Subject: [PATCH 7/8] add listAffinityGroups --- CloudStack/Client.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CloudStack/Client.py b/CloudStack/Client.py index dce557a..7abc778 100644 --- a/CloudStack/Client.py +++ b/CloudStack/Client.py @@ -5280,3 +5280,23 @@ def deleteAffinityGroup(self, args={}): 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) + From 704e864169a5eaf39a8f4c4cbf9b1d4b041c1de5 Mon Sep 17 00:00:00 2001 From: Douglas Land Date: Wed, 28 Sep 2016 14:22:21 -0500 Subject: [PATCH 8/8] version update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 96fff90..1016e6a 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( name = 'CloudStack', - version = '0.2.2', + version = '0.2.3', description = "CloudStack API v2.2 Client", long_description = "Python interface CloudStack v2.2 API", author = "Jason Hancock",