1

Following up to this thread since I can't comment.

I've successfully created object change notifications as instructed by @Brandon Yarbrough (thanks!).

But I would like to narrow down the monitoring from the entire bucket to a sub-folder. For example, from 'gs://mainbucket/' to 'gs://mainbucket/subfolder1/'. However, attempting this in the same syntax returns this error.

CommandException: notification create requires a GCS bucket name, but got 'gs://mainbucket/subfolder1/'

How should this function be implemented instead?

Larry Cai
  • 881
  • 1
  • 11
  • 24
  • i followed the same thread @Brandon Yarbrough, yet my script waiting saying Listening for messages on projects/bold-proton-236611/subscriptions/projects/bold-proton-236611/subscriptions/subtestbucketthhh any idea or how can i checked my subscripbion , topic , is configured with my bucket – syed irfan Jul 10 '19 at 05:55
  • @syedirfan I'm not exactly sure what error you're getting, but these are common commands I use to check on pubsub `gcloud pubsub subscriptions list`, `notification list gs://$PROJECT` (use your own project_id), and `gcloud app services list` – Larry Cai Jul 25 '19 at 07:45

1 Answers1

3

You need to specify the sub-folder as a prefix of the objects that are uploaded in the bucket. You do that by adding -p sub-folder.

From the example in the other thread:

$ gsutil notification create \
    -t pubsup-topic-name -f json \
    -e OBJECT_FINALIZE \
    -p subfolder1/ gs://mainbucket
TasosZG
  • 1,274
  • 1
  • 6
  • 13
  • is there any way where i can check that my subscription & topic is configured with my bucket i followed the same thread yet unable to receive notification – syed irfan Jul 10 '19 at 05:57