-
Notifications
You must be signed in to change notification settings - Fork 877
/
Copy path__main__.py
58 lines (49 loc) · 1.48 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
from pulumi_gcp import storage, cloudfunctions
from pulumi import export, asset
bucket = storage.Bucket("bucket", location="US")
py_bucket_object = storage.BucketObject(
"python-zip",
bucket=bucket.name,
source=asset.AssetArchive({".": asset.FileArchive("./pythonfunc")}),
)
py_function = cloudfunctions.Function(
"python-func",
source_archive_bucket=bucket.name,
runtime="python37",
source_archive_object=py_bucket_object.name,
entry_point="handler",
trigger_http=True,
available_memory_mb=128,
)
py_invoker = cloudfunctions.FunctionIamMember(
"py-invoker",
project=py_function.project,
region=py_function.region,
cloud_function=py_function.name,
role="roles/cloudfunctions.invoker",
member="allUsers",
)
export("python_endpoint", py_function.https_trigger_url)
go_bucket_object = storage.BucketObject(
"go-zip",
bucket=bucket.name,
source=asset.AssetArchive({".": asset.FileArchive("./gofunc")}),
)
go_function = cloudfunctions.Function(
"go-func",
source_archive_bucket=bucket.name,
runtime="go120",
source_archive_object=go_bucket_object.name,
entry_point="Handler",
trigger_http=True,
available_memory_mb=128,
)
go_invoker = cloudfunctions.FunctionIamMember(
"go-invoker",
project=go_function.project,
region=go_function.region,
cloud_function=go_function.name,
role="roles/cloudfunctions.invoker",
member="allUsers",
)
export("go_endpoint", go_function.https_trigger_url)