Revision d2cea1e2 kamaki/clients/compute.py
b/kamaki/clients/compute.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
""" |
|
35 |
OpenStack Compute API 1.1 client |
|
36 |
""" |
|
37 |
|
|
38 | 34 |
import json |
39 | 35 |
|
40 | 36 |
from .http import HTTPClient |
41 | 37 |
|
42 | 38 |
|
43 |
class ComputeClient(HTTPClient): |
|
39 |
class ComputeClient(HTTPClient): |
|
40 |
"""OpenStack Compute API 1.1 client""" |
|
41 |
|
|
42 |
@property |
|
43 |
def url(self): |
|
44 |
url = self.config.get('compute_url') or self.config.get('url') |
|
45 |
if not url: |
|
46 |
raise ClientError('No URL was given') |
|
47 |
return url |
|
48 |
|
|
49 |
@property |
|
50 |
def token(self): |
|
51 |
token = self.config.get('compute_token') or self.config.get('token') |
|
52 |
if not token: |
|
53 |
raise ClientError('No token was given') |
|
54 |
return token |
|
55 |
|
|
44 | 56 |
def list_servers(self, detail=False): |
45 | 57 |
"""List servers, returned detailed output if detailed is True""" |
46 | 58 |
path = '/servers/detail' if detail else '/servers' |
Also available in: Unified diff