Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do I automatically add object retention to new files in my bucket?

Hello

For a backup project I maintain a bucket with object retention enabled. I need new files which enter the bucket to automatically be retained until a specified time. I currently use a simple script which iterates over all the objects and locks it using gcloud cli, but this isn't production worthy.

It is weird to me how you can't select a directory and just retain all the objects in it as they say folders can't be retained, which is true I suppose, but it could just retain all objects in the folder instead of saying it can't do this.

Is there a way to automate this process, or is there no other way than using a script or doing it manually?

Thank you in advance

3 6 885