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