blob: 8ce63493754dce2983ea7fbff4ddf4a40c825fa5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
from pecan import expose
from pecan.rest import RestController
from restful import context
from restful.decorators import auth
class ServerFqdn(RestController):
def __init__(self, fqdn):
self.fqdn = fqdn
@expose(template='json')
@auth
def get(self, **kwargs):
"""
Show the information for the server fqdn
"""
return context.instance.get_server(self.fqdn)
class Server(RestController):
@expose(template='json')
@auth
def get(self, **kwargs):
"""
Show the information for all the servers
"""
return context.instance.list_servers()
@expose()
def _lookup(self, fqdn, *remainder):
return ServerFqdn(fqdn), remainder
|