-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: * feat: Custom Dual Region Support * test: Custom Dual Region Tests with logging * feat: Add Custom Dual Region sample * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: typo * test: Add tests for `location` as an Array * refactor: Rename - drop 'Custom' from 'Dual Regions' * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * style: Drop 'Custom' prefix * revert: Remove tuple support Avoids confusion as the returned value from the backend is a string * refactor: Rename variables from `locationX` to `regionX` * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: Update metadata assertions * test: Update tests to avoid name collision * test: debug test * test: fix test * chore: test immediately deleting a specified dual-region bucket * chore: undo delete debug * docs: 'dual region' -> 'dual-region' * docs: Fix `bucket-locations` -> `locations` link Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
91fe5ed
commit caf7ee5
Showing
7 changed files
with
152 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* Copyright 2022 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// sample-metadata: | ||
// title: Create a Dual-Region Bucket | ||
// description: Create a Dual-Region Bucket with provided locations. | ||
// usage: node createBucketWithDualRegion.js <BUCKET_NAME> <REGION1> <REGION2> | ||
|
||
function main( | ||
bucketName = 'my-bucket', | ||
region1 = 'US-EAST1', | ||
region2 = 'US-WEST1' | ||
) { | ||
// [START storage_create_bucket_dual_region] | ||
/** | ||
* TODO(developer): Uncomment the following lines before running the sample. | ||
*/ | ||
// The ID of your GCS bucket | ||
// const bucketName = 'your-unique-bucket-name'; | ||
|
||
// The bucket's pair of regions. Case-insensitive. | ||
// See this documentation for other valid locations: | ||
// https://cloud.google.com/storage/docs/locations | ||
// const region1 = 'US-EAST1'; | ||
// const region2 = 'US-WEST1'; | ||
|
||
// Imports the Google Cloud client library | ||
const {Storage} = require('@google-cloud/storage'); | ||
|
||
// Creates a client | ||
// The bucket in the sample below will be created in the project associated with this client. | ||
// For more information, please see https://cloud.google.com/docs/authentication/production or https://googleapis.dev/nodejs/storage/latest/Storage.html | ||
const storage = new Storage(); | ||
|
||
async function createDualRegionBucket() { | ||
// For regions supporting dual-regions see: https://cloud.google.com/storage/docs/locations | ||
const [bucket] = await storage.createBucket(bucketName, { | ||
location: `${region1}+${region2}`, // e.g. `US-EAST1+US-WEST1` | ||
}); | ||
|
||
console.log(`${bucket.name} created in '${region1}+${region2}'`); | ||
} | ||
|
||
createDualRegionBucket().catch(console.error); | ||
// [END storage_create_bucket_dual_region] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters