Bird
0
0

You want to deploy a function that triggers on new files in a Cloud Storage bucket named my-bucket. Which command correctly sets this trigger?

hard📝 Application Q15 of 15
GCP - Cloud Functions
You want to deploy a function that triggers on new files in a Cloud Storage bucket named my-bucket. Which command correctly sets this trigger?
Agcloud functions deploy processFile --runtime python39 --trigger-http
Bgcloud functions deploy processFile --runtime python39 --trigger-topic my-bucket
Cgcloud functions deploy processFile --runtime python39 --trigger-resource my-bucket --trigger-event google.storage.object.finalize
Dgcloud functions deploy processFile --runtime python39 --trigger-bucket my-bucket
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct trigger for Cloud Storage

    Cloud Storage triggers use '--trigger-resource' with bucket name and '--trigger-event' with event type like 'google.storage.object.finalize'.
  2. Step 2: Check options

    gcloud functions deploy processFile --runtime python39 --trigger-resource my-bucket --trigger-event google.storage.object.finalize correctly uses '--trigger-resource my-bucket' and '--trigger-event google.storage.object.finalize'. Others use wrong triggers.
  3. Final Answer:

    gcloud functions deploy processFile --runtime python39 --trigger-resource my-bucket --trigger-event google.storage.object.finalize -> Option C
  4. Quick Check:

    Storage trigger = resource + event flags [OK]
Quick Trick: Use --trigger-resource and --trigger-event for storage triggers [OK]
Common Mistakes:
  • Using --trigger-http for storage events
  • Using --trigger-topic instead of resource/event
  • Using non-existent --trigger-bucket flag

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes