diff options
author | lvdongbing <dongbing.lv@kylin-cloud.com> | 2015-10-28 21:37:45 -0400 |
---|---|---|
committer | lvdongbing <dongbing.lv@kylin-cloud.com> | 2015-10-30 04:36:31 -0400 |
commit | 4c53ed854c439e01ebf98b2ff54da3ba36a916b3 (patch) | |
tree | 219b730b0638e2e706dac27e1fa9eee4b4f500eb /heatclient/v1/software_configs.py | |
parent | d53b542f29cfc9250a8a671fd5f195802c34e6bf (diff) | |
download | python-heatclient-4c53ed854c439e01ebf98b2ff54da3ba36a916b3.tar.gz |
Support to list software configs
As API has supported to list software configs, client should support
too.
Closes-Bug: #1464248
Change-Id: I977b960f0e2f0e754a603c01122eb41f0ea9dbf5
Diffstat (limited to 'heatclient/v1/software_configs.py')
-rw-r--r-- | heatclient/v1/software_configs.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/heatclient/v1/software_configs.py b/heatclient/v1/software_configs.py index dd3264d..bc94828 100644 --- a/heatclient/v1/software_configs.py +++ b/heatclient/v1/software_configs.py @@ -10,6 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +import six +from six.moves.urllib import parse + from heatclient.common import utils from heatclient.openstack.common.apiclient import base @@ -28,6 +31,26 @@ class SoftwareConfig(base.Resource): class SoftwareConfigManager(base.BaseManager): resource_class = SoftwareConfig + def list(self, **kwargs): + """Get a list of software configs. + :rtype: list of :class:`SoftwareConfig` + """ + qparams = {} + + for opt, val in six.iteritems(kwargs): + if val: + qparams[opt] = val + + # Transform the dict to a sequence of two-element tuples in fixed + # order, then the encoded string will be consistent in Python 2&3. + if qparams: + new_qparams = sorted(qparams.items(), key=lambda x: x[0]) + query_string = "?%s" % parse.urlencode(new_qparams) + else: + query_string = "" + url = '/software_configs%s' % query_string + return self._list(url, "software_configs") + def get(self, config_id): """Get the details for a specific software config. |