-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support autoclass * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * added documentation * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fixed documentation * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * removed log statements Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
61e5b44
commit 7e83580
Showing
7 changed files
with
178 additions
and
0 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,47 @@ | ||
// 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. | ||
|
||
/** | ||
* This application demonstrates how to perform basic operations on files with | ||
* the Google Cloud Storage API. | ||
* | ||
* For more information, see the README.md under /storage and the documentation | ||
* at https://cloud.google.com/storage/docs. | ||
*/ | ||
|
||
function main(bucketName = 'my-bucket') { | ||
// [START storage_get_autoclass] | ||
/** | ||
* TODO(developer): Uncomment the following lines before running the sample. | ||
*/ | ||
// The ID of your GCS bucket | ||
// const bucketName = 'your-unique-bucket-name'; | ||
|
||
// Imports the Google Cloud client library | ||
const {Storage} = require('@google-cloud/storage'); | ||
|
||
// Creates a client | ||
const storage = new Storage(); | ||
|
||
async function getAutoclass() { | ||
const [metadata] = await storage.bucket(bucketName).getMetadata(); | ||
console.log( | ||
`Autoclass enabled is set to ${metadata.autoclass.enabled} for ${metadata.name} at ${metadata.autoclass.toggleTime}.` | ||
); | ||
} | ||
|
||
getAutoclass().catch(console.error); | ||
// [END storage_get_autoclass] | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
function main(bucketName = 'my-bucket', toggle = false) { | ||
// [START storage_set_autoclass] | ||
/** | ||
* TODO(developer): Uncomment the following lines before running the sample. | ||
*/ | ||
// The ID of your GCS bucket | ||
// const bucketName = 'your-unique-bucket-name'; | ||
|
||
// Imports the Google Cloud client library | ||
const {Storage} = require('@google-cloud/storage'); | ||
|
||
// Creates a client | ||
const storage = new Storage(); | ||
|
||
async function setAutoclass() { | ||
// Disables Autoclass for a bucket. | ||
// Note: Only patch requests that disable autoclass are currently supported. | ||
// To enable autoclass, you must set it at bucket creation time. | ||
const [metadata] = await storage.bucket(bucketName).setMetadata({ | ||
autoclass: { | ||
enabled: toggle, | ||
}, | ||
}); | ||
|
||
console.log(`Autoclass enabled is set to ${metadata.autoclass.enabled} for | ||
${metadata.name} at ${metadata.autoclass.toggleTime}.`); | ||
} | ||
|
||
setAutoclass().catch(console.error); | ||
// [END storage_set_autoclass] | ||
} | ||
|
||
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