Skip to content Navigation Menu Toggle navigation Sign in Appearance settings PlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub Copilot appDirect agents from issue to mergeMCP RegistryNewIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityAcceleratorGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricing Search or jump to... Search code, repositories, users, issues, pull requests... Search Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Saved searches Use saved searches to filter your results more quickly Name Query To see all available qualifiers, see our documentation. Sign in Sign up Appearance settings Resetting focus 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 {{ message }} Uh oh! There was an error while loading. Please reload this page. GoogleCloudPlatform / nodejs-docs-samples Public Notifications You must be signed in to change notification settings Fork 2k Star 3k Code Issues 20 Pull requests 35 Actions Projects Security and quality 0 Insights Additional navigation options Code Issues Pull requests Actions Projects Security and quality Insights FilesExpand file tree mainBreadcrumbsnodejs-docs-samples/kms/updateKeyUpdateLabels.jsCopy pathBlameMore file actionsBlameMore file actions Latest commit HistoryHistoryHistory74 lines (65 loc) · 2 KB mainBreadcrumbsnodejs-docs-samples/kms/updateKeyUpdateLabels.jsCopy pathTopFile metadata and controlsCodeBlame74 lines (65 loc) · 2 KBRawCopy raw fileDownload raw fileOpen symbols panelEdit and raw actions1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374// Copyright 2020 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//// https://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'; async function main( projectId = 'my-project', locationId = 'us-east1', keyRingId = 'my-key-ring', keyId = 'my-key') { // [START kms_update_key_update_labels] // // TODO(developer): Uncomment these variables before running the sample. // // const projectId = 'my-project'; // const locationId = 'us-east1'; // const keyRingId = 'my-key-ring'; // const keyId = 'my-key'; // const versionId = '123'; // Imports the Cloud KMS library const {KeyManagementServiceClient} = require('@google-cloud/kms'); // Instantiates a client const client = new KeyManagementServiceClient(); // Build the key name const keyName = client.cryptoKeyPath(projectId, locationId, keyRingId, keyId); async function updateKeyUpdateLabels() { const [key] = await client.updateCryptoKey({ cryptoKey: { name: keyName, labels: { new_label: 'new_value', }, }, updateMask: { paths: ['labels'], }, }); console.log(`Updated labels for: ${key.name}`); return key; } return updateKeyUpdateLabels(); // [END kms_update_key_update_labels]}module.exports.main = main; /* c8 ignore next 10 */if (require.main === module) { main(...process.argv.slice(2)).catch(err => { console.error(err.message); process.exitCode = 1; }); process.on('unhandledRejection', err => { console.error(err.message); process.exitCode = 1; });} You can’t perform that action at this time.