{"id":92,"description":"gcp -  cloud functions: manage functions with gcloud CLI","tags":["commands","gcp","cloud functions"],"contents":["# To list deployed functions","gcloud functions list","","# To deploy new functions or update an existing function","gcloud functions deploy","","# example: deploy a function with source code from local machine, python3.11 as runtime and pubsub topic as trigger","# To set up google cloud functions with environment variables specified in a yaml file, use `--env-vars-file` option","","    gcloud functions deploy my-gcp-func \\","        --gen2 \\","        --region=us-central1 \\ # region to deploy","        --runtime=python311 \\ # python 3.11 as the runtime","        --source=. \\ # deploy with source code from current directory on the local machine","        --entry-point=cloud_event_handler \\ # entry point function in main.py","        --trigger-topic=pubsub-topic \\","        --env-vars-file .env.yaml # file with list of environment variables to set up","","# Delete a cloud function","gcloud functions delete my-gcp-func","","# View logs from a cloud function","gcloud functions logs read my-gcp-func"]}
