summaryrefslogtreecommitdiff
path: root/heatclient/v1/software_deployments.py
diff options
context:
space:
mode:
authorSteve Baker <sbaker@redhat.com>2014-02-03 09:05:29 +1300
committerJUNJIE NAN <nanjj@cn.ibm.com>2014-02-17 10:31:33 +0800
commitb58202caa778afa97721f8930913f9143d92b692 (patch)
treecb62d612d60a5e67a3e6e816fc4ec39965460f8c /heatclient/v1/software_deployments.py
parent42099da4b3fc0d824897eaa0a16f86209db2beb9 (diff)
downloadpython-heatclient-b58202caa778afa97721f8930913f9143d92b692.tar.gz
Add support for software config resources
SoftwareConfig lacks update methods as it is immutable. Implements: blueprint hot-software-config-rest Change-Id: I1d05433303c182f03d21378fd66af4f589b7821b
Diffstat (limited to 'heatclient/v1/software_deployments.py')
-rw-r--r--heatclient/v1/software_deployments.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/heatclient/v1/software_deployments.py b/heatclient/v1/software_deployments.py
new file mode 100644
index 0000000..a58bba8
--- /dev/null
+++ b/heatclient/v1/software_deployments.py
@@ -0,0 +1,66 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+import copy
+
+from heatclient.openstack.common.apiclient import base
+from heatclient.openstack.common.py3kcompat import urlutils
+
+
+class SoftwareDeployment(base.Resource):
+ def __repr__(self):
+ return "<SoftwareDeployment %s>" % self._info
+
+ def update(self, **fields):
+ self.manager.update(deployment_id=self.id, **fields)
+
+ def delete(self):
+ return self.manager.delete(deployment_id=self.id)
+
+ def to_dict(self):
+ return copy.deepcopy(self._info)
+
+
+class SoftwareDeploymentManager(base.BaseManager):
+ resource_class = SoftwareDeployment
+
+ def list(self, **kwargs):
+ """Get a list of software deployments.
+ :rtype: list of :class:`SoftwareDeployment`
+ """
+ url = '/software_deployments?%s' % urlutils.urlencode(kwargs)
+ return self._list(url, "software_deployments")
+
+ def get(self, deployment_id):
+ """Get the details for a specific software deployment.
+
+ :param deployment_id: ID of the software deployment
+ """
+ resp, body = self.client.json_request(
+ 'GET', '/software_deployments/%s' % deployment_id)
+
+ return SoftwareDeployment(self, body['software_deployment'])
+
+ def create(self, **kwargs):
+ """Create a software deployment."""
+ resp, body = self.client.json_request(
+ 'POST', '/software_deployments', data=kwargs)
+ return SoftwareDeployment(self, body['software_deployment'])
+
+ def update(self, deployment_id, **kwargs):
+ """Update a software deployment."""
+ resp, body = self.client.json_request(
+ 'PUT', '/software_deployments/%s' % deployment_id, data=kwargs)
+ return SoftwareDeployment(self, body['software_deployment'])
+
+ def delete(self, deployment_id):
+ """Delete a software deployment."""
+ self._delete("/software_deployments/%s" % deployment_id)