https://github.com/ricardolsmendes/gcp-storage-class-match-notifier
Google Cloud Function that publishes messages to Pub/Sub when the metadata of a GCS object changes and the object's storage class matches given criteria — e.g., == ARCHIVE.
https://github.com/ricardolsmendes/gcp-storage-class-match-notifier
cloud-storage cloud-storage-bucket events gcp google-cloud google-cloud-functions google-cloud-platform pubsub
Last synced: 3 months ago
JSON representation
Google Cloud Function that publishes messages to Pub/Sub when the metadata of a GCS object changes and the object's storage class matches given criteria — e.g., == ARCHIVE.
- Host: GitHub
- URL: https://github.com/ricardolsmendes/gcp-storage-class-match-notifier
- Owner: ricardolsmendes
- License: mit
- Created: 2022-01-12T00:10:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-13T21:32:54.000Z (over 3 years ago)
- Last Synced: 2025-06-10T10:49:17.076Z (4 months ago)
- Topics: cloud-storage, cloud-storage-bucket, events, gcp, google-cloud, google-cloud-functions, google-cloud-platform, pubsub
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# gcp-storage-class-match-notifier
Google Cloud Function that publishes messages to Pub/Sub when the metadata of a
GCS object changes and the object's storage class matches given criteria —
e.g., == `ARCHIVE`.It has been used to notify other systems when GCS objects storage class changes
due to lifecycle rules being applied. Please notice that other metadata changes
will also trigger the function and publish messages to Pub/Sub if the storage
class matches the criteria.[](https://github.com/ricardolsmendes/gcp-storage-class-match-notifier/blob/main/LICENSE)
[](https://github.com/ricardolsmendes/gcp-storage-class-match-notifier/issues)
[](https://github.com/ricardolsmendes/gcp-storage-class-match-notifier/actions/workflows/continuous-integration.yaml)## Deployment instructions
```sh
PUBSUB_PROJECT_ID=
PUBSUB_TOPIC_ID=
STORAGE_CLASS_MATCH_NOTIF_SA=
TRIGGER_BUCKET=gcloud functions deploy notify-storage-class-match \
--entry-point notify_storage_class_match \
--runtime python39 \
--service-account $STORAGE_CLASS_MATCH_NOTIF_SA \
--set-env-vars PUBSUB_PROJECT_ID=$PUBSUB_PROJECT_ID,PUBSUB_TOPIC_ID=$PUBSUB_TOPIC_ID \
--trigger-event google.storage.object.metadataUpdate \
--trigger-resource $TRIGGER_BUCKET
```The `STORAGE_CLASS_MATCH_NOTIF_SA` environment variable refers to the email of
the IAM service account associated with the function at runtime. The service
account must be granted the `pubsub.publisher` role on the Pub/Sub Topic
identified by `projects/${PUBSUB_PROJECT_ID}/topics/${PUBSUB_TOPIC_ID}`.## How to contribute
Please make sure to take a moment and read the [Code of
Conduct](https://github.com/ricardolsmendes/gcp-storage-class-match-notifier/blob/main/.github/CODE_OF_CONDUCT.md).### Report issues
Please report bugs and suggest features via the [GitHub
Issues](https://github.com/ricardolsmendes/gcp-storage-class-match-notifier/issues).Before opening an issue, search the tracker for possible duplicates. If you
find a duplicate, please add a comment saying that you encountered the problem
as well.### Contribute code
Please make sure to read the [Contributing
Guide](https://github.com/ricardolsmendes/gcp-storage-class-match-notifier/blob/main/.github/CONTRIBUTING.md)
before making a pull request.