| 16 | 'use strict'; |
| 17 | |
| 18 | function main(projectId, location, cdnKeyId) { |
| 19 | // [START videostitcher_get_cdn_key] |
| 20 | /** |
| 21 | * TODO(developer): Uncomment these variables before running the sample. |
| 22 | */ |
| 23 | // projectId = 'my-project-id'; |
| 24 | // location = 'us-central1'; |
| 25 | // cdnKeyId = 'my-cdn-key'; |
| 26 | |
| 27 | // Imports the Video Stitcher library |
| 28 | const {VideoStitcherServiceClient} = |
| 29 | require('@google-cloud/video-stitcher').v1; |
| 30 | // Instantiates a client |
| 31 | const stitcherClient = new VideoStitcherServiceClient(); |
| 32 | |
| 33 | async function getCdnKey() { |
| 34 | // Construct request |
| 35 | const request = { |
| 36 | name: stitcherClient.cdnKeyPath(projectId, location, cdnKeyId), |
| 37 | }; |
| 38 | const [cdnKey] = await stitcherClient.getCdnKey(request); |
| 39 | console.log(`CDN key: ${cdnKey.name}`); |
| 40 | } |
| 41 | |
| 42 | getCdnKey().catch(err => { |
| 43 | console.error(err.message); |
| 44 | process.exitCode = 1; |
| 45 | }); |
| 46 | // [END videostitcher_get_cdn_key] |
| 47 | } |
| 48 | |
| 49 | // node getCdnKey.js <projectId> <location> <cdnKeyId> |
| 50 | main(...process.argv.slice(2)); |