Stronger typing for LifecycleRule conditions #2061
Labels
api: storage
Issues related to the googleapis/nodejs-storage API.
next major: breaking change
this is a change that we should wait to bundle into the next major version
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
It's easy to write an incorrect lifecycle condition resulting in unwanted results, particularly for a delete action. For example, the following rule uses a string for
matchesPrefix
when an array of strings is expected.This rule will be added, but without the prefix condition, so that it (as far as I can tell) applies to all objects in the bucket:
Describe the solution you'd like
Stronger typing on the
LifecycleRule
would help TS users write rules correctly.(c.f. the go SDK: https://github.com/googleapis/google-cloud-go/blob/5a9102369b64e06a1564b9d769da7bd044035b7e/storage/bucket.go#L649)
Describe alternatives you've considered
The client SDK could throw an error if unexpected types are passed, to protect me from myself. However,
gsutil
appears to have the same behavior of creating rules while discarding conditions with unexpected types in the JSON.The text was updated successfully, but these errors were encountered: