Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

docker:
digest: sha256:
digest: sha256:41d5457ff79c3945782ab7e23bf4d617fd7bf3f2b03b6d84808010f7d2e10ca2
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Thanks for stopping by to let us know something could be better!
This is the client library for . We will only be able to assist with issues that pertain to the behaviors of this library. If the issue you're experiencing is due to the behavior of the product itself, please visit the [ Support page]() to reach the most relevant engineers.

2) Did someone already solve this?
- Search the issues already opened: https://github.com/googleapis/googleapis/issues
- Search the issues already opened: https://github.com/googleapis/nodejs-dataflow/issues
- Search the issues on our "catch-all" repository: https://github.com/googleapis/google-cloud-node
- Search or ask on StackOverflow (engineers monitor these tags): http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js

Expand Down
4 changes: 2 additions & 2 deletions .kokoro/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/continuous/node10/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node10/docs.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/continuous/node12/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node12/lint.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node12/samples-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node12/system-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/presubmit/node10/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/presubmit/node12/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/presubmit/node12/samples-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/presubmit/node12/system-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/release/docs-devsite.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/release/docs.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/release/publish.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)


* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
Expand All @@ -55,6 +55,42 @@ npm install @google-cloud/dataflow
```


### Using the client library

```javascript
// Imports the Google Cloud client library

const {TemplatesServiceClient} = require('@google-cloud/dataflow');

// TODO(developer): replace with your prefered project ID.
// const projectId = 'my-project'
// TODO(developer): replace with your bucket path.
// const gcsPath = 'gs://<bucket>/path'

// Creates a client
const client = new TemplatesServiceClient();

//TODO(library generator): write the actual function you will be testing
async function getTemplate() {
const template = await client.getTemplate({
projectId,
gcsPath,
});
console.info(template);
}
getTemplate();

```



## Samples

Samples are in the [`samples/`](https://github.com/googleapis/nodejs-dataflow/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Quickstart | [source code](https://github.com/googleapis/nodejs-dataflow/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dataflow&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |



Expand Down
12 changes: 11 additions & 1 deletion linkinator.config.json
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io"],"silent":true,"concurrency":10}
{
"recurse": true,
"skip": [
"https://codecov.io/gh/googleapis/",
"www.googleapis.com",
"img.shields.io",
"https://github.com/googleapis/nodejs-dataflow/blob/master/CHANGELOG.md"
],
"silent": true,
"concurrency": 10
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@google-cloud/dataflow",
"version": "0.1.0",
"description": "dataflow client for Node.js",
"repository": "googleapis/googleapis/nodejs-dataflow",
"repository": "googleapis/nodejs-dataflow",
"license": "Apache-2.0",
"author": "Google LLC",
"main": "build/src/index.js",
Expand Down
50 changes: 50 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# [Dataflow: Node.js Samples](https://github.com/googleapis/nodejs-dataflow)

[![Open in Cloud Shell][shell_img]][shell_link]



## Table of Contents

* [Before you begin](#before-you-begin)
* [Samples](#samples)
* [Quickstart](#quickstart)

## Before you begin

Before running the samples, make sure you've followed the steps outlined in
[Using the client library](https://github.com/googleapis/nodejs-dataflow#using-the-client-library).

`cd samples`

`npm install`

`cd ..`

## Samples



### Quickstart

View the [source code](https://github.com/googleapis/nodejs-dataflow/blob/master/samples/quickstart.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dataflow&page=editor&open_in_editor=samples/quickstart.js,samples/README.md)

__Usage:__


`node samples/quickstart.js`






[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dataflow&page=editor&open_in_editor=samples/README.md
[product-docs]: https://cloud.google.com/dataflow/
26 changes: 14 additions & 12 deletions samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,32 @@

'use strict';

async function main() {

async function main(
projectId,
gcsPath = 'gs://dataflow-templates/latest/PubSub_Subscription_to_BigQuery'
) {
// [START nodejs_dataflow_quickstart]
// Imports the Google Cloud client library

// remove this line after package is released
// eslint-disable-next-line node/no-missing-require
const {TemplatesServiceClient} = require('@google-cloud/dataflow');

// TODO(developer): replace with your prefered project ID.
// const projectId = 'my-project'
// TODO(developer): replace with your bucket path.
// const gcsPath = 'gs://<bucket>/path'

// Creates a client
// eslint-disable-next-line no-unused-vars
const client = new {TemplatesServiceClient}();
const client = new TemplatesServiceClient();

//TODO(library generator): write the actual function you will be testing
async function doSomething() {
console.log('DPE! Change this code so that it shows how to use the library! See comments below on structure.')
// const [thing] = await client.methodName({
// });
// console.info(thing);
async function getTemplate() {
const template = await client.getTemplate({
projectId,
gcsPath,
});
console.info(template);
}
doSomething();
getTemplate();
// [END nodejs_dataflow_quickstart]
}

Expand Down
16 changes: 3 additions & 13 deletions samples/test/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,24 @@
const path = require('path');
const cp = require('child_process');
const {before, describe, it} = require('mocha');
// eslint-disable-next-line node/no-missing-require
const {TemplatesServiceClient} = require('@google-cloud/dataflow');
// 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 {TemplatesServiceClient}();
const client = new TemplatesServiceClient();

describe('Quickstart', () => {
//TODO: remove this if not using the projectId
// eslint-disable-next-line no-unused-vars
let projectId;

before(async () => {
// eslint-disable-next-line no-unused-vars
projectId = await client.getProjectId();
});

it('should run quickstart', async () => {
//TODO: remove this line
// eslint-disable-next-line no-unused-vars
const stdout = execSync(
`node ./quickstart.js`,
{cwd}
);
//assert(stdout, stdout !== null);
const stdout = execSync(`node ./quickstart.js ${projectId}`, {cwd});
assert.match(stdout, /status: null/);
});
});