-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: initial generation of library (#1)
- Loading branch information
0 parents
commit 053ec0b
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "nodejs-eventarc", | ||
"private": true, | ||
"license": "Apache-2.0", | ||
"author": "Google LLC", | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"files": [ | ||
"*.js" | ||
], | ||
"scripts": { | ||
"test": "c8 mocha --timeout 600000 test/*.js" | ||
}, | ||
"dependencies": { | ||
"@google-cloud/eventarc": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.1.0", | ||
"chai": "^4.2.0", | ||
"mocha": "^8.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
'use strict'; | ||
|
||
async function main(projectId) { | ||
// [START nodejs_eventarc_quickstart] | ||
// Imports the Google Cloud client library | ||
|
||
// remove this line after package is released | ||
// eslint-disable-next-line node/no-missing-require | ||
const {EventarcClient} = require('@google-cloud/eventarc'); | ||
|
||
// TODO(developer): replace with your prefered project ID. | ||
// const projectId = 'my-project' | ||
|
||
// Creates a client | ||
const client = new EventarcClient(); | ||
|
||
//TODO(library generator): write the actual function you will be testing | ||
async function doSomething() { | ||
for await (const trigger of await client.listTriggersAsync({ | ||
parent: client.locationPath(projectId, 'us-central1'), | ||
})) { | ||
console.info(trigger.name); | ||
} | ||
} | ||
doSomething(); | ||
// [END nodejs_eventarc_quickstart] | ||
} | ||
|
||
main(...process.argv.slice(2)).catch(err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// ** This file is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const cp = require('child_process'); | ||
const {before, describe, it} = require('mocha'); | ||
// eslint-disable-next-line node/no-missing-require | ||
const {EventarcClient} = require('@google-cloud/eventarc'); | ||
// eslint-disable-next-line no-unused-vars, node/no-missing-require | ||
const {assert} = require('chai'); | ||
|
||
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); | ||
|
||
const cwd = path.join(__dirname, '..'); | ||
|
||
const client = new EventarcClient(); | ||
|
||
describe('Quickstart', () => { | ||
let projectId; | ||
|
||
before(async () => { | ||
projectId = await client.getProjectId(); | ||
}); | ||
|
||
it('should run quickstart', async () => { | ||
const stdout = execSync(`node ./quickstart.js ${projectId}`, {cwd}); | ||
assert.strictEqual(stdout.includes('test-event-arc-api'), true); | ||
}); | ||
}); |