You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* sample: add turbo replication samples
* 🦉 Updates from OwlBot
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* add storage system-test
* change name of sample test bucket
* fix dual region bucket in samples test
* add rpo to getMetadata sample, change error handling
* feedback from canonical sample document
* fix readme names
* fix naming in tests
* change dual region to dual-region
* add comment about name being a dual-region bucket name
* set rpo in test, do not allow as argument
* add clarifying comment about undefined value
* update header copyright year to 2022
* 🦉 Updates from OwlBot
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-storage/tre
115
115
| Copy File |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/copyFile.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/copyFile.js,samples/README.md)|
116
116
| Copy Old Version Of File. |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/copyOldVersionOfFile.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/copyOldVersionOfFile.js,samples/README.md)|
117
117
| Create Bucket With Storage Class and Location. |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/createBucketWithStorageClassAndLocation.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/createBucketWithStorageClassAndLocation.js,samples/README.md)|
118
+
| Create Bucket With Turbo Replication |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/createBucketWithTurboReplication.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/createBucketWithTurboReplication.js,samples/README.md)|
118
119
| Create New Bucket |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/createNewBucket.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/createNewBucket.js,samples/README.md)|
119
120
| Create Notification |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/createNotification.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/createNotification.js,samples/README.md)|
120
121
| Delete Bucket |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/deleteBucket.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/deleteBucket.js,samples/README.md)|
@@ -149,6 +150,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-storage/tre
149
150
| Get Metadata |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getMetadata.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getMetadata.js,samples/README.md)|
150
151
| Get Metadata Notifications |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getMetadataNotifications.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getMetadataNotifications.js,samples/README.md)|
151
152
| Get Public Access Prevention |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getPublicAccessPrevention.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getPublicAccessPrevention.js,samples/README.md)|
153
+
| Get RPO |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getRPO.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getRPO.js,samples/README.md)|
152
154
| Get Requester Pays Status |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getRequesterPaysStatus.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getRequesterPaysStatus.js,samples/README.md)|
153
155
| Get Retention Policy |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getRetentionPolicy.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getRetentionPolicy.js,samples/README.md)|
154
156
| Storage Get Service Account. |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getServiceAccount.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getServiceAccount.js,samples/README.md)|
@@ -190,6 +192,8 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-storage/tre
190
192
| Set Event Based Hold |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setEventBasedHold.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setEventBasedHold.js,samples/README.md)|
191
193
| Set Public Access Prevention Enforced |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setPublicAccessPreventionEnforced.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setPublicAccessPreventionEnforced.js,samples/README.md)|
192
194
| Set Public Access Prevention Inherited |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setPublicAccessPreventionInherited.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setPublicAccessPreventionInherited.js,samples/README.md)|
195
+
| Set RPO Async Turbo |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setRPOAsyncTurbo.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setRPOAsyncTurbo.js,samples/README.md)|
196
+
| Set RPO Default |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setRPODefault.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setRPODefault.js,samples/README.md)|
193
197
| Set Retention Policy |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setRetentionPolicy.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setRetentionPolicy.js,samples/README.md)|
194
198
| Set Temporary Hold |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setTemporaryHold.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setTemporaryHold.js,samples/README.md)|
195
199
| Stream File Download |[source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/streamFileDownload.js)|[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/streamFileDownload.js,samples/README.md)|
*[Get Public Access Prevention](#get-public-access-prevention)
72
+
*[Get RPO](#get-rpo)
71
73
*[Get Requester Pays Status](#get-requester-pays-status)
72
74
*[Get Retention Policy](#get-retention-policy)
73
75
*[Storage Get Service Account.](#storage-get-service-account.)
@@ -109,6 +111,8 @@ objects to users via direct download.
109
111
*[Set Event Based Hold](#set-event-based-hold)
110
112
*[Set Public Access Prevention Enforced](#set-public-access-prevention-enforced)
111
113
*[Set Public Access Prevention Inherited](#set-public-access-prevention-inherited)
114
+
*[Set RPO Async Turbo](#set-rpo-async-turbo)
115
+
*[Set RPO Default](#set-rpo-default)
112
116
*[Set Retention Policy](#set-retention-policy)
113
117
*[Set Temporary Hold](#set-temporary-hold)
114
118
*[Stream File Download](#stream-file-download)
@@ -427,6 +431,23 @@ __Usage:__
427
431
428
432
429
433
434
+
### Create Bucket With Turbo Replication
435
+
436
+
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/createBucketWithTurboReplication.js).
437
+
438
+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/createBucketWithTurboReplication.js,samples/README.md)
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/createNewBucket.js).
@@ -1017,6 +1038,23 @@ __Usage:__
1017
1038
1018
1039
1019
1040
1041
+
### Get RPO
1042
+
1043
+
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getRPO.js).
1044
+
1045
+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getRPO.js,samples/README.md)
1046
+
1047
+
__Usage:__
1048
+
1049
+
1050
+
`node samples/getRPO.js`
1051
+
1052
+
1053
+
-----
1054
+
1055
+
1056
+
1057
+
1020
1058
### Get Requester Pays Status
1021
1059
1022
1060
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/getRequesterPaysStatus.js).
@@ -1738,6 +1776,40 @@ __Usage:__
1738
1776
1739
1777
1740
1778
1779
+
### Set RPO Async Turbo
1780
+
1781
+
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setRPOAsyncTurbo.js).
1782
+
1783
+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setRPOAsyncTurbo.js,samples/README.md)
1784
+
1785
+
__Usage:__
1786
+
1787
+
1788
+
`node samples/setRPOAsyncTurbo.js`
1789
+
1790
+
1791
+
-----
1792
+
1793
+
1794
+
1795
+
1796
+
### Set RPO Default
1797
+
1798
+
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setRPODefault.js).
1799
+
1800
+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setRPODefault.js,samples/README.md)
1801
+
1802
+
__Usage:__
1803
+
1804
+
1805
+
`node samples/setRPODefault.js`
1806
+
1807
+
1808
+
-----
1809
+
1810
+
1811
+
1812
+
1741
1813
### Set Retention Policy
1742
1814
1743
1815
View the [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setRetentionPolicy.js).
// Flag to enable turbo replication for this bucket
39
+
constrpo='ASYNC_TURBO';
40
+
41
+
// Imports the Google Cloud client library
42
+
const{Storage}=require('@google-cloud/storage');
43
+
44
+
// Creates a client
45
+
// The bucket in the sample below will be created in the project associated with this client.
46
+
// For more information, please see https://cloud.google.com/docs/authentication/production or https://googleapis.dev/nodejs/storage/latest/Storage.html
47
+
conststorage=newStorage();
48
+
49
+
asyncfunctioncreateBucketWithTurboReplication(){
50
+
// For default values see: https://cloud.google.com/storage/docs/locations and
0 commit comments