Skip to content

Commit 21fb5ab

Browse files
committed
Upgrade pubsub samples.
1 parent 29929b8 commit 21fb5ab

File tree

14 files changed

+740
-1412
lines changed

14 files changed

+740
-1412
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ on Google Cloud Platform.
5959

6060
### Prerequisites
6161

62-
1. Install [Node.js (and NPM)][node]
62+
1. Install [Node.js v4.5.0 or greater][node]
6363
1. Clone this repository:
6464

6565
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git

bigquery/system-test/tables.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var srcTableId = options.tableId;
4242
var destDatasetId = generateUuid();
4343
var destTableId = generateUuid();
4444

45-
describe.only('bigquery:tables', function () {
45+
describe('bigquery:tables', function () {
4646
before(function (done) {
4747
// Create bucket
4848
storage.createBucket(options.bucketName, function (err, bucket) {

pubsub/README.md

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ allows you to send and receive messages between independent applications.
1313
* [Samples](#samples)
1414
* [Topics](#topics)
1515
* [Subscriptions](#subscriptions)
16-
* [IAM](#iam)
1716

1817
## Setup
1918

@@ -35,19 +34,26 @@ __Usage:__ `node topics --help`
3534

3635
```
3736
Commands:
37+
list Lists all topics in the current project.
3838
create <topicName> Creates a new topic.
39-
list Lists topics.
40-
publish <topicName> <message> Publish a message to the specified topic.
41-
delete <topicName> Deletes the specified topic.
39+
delete <topicName> Deletes the a topic.
40+
publish <topicName> <message> Publishes a message.
41+
getPolicy <topicName> Gets the IAM policy for a topic.
42+
setPolicy <topicName> Sets the IAM policy for a topic.
43+
testPermissions <topicName> Tests the permissions for a topic.
4244
4345
Options:
4446
--help Show help [boolean]
4547
4648
Examples:
47-
node topics create greetings Creates a new topic named "greetings".
48-
node topics list Lists all topics.
49-
node topics publish greetings '{"data":"Hello world!"}' Publishes a message to "greetings".
50-
node topics delete greetings Deletes a topic named "greetings".
49+
node topics.js list Lists all topics in the current project.
50+
node topics.js create greetings Creates a new topic named "greetings".
51+
node topics.js delete greetings Deletes a topic named "greetings".
52+
node topics.js publish greetings "Hello, world!" Publishes a simple message.
53+
node topics.js publish greetings '{"data":"Hello, world!"}' Publishes a JSON message.
54+
node topics.js getPolicy greetings Gets the IAM policy for a topic named "greetings".
55+
node topics.js setPolicy greetings Sets the IAM policy for a topic named "greetings".
56+
node topics.js testPermissions greetings Tests the permissions for a topic named "greetings".
5157
5258
For more information, see https://cloud.google.com/pubsub/docs
5359
```
@@ -63,58 +69,41 @@ __Usage:__ `node subscriptions --help`
6369

6470
```
6571
Commands:
66-
create <topicName> <subscriptionName> Creates a new subscription.
67-
list [topicName] Lists subscriptions, optionally filtering by a topic.
68-
get <subscriptionName> Gets the metadata the metadata for the specified subscription.
69-
pull <subscriptionName> Pulls messages for the specified subscription.
70-
delete <subscriptionName> Deletes the specified subscription.
72+
list [topicName] Lists all subscriptions in the current project, optionally filtering by a
73+
topic.
74+
create <topicName> <subscriptionName> Creates a new subscription.
75+
create-push <topicName> <subscriptionName> Creates a new push subscription.
76+
delete <subscriptionName> Deletes a subscription.
77+
get <subscriptionName> Gets the metadata for a subscription.
78+
pull <subscriptionName> Pulls messages for a subscription.
79+
get-policy <subscriptionName> Gets the IAM policy for a subscription.
80+
set-policy <subscriptionName> Sets the IAM policy for a subscription.
81+
test-permissions <subscriptionName> Tests the permissions for a subscription.
7182
7283
Options:
7384
--help Show help [boolean]
7485
7586
Examples:
76-
node subscriptions create greetings greetings-worker-1 Creates a subscription named "greetings-worker-1" to a topic
77-
named "greetings".
78-
node subscriptions delete greetings-worker-1 Deletes a subscription named "greetings-worker-1".
79-
node subscriptions pull greetings-worker-1 Pulls messages for a subscription named "greetings-worker-1".
80-
node subscriptions list Lists all subscriptions.
81-
node subscriptions list greetings Lists subscriptions for a topic named "greetings".
87+
node subscriptions.js list Lists all subscriptions in the current project.
88+
node subscriptions.js list greetings Lists all subscriptions for a topic named "greetings".
89+
node subscriptions.js create greetings greetings-worker-1 Creates a subscription named "greetings-worker-1" to a
90+
topic named "greetings".
91+
node subscriptions.js create-push greetings Creates a push subscription named "greetings-worker-1"
92+
greetings-worker-1 to a topic named "greetings".
93+
node subscriptions.js get greetings-worker-1 Gets the metadata for a subscription named
94+
"greetings-worker-1".
95+
node subscriptions.js delete greetings-worker-1 Deletes a subscription named "greetings-worker-1".
96+
node subscriptions.js pull greetings-worker-1 Pulls messages for a subscription named
97+
"greetings-worker-1".
98+
node subscriptions.js get-policy greetings-worker-1 Gets the IAM policy for a subscription named
99+
"greetings-worker-1".
100+
node subscriptions.js set-policy greetings-worker-1 Sets the IAM policy for a subscription named
101+
"greetings-worker-1".
102+
node subscriptions.js test-permissions greetings-worker-1 Tests the permissions for a subscription named
103+
"greetings-worker-1".
82104
83105
For more information, see https://cloud.google.com/pubsub/docs
84106
```
85107

86108
[subscriptions_docs]: https://cloud.google.com/pubsub/subscriber
87109
[subscriptions_code]: subscriptions.js
88-
89-
### IAM
90-
91-
View the [documentation][iam_docs] or the [source code][iam_code].
92-
93-
__Usage:__ `node iam --help`
94-
95-
```
96-
Usage: node iam RESOURCE COMMAND [ARGS...]
97-
98-
Resources:
99-
100-
topics
101-
subscriptions
102-
103-
Commands:
104-
105-
get NAME
106-
set NAME
107-
test NAME
108-
109-
Examples:
110-
111-
node iam topics get my-topic
112-
node iam topics set my-topic
113-
node iam topics test my-topic
114-
node iam subscriptions get my-subscription
115-
node iam subscriptions set my-subscription
116-
node iam subscriptions test my-subscription
117-
```
118-
119-
[iam_docs]: https://cloud.google.com/pubsub/access_control
120-
[iam_code]: iam.js

pubsub/iam.js

Lines changed: 0 additions & 215 deletions
This file was deleted.

pubsub/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
"devDependencies": {
1616
"mocha": "^3.0.2",
1717
"node-uuid": "^1.4.7"
18+
},
19+
"engines": {
20+
"node": "~4.5"
1821
}
1922
}

0 commit comments

Comments
 (0)