| 39 | const keyRingName = client.keyRingPath(projectId, locationId, keyRingId); |
| 40 | |
| 41 | async function createKeyLabels() { |
| 42 | const [key] = await client.createCryptoKey({ |
| 43 | parent: keyRingName, |
| 44 | cryptoKeyId: id, |
| 45 | cryptoKey: { |
| 46 | purpose: 'ENCRYPT_DECRYPT', |
| 47 | versionTemplate: { |
| 48 | algorithm: 'GOOGLE_SYMMETRIC_ENCRYPTION', |
| 49 | }, |
| 50 | labels: { |
| 51 | team: 'alpha', |
| 52 | cost_center: 'cc1234', |
| 53 | }, |
| 54 | }, |
| 55 | }); |
| 56 | |
| 57 | console.log(`Created labeled key: ${key.name}`); |
| 58 | return key; |
| 59 | } |
| 60 | |
| 61 | return createKeyLabels(); |
| 62 | // [END kms_create_key_labels] |