(projectId, cdnKeyId, hostname, akamaiTokenKey)
| 16 | 'use strict'; |
| 17 | |
| 18 | function main(projectId, cdnKeyId, hostname, akamaiTokenKey) { |
| 19 | // [START videostitcher_update_cdn_key_akamai] |
| 20 | const location = 'us-central1'; |
| 21 | /** |
| 22 | * TODO(developer): Uncomment these variables before running the sample. |
| 23 | */ |
| 24 | // projectId = 'my-project-id'; |
| 25 | // cdnKeyId = 'my-cdn-key'; |
| 26 | // akamaiTokenKey = 'my-token-key'; |
| 27 | |
| 28 | // Imports the Video Stitcher library |
| 29 | const {VideoStitcherServiceClient} = |
| 30 | require('@google-cloud/video-stitcher').v1; |
| 31 | // Instantiates a client |
| 32 | const stitcherClient = new VideoStitcherServiceClient(); |
| 33 | |
| 34 | async function updateCdnKeyAkamai() { |
| 35 | // Construct request |
| 36 | const request = { |
| 37 | cdnKey: { |
| 38 | name: stitcherClient.cdnKeyPath(projectId, location, cdnKeyId), |
| 39 | hostname: hostname, |
| 40 | akamaiCdnKey: { |
| 41 | tokenKey: akamaiTokenKey, |
| 42 | }, |
| 43 | }, |
| 44 | updateMask: { |
| 45 | paths: ['hostname', 'akamai_cdn_key'], |
| 46 | }, |
| 47 | }; |
| 48 | |
| 49 | const [operation] = await stitcherClient.updateCdnKey(request); |
| 50 | const [response] = await operation.promise(); |
| 51 | console.log(`Updated CDN key: ${response.name}`); |
| 52 | console.log(`Updated hostname: ${response.hostname}`); |
| 53 | } |
| 54 | |
| 55 | updateCdnKeyAkamai().catch(err => { |
| 56 | console.error(err.message); |
| 57 | process.exitCode = 1; |
| 58 | }); |
| 59 | // [END videostitcher_update_cdn_key_akamai] |
| 60 | } |
| 61 | |
| 62 | // node updateCdnKeyAkamai.js <projectId> <cdnKeyId> <akamaiTokenKey> <location> <hostname> |
| 63 | main(...process.argv.slice(2)); |
no test coverage detected