-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Object Lifecycle Management #471
Introduce Object Lifecycle Management #471
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/ nits
src/bucket.ts
Outdated
* }, function(err, apiResponse) {}); | ||
*/ | ||
addLifecycleRule(rule: LifecycleRule): Promise<SetBucketMetadataResponse>; | ||
addLifecycleRule( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
3e0ed0e
to
fea0bfe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies on delay. Will perform another pass tomorrow morning. Overall I think it looks good so far.
I appreciate your patience!
src/bucket.ts
Outdated
* condition: { | ||
* createdBefore: new Date('2018') | ||
* }, | ||
* storageClass: 'COLDLINE' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
6005a30
to
6788426
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions, comments and nits.
Thanks @stephenplusplus
src/bucket.ts
Outdated
@@ -989,6 +1004,140 @@ class Bucket extends ServiceObject { | |||
this.getFilesStream = paginator.streamify('getFiles'); | |||
} | |||
|
|||
/** | |||
* Set the object lifecycle rules for objects in this bucket. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -79,6 +79,21 @@ interface WatchAllOptions { | |||
versions?: boolean; | |||
} | |||
|
|||
/** | |||
* @typedef {object} AddLifecycleRuleOptions Configuration options for Bucket#addLifecycleRule(). | |||
* @property {string} [append=true] The new rules will be appended to any |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/bucket.ts
Outdated
* | ||
* By default, the object lifecycle rule you provide to this method will be | ||
* appended to any existing ones. To replace all existing rules, supply the | ||
* `options` argument, setting `append` to `false`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/bucket.ts
Outdated
* bucket.addLifecycleRule({ | ||
* action: 'delete', | ||
* condition: { | ||
* matchesStorageClass: 'COLDLINE', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* lifecycleRules.forEach(lifecycleRule => {}); | ||
* }); | ||
* | ||
* //- |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* | ||
* @param {LifecycleRule} rule The new lifecycle rule to be added to objects | ||
* in this bucket. | ||
* @param {string} [rule.storageClass] When using the `setStorageClass` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, lgtm
* | ||
* @param {LifecycleRule} rule The new lifecycle rule to be added to objects | ||
* in this bucket. | ||
* @param {string} [rule.storageClass] When using the `setStorageClass` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -79,6 +79,21 @@ interface WatchAllOptions { | |||
versions?: boolean; | |||
} | |||
|
|||
/** | |||
* @typedef {object} AddLifecycleRuleOptions Configuration options for Bucket#addLifecycleRule(). | |||
* @property {string} [append=true] The new rules will be appended to any |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
60daec7
to
851b300
Compare
All tests have been written-- @callmehiphop want to take a quick look? |
8f4f29c
to
c8c9b4c
Compare
@callmehiphop 👋 mind taking a look? @stephenplusplus it would be rad to get this released :) |
To Dos
This introduces one method,
bucket.addLifecycleRule(rule, [options], [callback])
:Add a rule
Replace any existing rules
Remove any existing rules