forked from FreeshardBase/freeshard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanagement_mock.py
More file actions
45 lines (32 loc) · 860 Bytes
/
management_mock.py
File metadata and controls
45 lines (32 loc) · 860 Bytes
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
36
37
38
39
40
41
42
43
44
45
from datetime import datetime, timedelta
from fastapi import FastAPI, Request
from starlette import status
from shard_core.model.profile import Profile
app = FastAPI()
@app.get('/')
def root(request: Request):
base_url = request.base_url
return {
'profile': f'{base_url}profile'
}
@app.get('/profile')
def get_profile():
return Profile(
vm_id='mock_vm_id',
owner='Mock Owner',
owner_email='mock_owner@freeshard.net',
time_created=datetime.now() - timedelta(days=2),
time_assigned=datetime.now() - timedelta(minutes=5),
delete_after=datetime.now() + timedelta(days=4),
vm_size='xs',
max_vm_size='m',
)
@app.post('/resize')
def resize():
return status.HTTP_204_NO_CONTENT
@app.post('/app_usage')
def app_usage():
return status.HTTP_201_CREATED
@app.get('/sharedSecret')
def get_shared_secret():
return 'staticSharedSecret'