Skip to content

Commit 68cd684

Browse files
authored
samples: fix wording for preconditions to use correct operation inste… (#2130)
* samples: fix wording for preconditions to use correct operation instead of upload * correct file.setmetadata related samples to reference ifMetagenerationMatch instead of ifGenerationMatch * fix samples tests
1 parent f20c28c commit 68cd684

15 files changed

+38
-38
lines changed

samples/changeFileCSEKToCMEK.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function main(
5353
const rotateEncryptionKeyOptions = {
5454
kmsKeyName,
5555
// Optional: set a generation-match precondition to avoid potential race
56-
// conditions and data corruptions. The request to upload is aborted if the
56+
// conditions and data corruptions. The request to copy is aborted if the
5757
// object's generation number does not match your precondition.
5858
preconditionOpts: {
5959
ifGenerationMatch: generationMatchPrecondition,

samples/composeFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function main(
5454

5555
// Optional:
5656
// Set a generation-match precondition to avoid potential race conditions
57-
// and data corruptions. The request to upload is aborted if the object's
57+
// and data corruptions. The request to compose is aborted if the object's
5858
// generation number does not match your precondition. For a destination
5959
// object that does not yet exist, set the ifGenerationMatch precondition to 0
6060
// If the destination object already exists in your bucket, set instead a

samples/copyFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function main(
5454

5555
// Optional:
5656
// Set a generation-match precondition to avoid potential race conditions
57-
// and data corruptions. The request to upload is aborted if the object's
57+
// and data corruptions. The request to copy is aborted if the object's
5858
// generation number does not match your precondition. For a destination
5959
// object that does not yet exist, set the ifGenerationMatch precondition to 0
6060
// If the destination object already exists in your bucket, set instead a

samples/copyOldVersionOfFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function main(
5757

5858
// Optional:
5959
// Set a generation-match precondition to avoid potential race conditions
60-
// and data corruptions. The request to upload is aborted if the object's
60+
// and data corruptions. The request to copy is aborted if the object's
6161
// generation number does not match your precondition. For a destination
6262
// object that does not yet exist, set the ifGenerationMatch precondition to 0
6363
// If the destination object already exists in your bucket, set instead a

samples/deleteFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function main(
4343

4444
// Optional:
4545
// Set a generation-match precondition to avoid potential race conditions
46-
// and data corruptions. The request to upload is aborted if the object's
46+
// and data corruptions. The request to delete is aborted if the object's
4747
// generation number does not match your precondition. For a destination
4848
// object that does not yet exist, set the ifGenerationMatch precondition to 0
4949
// If the destination object already exists in your bucket, set instead a

samples/fileChangeStorageClass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function main(
4949
async function fileChangeStorageClass() {
5050
// Optional:
5151
// Set a generation-match precondition to avoid potential race conditions
52-
// and data corruptions. The request to upload is aborted if the object's
52+
// and data corruptions. The request to copy is aborted if the object's
5353
// generation number does not match your precondition. For a destination
5454
// object that does not yet exist, set the ifGenerationMatch precondition to 0
5555
// If the destination object already exists in your bucket, set instead a

samples/fileSetMetadata.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
function main(
2323
bucketName = 'my-bucket',
2424
fileName = 'file.txt',
25-
generationMatchPrecondition = 0
25+
metagenerationMatchPrecondition = 0
2626
) {
2727
// [START storage_set_metadata]
2828
// Imports the Google Cloud client library
@@ -41,11 +41,11 @@ function main(
4141
// const fileName = 'your-file-name';
4242

4343
async function setFileMetadata() {
44-
// Optional: set a generation-match precondition to avoid potential race
45-
// conditions and data corruptions. The request to upload is aborted if the
46-
// object's generation number does not match your precondition.
44+
// Optional: set a meta-generation-match precondition to avoid potential race
45+
// conditions and data corruptions. The request to set metadata is aborted if the
46+
// object's metageneration number does not match your precondition.
4747
const options = {
48-
ifGenerationMatch: generationMatchPrecondition,
48+
ifMetagenerationMatch: metagenerationMatchPrecondition,
4949
};
5050

5151
// Set file metadata.

samples/moveFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function main(
4848
async function moveFile() {
4949
// Optional:
5050
// Set a generation-match precondition to avoid potential race conditions
51-
// and data corruptions. The request to upload is aborted if the object's
51+
// and data corruptions. The request to copy is aborted if the object's
5252
// generation number does not match your precondition. For a destination
5353
// object that does not yet exist, set the ifGenerationMatch precondition to 0
5454
// If the destination object already exists in your bucket, set instead a

samples/releaseEventBasedHold.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
function main(
2424
bucketName = 'my-bucket',
2525
fileName = 'test.txt',
26-
generationMatchPrecondition = 0
26+
metagenerationMatchPrecondition = 0
2727
) {
2828
// [START storage_release_event_based_hold]
2929
/**
@@ -42,11 +42,11 @@ function main(
4242
const storage = new Storage();
4343

4444
async function releaseEventBasedHold() {
45-
// Optional: set a generation-match precondition to avoid potential race
46-
// conditions and data corruptions. The request to upload is aborted if the
47-
// object's generation number does not match your precondition.
45+
// Optional: set a meta-generation-match precondition to avoid potential race
46+
// conditions and data corruptions. The request to set metadata is aborted if the
47+
// object's metageneration number does not match your precondition.
4848
const options = {
49-
ifGenerationMatch: generationMatchPrecondition,
49+
ifMetagenerationMatch: metagenerationMatchPrecondition,
5050
};
5151

5252
await storage.bucket(bucketName).file(fileName).setMetadata(

samples/releaseTemporaryHold.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
function main(
2424
bucketName = 'my-bucket',
2525
fileName = 'test.txt',
26-
generationMatchPrecondition = 0
26+
metagenerationMatchPrecondition = 0
2727
) {
2828
// [START storage_release_temporary_hold]
2929
/**
@@ -42,11 +42,11 @@ function main(
4242
const storage = new Storage();
4343

4444
async function releaseTemporaryHold() {
45-
// Optional: set a generation-match precondition to avoid potential race
46-
// conditions and data corruptions. The request to upload is aborted if the
47-
// object's generation number does not match your precondition.
45+
// Optional: set a meta-generation-match precondition to avoid potential race
46+
// conditions and data corruptions. The request to set metadata is aborted if the
47+
// object's metageneration number does not match your precondition.
4848
const options = {
49-
ifGenerationMatch: generationMatchPrecondition,
49+
ifMetagenerationMatch: metagenerationMatchPrecondition,
5050
};
5151

5252
await storage.bucket(bucketName).file(fileName).setMetadata(

0 commit comments

Comments
 (0)