Skip to content

Commit bcf58f0

Browse files
authored
build: resolve issue with build process (#2619)
* fix-build issue * Merge branch 'fix-build-issue' of https://github.com/googleapis/nodejs-storage into fix-build-issue * fix: Correct `setObjectRetentionPolicy` sample to extend retention period * build: Correct `setObjectRetentionPolicy` sample to extend retention period * Correct license year to 2024
1 parent 7129186 commit bcf58f0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

samples/setObjectRetentionPolicy.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,18 @@ function main(
7070
);
7171

7272
// To modify an existing policy on an unlocked file object, pass in the override parameter
73-
const newRetentionDate = new Date();
74-
retentionDate.setDate(retentionDate.getDate() + 9);
75-
[metdata] = await file.setMetadata({
76-
retention: {retainUntilTime: newRetentionDate},
73+
const newRetentionDate = new Date(retentionDate.getDate());
74+
newRetentionDate.setDate(newRetentionDate.getDate() + 9);
75+
const [newMetadata] = await file.setMetadata({
76+
retention: {
77+
mode: 'Unlocked',
78+
retainUntilTime: newRetentionDate,
79+
},
7780
overrideUnlockedRetention: true,
7881
});
7982

8083
console.log(
81-
`Retention policy for file ${file.name} was updated to: ${metadata.retention.retainUntilTime}`
84+
`Retention policy for file ${file.name} was updated to: ${newMetadata.retention.retainUntilTime}`
8285
);
8386
}
8487

0 commit comments

Comments
 (0)