summaryrefslogtreecommitdiff
path: root/heatclient/v1
diff options
context:
space:
mode:
Diffstat (limited to 'heatclient/v1')
-rw-r--r--heatclient/v1/client.py7
-rw-r--r--heatclient/v1/software_configs.py53
-rw-r--r--heatclient/v1/software_deployments.py66
3 files changed, 126 insertions, 0 deletions
diff --git a/heatclient/v1/client.py b/heatclient/v1/client.py
index 827a4fc..2ce7302 100644
--- a/heatclient/v1/client.py
+++ b/heatclient/v1/client.py
@@ -19,6 +19,8 @@ from heatclient.v1 import build_info
from heatclient.v1 import events
from heatclient.v1 import resource_types
from heatclient.v1 import resources
+from heatclient.v1 import software_configs
+from heatclient.v1 import software_deployments
from heatclient.v1 import stacks
@@ -42,3 +44,8 @@ class Client(object):
self.events = events.EventManager(self.http_client)
self.actions = actions.ActionManager(self.http_client)
self.build_info = build_info.BuildInfoManager(self.http_client)
+ self.software_deployments = \
+ software_deployments.SoftwareDeploymentManager(
+ self.http_client)
+ self.software_configs = software_configs.SoftwareConfigManager(
+ self.http_client)
diff --git a/heatclient/v1/software_configs.py b/heatclient/v1/software_configs.py
new file mode 100644
index 0000000..9fa77d3
--- /dev/null
+++ b/heatclient/v1/software_configs.py
@@ -0,0 +1,53 @@
+# 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
+
+
+class SoftwareConfig(base.Resource):
+ def __repr__(self):
+ return "<SoftwareConfig %s>" % self._info
+
+ def delete(self):
+ return self.manager.delete(config_id=self.id)
+
+ def data(self, **kwargs):
+ return self.manager.data(self, **kwargs)
+
+ def to_dict(self):
+ return copy.deepcopy(self._info)
+
+
+class SoftwareConfigManager(base.BaseManager):
+ resource_class = SoftwareConfig
+
+ def get(self, config_id):
+ """Get the details for a specific software config.
+
+ :param config_id: ID of the software config
+ """
+ resp, body = self.client.json_request(
+ 'GET', '/software_configs/%s' % config_id)
+
+ return SoftwareConfig(self, body['software_config'])
+
+ def create(self, **kwargs):
+ """Create a software config."""
+ resp, body = self.client.json_request('POST', '/software_configs',
+ data=kwargs)
+
+ return SoftwareConfig(self, body['software_config'])
+
+ def delete(self, config_id):
+ """Delete a software config."""
+ self._delete("/software_configs/%s" % config_id)
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)