google-cloud-pubsub 0.33.1 → 2.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +41 -40
  3. data/CHANGELOG.md +610 -0
  4. data/CONTRIBUTING.md +328 -116
  5. data/EMULATOR.md +2 -2
  6. data/LOGGING.md +95 -3
  7. data/OVERVIEW.md +183 -90
  8. data/TROUBLESHOOTING.md +2 -8
  9. data/lib/google/cloud/pubsub/acknowledge_result.rb +79 -0
  10. data/lib/google/cloud/pubsub/async_publisher/batch.rb +306 -0
  11. data/lib/google/cloud/pubsub/async_publisher.rb +270 -161
  12. data/lib/google/cloud/pubsub/batch_publisher.rb +65 -33
  13. data/lib/google/cloud/pubsub/convert.rb +36 -8
  14. data/lib/google/cloud/pubsub/credentials.rb +7 -5
  15. data/lib/google/cloud/pubsub/errors.rb +93 -0
  16. data/lib/google/cloud/pubsub/flow_controller.rb +139 -0
  17. data/lib/google/cloud/pubsub/message.rb +52 -7
  18. data/lib/google/cloud/pubsub/policy.rb +15 -12
  19. data/lib/google/cloud/pubsub/project.rb +341 -75
  20. data/lib/google/cloud/pubsub/publish_result.rb +9 -2
  21. data/lib/google/cloud/pubsub/received_message.rb +182 -20
  22. data/lib/google/cloud/pubsub/retry_policy.rb +88 -0
  23. data/lib/google/cloud/pubsub/schema/list.rb +180 -0
  24. data/lib/google/cloud/pubsub/schema.rb +310 -0
  25. data/lib/google/cloud/pubsub/service.rb +285 -258
  26. data/lib/google/cloud/pubsub/snapshot/list.rb +14 -14
  27. data/lib/google/cloud/pubsub/snapshot.rb +17 -12
  28. data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +4 -4
  29. data/lib/google/cloud/pubsub/subscriber/inventory.rb +74 -33
  30. data/lib/google/cloud/pubsub/subscriber/sequencer.rb +115 -0
  31. data/lib/google/cloud/pubsub/subscriber/stream.rb +138 -91
  32. data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +397 -0
  33. data/lib/google/cloud/pubsub/subscriber.rb +213 -51
  34. data/lib/google/cloud/pubsub/subscription/list.rb +16 -16
  35. data/lib/google/cloud/pubsub/subscription/push_config.rb +268 -0
  36. data/lib/google/cloud/pubsub/subscription.rb +827 -137
  37. data/lib/google/cloud/pubsub/topic/list.rb +14 -14
  38. data/lib/google/cloud/pubsub/topic.rb +565 -93
  39. data/lib/google/cloud/pubsub/version.rb +4 -2
  40. data/lib/google/cloud/pubsub.rb +50 -41
  41. data/lib/google-cloud-pubsub.rb +26 -29
  42. metadata +59 -53
  43. data/lib/google/cloud/pubsub/subscriber/async_stream_pusher.rb +0 -222
  44. data/lib/google/cloud/pubsub/subscriber/async_unary_pusher.rb +0 -270
  45. data/lib/google/cloud/pubsub/v1/credentials.rb +0 -39
  46. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -63
  47. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -128
  48. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
  49. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
  50. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -230
  51. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -109
  52. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -628
  53. data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -734
  54. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -105
  55. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1267
  56. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -144
  57. data/lib/google/cloud/pubsub/v1.rb +0 -17
  58. data/lib/google/pubsub/v1/pubsub_pb.rb +0 -222
  59. data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -192
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e04bfd015838726c4fdd745c2a4fa04d22a7bbe7a79a255fcc19987697769fd8
4
- data.tar.gz: ab43471a308ba83145be50db01082b3a77b39f3b61b79384b37cd46f21c2dcfb
3
+ metadata.gz: b6f6bca71a506686e481d68852eee2813f5b10908b824089e07bf6ad4070d10a
4
+ data.tar.gz: a52f4f7140448a02c2806ed2d7b04a36b1d62f686cb5d0a62dbfce26670165b6
5
5
  SHA512:
6
- metadata.gz: ed5543bd1d0556486877c6ac13762c1baeb69e791272473d204a511c40451d381a9ebf82ce0bc819cd7fa68b3176c7886857b02a87bba170d24bb56d8e0689ea
7
- data.tar.gz: d89498904abfcc1e1f1ffd1425b6e5c847a82ddf170b0e2d497fcbe7f238112d8567540a7bf2294329a26ed778cf58df6fef9d805678bc7c2e7ff4ff3224dad4
6
+ metadata.gz: 83662ae6574bf94c38bf19dfc46cda6f6a4fa11b465640ac35794a8ed38f2476244f5be5fb54ef82a1aac90fe4a0b890212e540f5136faaf1b480156d40b2217
7
+ data.tar.gz: fded200fa64d0f38a047fa3e2ea5bb3d3c204e8e82748b3611e796e2812809b98281865a923ca33ca2d3086d7c7ef72ca0671656813d77805f49b4b7b32f6e9b
data/AUTHENTICATION.md CHANGED
@@ -2,20 +2,39 @@
2
2
 
3
3
  In general, the google-cloud-pubsub library uses [Service
4
4
  Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
- credentials to connect to Google Cloud services. When running on Compute Engine
5
+ credentials to connect to Google Cloud services. When running within [Google
6
+ Cloud Platform environments](#google-cloud-platform-environments)
6
7
  the credentials will be discovered automatically. When running on other
7
8
  environments, the Service Account credentials can be specified by providing the
8
9
  path to the [JSON
9
10
  keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
10
- the account (or the JSON itself) in environment variables. Additionally, Cloud
11
- SDK credentials can also be discovered automatically, but this is only
12
- recommended during development.
11
+ the account (or the JSON itself) in [environment
12
+ variables](#environment-variables). Additionally, Cloud SDK credentials can also
13
+ be discovered automatically, but this is only recommended during development.
14
+
15
+ ## Quickstart
16
+
17
+ 1. [Create a service account and credentials](#creating-a-service-account).
18
+ 2. Set the [environment variable](#environment-variables).
19
+
20
+ ```sh
21
+ export PUBSUB_CREDENTIALS=/path/to/json`
22
+ ```
23
+
24
+ 3. Initialize the client.
25
+
26
+ ```ruby
27
+ require "google/cloud/pubsub"
28
+
29
+ client = Google::Cloud::PubSub.new
30
+ ```
13
31
 
14
32
  ## Project and Credential Lookup
15
33
 
16
- The google-cloud-pubsub library aims to make authentication as simple as
17
- possible, and provides several mechanisms to configure your system without
18
- providing **Project ID** and **Service Account Credentials** directly in code.
34
+ The google-cloud-pubsub library aims to make authentication
35
+ as simple as possible, and provides several mechanisms to configure your system
36
+ without providing **Project ID** and **Service Account Credentials** directly in
37
+ code.
19
38
 
20
39
  **Project ID** is discovered in the following order:
21
40
 
@@ -23,6 +42,7 @@ providing **Project ID** and **Service Account Credentials** directly in code.
23
42
  2. Specify project ID in configuration
24
43
  3. Discover project ID in environment variables
25
44
  4. Discover GCE project ID
45
+ 5. Discover project ID in credentials JSON
26
46
 
27
47
  **Credentials** are discovered in the following order:
28
48
 
@@ -35,32 +55,10 @@ providing **Project ID** and **Service Account Credentials** directly in code.
35
55
 
36
56
  ### Google Cloud Platform environments
37
57
 
38
- While running on Google Cloud Platform environments such as Google Compute
39
- Engine, Google App Engine and Google Kubernetes Engine, no extra work is needed.
40
- The **Project ID** and **Credentials** and are discovered automatically. Code
41
- should be written as if already authenticated. Just be sure when you [set up the
42
- GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
43
- access. For example:
44
-
45
- * **All APIs**
46
- * `https://www.googleapis.com/auth/cloud-platform`
47
- * `https://www.googleapis.com/auth/cloud-platform.read-only`
48
- * **BigQuery**
49
- * `https://www.googleapis.com/auth/bigquery`
50
- * `https://www.googleapis.com/auth/bigquery.insertdata`
51
- * **Compute Engine**
52
- * `https://www.googleapis.com/auth/compute`
53
- * **Datastore**
54
- * `https://www.googleapis.com/auth/datastore`
55
- * `https://www.googleapis.com/auth/userinfo.email`
56
- * **DNS**
57
- * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
58
- * **Pub/Sub**
59
- * `https://www.googleapis.com/auth/pubsub`
60
- * **Storage**
61
- * `https://www.googleapis.com/auth/devstorage.full_control`
62
- * `https://www.googleapis.com/auth/devstorage.read_only`
63
- * `https://www.googleapis.com/auth/devstorage.read_write`
58
+ When running on Google Cloud Platform (GCP), including Google Compute Engine (GCE),
59
+ Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions
60
+ (GCF) and Cloud Run, the **Project ID** and **Credentials** and are discovered
61
+ automatically. Code should be written as if already authenticated.
64
62
 
65
63
  ### Environment Variables
66
64
 
@@ -73,12 +71,13 @@ environment variable, or the **Credentials JSON** itself can be stored for
73
71
  environments such as Docker containers where writing files is difficult or not
74
72
  encouraged.
75
73
 
76
- The environment variables that Pub/Sub checks for project ID are:
74
+ The environment variables that google-cloud-pubsub checks for project ID are:
77
75
 
78
76
  1. `PUBSUB_PROJECT`
79
77
  2. `GOOGLE_CLOUD_PROJECT`
80
78
 
81
- The environment variables that Pub/Sub checks for credentials are configured on {Google::Cloud::Pubsub::V1::Credentials}:
79
+ The environment variables that google-cloud-pubsub checks for credentials
80
+ are configured on {Google::Cloud::PubSub::Credentials}:
82
81
 
83
82
  1. `PUBSUB_CREDENTIALS` - Path to JSON file, or JSON contents
84
83
  2. `PUBSUB_KEYFILE` - Path to JSON file, or JSON contents
@@ -92,22 +91,23 @@ require "google/cloud/pubsub"
92
91
  ENV["PUBSUB_PROJECT"] = "my-project-id"
93
92
  ENV["PUBSUB_CREDENTIALS"] = "path/to/keyfile.json"
94
93
 
95
- pubsub = Google::Cloud::Pubsub.new
94
+ client = Google::Cloud::PubSub.new
96
95
  ```
97
96
 
98
97
  ### Configuration
99
98
 
100
- The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
99
+ The **Project ID** and the path to the **Credentials JSON** file can be configured
100
+ instead of placing them in environment variables or providing them as arguments.
101
101
 
102
102
  ```ruby
103
103
  require "google/cloud/pubsub"
104
104
 
105
- Google::Cloud::Pubsub.configure do |config|
105
+ Google::Cloud::PubSub.configure do |config|
106
106
  config.project_id = "my-project-id"
107
107
  config.credentials = "path/to/keyfile.json"
108
108
  end
109
109
 
110
- pubsub = Google::Cloud::Pubsub.new
110
+ client = Google::Cloud::PubSub.new
111
111
  ```
112
112
 
113
113
  ### Cloud SDK
@@ -140,7 +140,8 @@ Google Cloud requires a **Project ID** and **Service Account Credentials** to
140
140
  connect to the APIs. You will use the **Project ID** and **JSON key file** to
141
141
  connect to most services with google-cloud-pubsub.
142
142
 
143
- If you are not running this client on Google Compute Engine, you need a Google
143
+ If you are not running this client within [Google Cloud Platform
144
+ environments](#google-cloud-platform-environments), you need a Google
144
145
  Developers service account.
145
146
 
146
147
  1. Visit the [Google Developers Console][dev-console].