-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
61 lines (43 loc) · 1.63 KB
/
main.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# pylint: disable=fixme,invalid-name,no-member,unused-argument
"""Module containing Google Cloud functions for deployment."""
import functions_framework
import sentry_sdk
from kokon.functions import accommodation, guest, host, user
from kokon import settings
from kokon.utils.functions import function_wrapper
# See https://github.com/getsentry/sentry-python/issues/1081
sentry_sdk.init( # pylint: disable=abstract-class-instantiated # noqa: E0110
settings.SENTRY_DSN,
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=settings.SENTRY_TRACES_SAMPLE_RATE,
)
@functions_framework.http
@function_wrapper
def accommodation_function(request):
"""HTTP Cloud Function for handling accommodations objects."""
return accommodation.accommodation_function(request)
@functions_framework.http
@function_wrapper
def guest_function(request):
"""HTTP Cloud Function for handling guest objects."""
return guest.guest_function(request)
@functions_framework.http
@function_wrapper
def host_function(request):
"""HTTP Cloud Function for handling host objects."""
return host.host_function(request)
@functions_framework.http
@function_wrapper
def get_all_users(request):
"""HTTP Cloud Function for getting all users."""
return user.handle_get_all_users(request)
@functions_framework.http
@function_wrapper
def registration(request):
"""HTTP Cloud Function for host registration."""
return host.handle_registration(request)
if __name__ == "__main__":
from kokon.commands import cli
cli()