From 2f968e6472bab68541e73324dae871086676d208 Mon Sep 17 00:00:00 2001 From: Jona Date: Tue, 10 Oct 2023 13:01:41 -0400 Subject: [PATCH] Comment out some stack --- stack/cloud_function_ais_analysis.py | 106 ++++++++++++++------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/stack/cloud_function_ais_analysis.py b/stack/cloud_function_ais_analysis.py index 8717a4c5..56dd5971 100644 --- a/stack/cloud_function_ais_analysis.py +++ b/stack/cloud_function_ais_analysis.py @@ -1,10 +1,12 @@ """cloud function to find slick culprits from AIS tracks""" -import os -import time +# import os +# import time import database import pulumi -from pulumi_gcp import cloudfunctions, cloudtasks, projects, serviceaccount, storage +from pulumi_gcp import cloudtasks, storage + +# from pulumi_gcp import cloudfunctions, cloudtasks, projects, serviceaccount, storage from utils import construct_name stack = pulumi.get_stack() @@ -50,58 +52,58 @@ # The Cloud Function source code itself needs to be zipped up into an # archive, which we create using the pulumi.AssetArchive primitive. PATH_TO_SOURCE_CODE = "../cerulean_cloud/cloud_function_ais_analysis" -assets = {} -for file in os.listdir(PATH_TO_SOURCE_CODE): - location = os.path.join(PATH_TO_SOURCE_CODE, file) - asset = pulumi.FileAsset(path=location) - assets[file] = asset +# assets = {} +# for file in os.listdir(PATH_TO_SOURCE_CODE): +# location = os.path.join(PATH_TO_SOURCE_CODE, file) +# asset = pulumi.FileAsset(path=location) +# assets[file] = asset -archive = pulumi.AssetArchive(assets=assets) +# archive = pulumi.AssetArchive(assets=assets) -# Create the single Cloud Storage object, which contains all of the function's -# source code. ("main.py" and "requirements.txt".) -source_archive_object = storage.BucketObject( - construct_name("source-cloud-function-ais"), - name="handler.py-%f" % time.time(), - bucket=bucket.name, - source=archive, -) +# # Create the single Cloud Storage object, which contains all of the function's +# # source code. ("main.py" and "requirements.txt".) +# source_archive_object = storage.BucketObject( +# construct_name("source-cloud-function-ais"), +# name="handler.py-%f" % time.time(), +# bucket=bucket.name, +# source=archive, +# ) -# Assign access to cloud SQL -cloud_function_service_account = serviceaccount.Account( - construct_name("cloud-function-ais"), - account_id=f"{stack}-cloud-function-ais", - display_name="Service Account for cloud function.", -) -cloud_function_service_account_iam = projects.IAMMember( - construct_name("cloud-function-ais-iam"), - project=pulumi.Config("gcp").require("project"), - role="projects/cerulean-338116/roles/cloudfunctionaisanalysisrole", - member=cloud_function_service_account.email.apply( - lambda email: f"serviceAccount:{email}" - ), -) +# # Assign access to cloud SQL +# cloud_function_service_account = serviceaccount.Account( +# construct_name("cloud-function-ais"), +# account_id=f"{stack}-cloud-function-ais", +# display_name="Service Account for cloud function.", +# ) +# cloud_function_service_account_iam = projects.IAMMember( +# construct_name("cloud-function-ais-iam"), +# project=pulumi.Config("gcp").require("project"), +# role="projects/cerulean-338116/roles/cloudfunctionaisanalysisrole", +# member=cloud_function_service_account.email.apply( +# lambda email: f"serviceAccount:{email}" +# ), +# ) -fxn = cloudfunctions.Function( - function_name, - name=function_name, - entry_point="main", - environment_variables=config_values, - region=pulumi.Config("gcp").require("region"), - runtime="python38", - source_archive_bucket=bucket.name, - source_archive_object=source_archive_object.name, - trigger_http=True, - service_account_email=cloud_function_service_account.email, -) +# fxn = cloudfunctions.Function( +# function_name, +# name=function_name, +# entry_point="main", +# environment_variables=config_values, +# region=pulumi.Config("gcp").require("region"), +# runtime="python38", +# source_archive_bucket=bucket.name, +# source_archive_object=source_archive_object.name, +# trigger_http=True, +# service_account_email=cloud_function_service_account.email, +# ) -invoker = cloudfunctions.FunctionIamMember( - construct_name("cloud-function-ais-invoker"), - project=fxn.project, - region=fxn.region, - cloud_function=fxn.name, - role="roles/cloudfunctions.invoker", - member="allUsers", -) +# invoker = cloudfunctions.FunctionIamMember( +# construct_name("cloud-function-ais-invoker"), +# project=fxn.project, +# region=fxn.region, +# cloud_function=fxn.name, +# role="roles/cloudfunctions.invoker", +# member="allUsers", +# ) -config_values["FUNCTION_URL"] = fxn.https_trigger_url +# config_values["FUNCTION_URL"] = fxn.https_trigger_url