~ubuntu-branches/ubuntu/trusty/python-heatclient/trusty-proposed

« back to all changes in this revision

Viewing changes to heatclient/v1/actions.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-07-19 13:04:38 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130719130438-95oatgbus97v9b8u
Tags: 0.2.3-0ubuntu1
* New upstream release. 
* Enabled testsuite.
* debian/control:
  - Dropped python-nose.
  - Add python-fixtures.
  - Add python-testscenarios.
  - Add python-testrepository.
  - Add python-testtools.
  - Add python-d2to1.
  - Add python-pbr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
4
#    not use this file except in compliance with the License. You may obtain
 
5
#    a copy of the License at
 
6
#
 
7
#         http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
#    Unless required by applicable law or agreed to in writing, software
 
10
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
11
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
12
#    License for the specific language governing permissions and limitations
 
13
#    under the License.
 
14
 
 
15
from heatclient.common import base
 
16
from heatclient.v1 import stacks
 
17
 
 
18
DEFAULT_PAGE_SIZE = 20
 
19
 
 
20
 
 
21
class Action(base.Resource):
 
22
    def __repr__(self):
 
23
        return "<Action %s>" % self._info
 
24
 
 
25
    def update(self, **fields):
 
26
        self.manager.update(self, **fields)
 
27
 
 
28
    def delete(self):
 
29
        return self.manager.delete(self)
 
30
 
 
31
    def data(self, **kwargs):
 
32
        return self.manager.data(self, **kwargs)
 
33
 
 
34
 
 
35
class ActionManager(stacks.StackChildManager):
 
36
    resource_class = Action
 
37
 
 
38
    def suspend(self, stack_id):
 
39
        """Suspend a stack."""
 
40
        body = {'suspend': None}
 
41
        resp, body = self.api.json_request('POST',
 
42
                                           '/stacks/%s/actions' % stack_id,
 
43
                                           body=body)
 
44
 
 
45
    def resume(self, stack_id):
 
46
        """Resume a stack."""
 
47
        body = {'resume': None}
 
48
        resp, body = self.api.json_request('POST',
 
49
                                           '/stacks/%s/actions' % stack_id,
 
50
                                           body=body)