MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

media/video-stitcher/createCdnKeyAkamai.js:18–58  ·  view source on GitHub ↗
(projectId, cdnKeyId, akamaiTokenKey)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function 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>
61main(...process.argv.slice(2));

Callers 1

Calls 1

createCdnKeyAkamaiFunction · 0.85

Tested by

no test coverage detected