(projectId, location, inputId)
| 16 | 'use strict'; |
| 17 | |
| 18 | function main(projectId, location, inputId) { |
| 19 | // [START livestream_create_input] |
| 20 | /** |
| 21 | * TODO(developer): Uncomment these variables before running the sample. |
| 22 | */ |
| 23 | // projectId = 'my-project-id'; |
| 24 | // location = 'us-central1'; |
| 25 | // inputId = 'my-input'; |
| 26 | |
| 27 | // Imports the Livestream library |
| 28 | const {LivestreamServiceClient} = require('@google-cloud/livestream').v1; |
| 29 | |
| 30 | // Instantiates a client |
| 31 | const livestreamServiceClient = new LivestreamServiceClient(); |
| 32 | |
| 33 | async function createInput() { |
| 34 | // Construct request |
| 35 | const request = { |
| 36 | parent: livestreamServiceClient.locationPath(projectId, location), |
| 37 | inputId: inputId, |
| 38 | input: { |
| 39 | type: 'RTMP_PUSH', |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | // Run request |
| 44 | const [operation] = await livestreamServiceClient.createInput(request); |
| 45 | const response = await operation.promise(); |
| 46 | const [input] = response; |
| 47 | console.log(`Input: ${input.name}`); |
| 48 | } |
| 49 | |
| 50 | createInput(); |
| 51 | // [END livestream_create_input] |
| 52 | } |
| 53 | |
| 54 | // node createInput.js <projectId> <location> <inputId> |
| 55 | process.on('unhandledRejection', err => { |
no test coverage detected