google-cloud-pubsub-v1 0.5.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +10 -28
- data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +98 -48
- data/lib/google/cloud/pubsub/v1/publisher/client.rb +252 -73
- data/lib/google/cloud/pubsub/v1/schema_service/client.rb +173 -60
- data/lib/google/cloud/pubsub/v1/subscriber/client.rb +416 -99
- data/lib/google/cloud/pubsub/v1/version.rb +1 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +4 -2
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +2 -2
- data/lib/google/pubsub/v1/schema_pb.rb +2 -2
- data/lib/google/pubsub/v1/schema_services_pb.rb +1 -1
- data/proto_docs/google/api/resource.rb +10 -71
- data/proto_docs/google/pubsub/v1/pubsub.rb +21 -2
- data/proto_docs/google/pubsub/v1/schema.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9b371b74af6822f2303c2dfd2b419d68425e30c004c717fbaa31d98717f9d2e
|
4
|
+
data.tar.gz: 9a11eaf7b57bc71d1dc798d886cf0a27b1edc5d32ca52f4a10c59c65d5619a0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e967c29446173d32f770818d11b736264e5d20a79cc69779c1ff7d5794e7c13f8cfada536623f9e9e2ac04eeace5564fd22fa1a55d4f025d4d2b82501288f93c
|
7
|
+
data.tar.gz: a3b925dfeccfbb6e8f50d41d26a15dfdc344d8b83ba6ddd1ca2d95f1ada99a793bce5a3620b7c6150f9257e65cf864161843e5f7c231c2032675d29a937d3949
|
data/.yardopts
CHANGED
data/AUTHENTICATION.md
CHANGED
@@ -82,8 +82,8 @@ client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
|
82
82
|
|
83
83
|
### Configuration
|
84
84
|
|
85
|
-
The **Credentials JSON** can be configured instead of
|
86
|
-
environment
|
85
|
+
The path to the **Credentials JSON** file can be configured instead of storing
|
86
|
+
it in an environment variable. Either on an individual client initialization:
|
87
87
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/pubsub/v1"
|
@@ -93,7 +93,7 @@ client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
|
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
96
|
-
Or
|
96
|
+
Or globally for all clients:
|
97
97
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/pubsub/v1"
|
@@ -120,15 +120,6 @@ To configure your system for this, simply:
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
121
121
|
*should* only be used during development.
|
122
122
|
|
123
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
124
|
-
[dev-console]: https://console.cloud.google.com/project
|
125
|
-
|
126
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
127
|
-
|
128
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
129
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
130
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
131
|
-
|
132
123
|
## Creating a Service Account
|
133
124
|
|
134
125
|
Google Cloud requires **Service Account Credentials** to
|
@@ -139,31 +130,22 @@ If you are not running this client within
|
|
139
130
|
[Google Cloud Platform environments](#google-cloud-platform-environments), you
|
140
131
|
need a Google Developers service account.
|
141
132
|
|
142
|
-
1. Visit the [Google
|
133
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
143
134
|
2. Create a new project or click on an existing project.
|
144
|
-
3. Activate the
|
135
|
+
3. Activate the menu in the upper left and select **APIs & Services**. From
|
145
136
|
here, you will enable the APIs that your application requires.
|
146
137
|
|
147
|
-
![Enable the APIs that your application requires][enable-apis]
|
148
|
-
|
149
138
|
*Note: You may need to enable billing in order to use these services.*
|
150
139
|
|
151
140
|
4. Select **Credentials** from the side navigation.
|
152
141
|
|
153
|
-
|
154
|
-
|
155
|
-
![Create a new service account][create-new-service-account]
|
156
|
-
|
157
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
158
|
-
|
159
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
160
|
-
guided through downloading a new JSON key file.
|
142
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
143
|
+
"Service account" to be guided through downloading a new JSON key file.
|
161
144
|
|
162
145
|
If you want to re-use an existing service account, you can easily generate a
|
163
|
-
new key file. Just select the account you wish to re-use,
|
164
|
-
|
165
|
-
|
166
|
-
![Re-use an existing service account][reuse-service-account]
|
146
|
+
new key file. Just select the account you wish to re-use, click the pencil
|
147
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
148
|
+
and then select **Add Key**.
|
167
149
|
|
168
150
|
The key file you download will be used by this library to authenticate API
|
169
151
|
requests and should be stored in a secure location.
|
@@ -63,13 +63,12 @@ module Google
|
|
63
63
|
# See {::Google::Cloud::PubSub::V1::IAMPolicy::Client::Configuration}
|
64
64
|
# for a description of the configuration fields.
|
65
65
|
#
|
66
|
-
#
|
66
|
+
# @example
|
67
67
|
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
# end
|
68
|
+
# # Modify the configuration for all IAMPolicy clients
|
69
|
+
# ::Google::Cloud::PubSub::V1::IAMPolicy::Client.configure do |config|
|
70
|
+
# config.timeout = 10.0
|
71
|
+
# end
|
73
72
|
#
|
74
73
|
# @yield [config] Configure the Client client.
|
75
74
|
# @yieldparam config [Client::Configuration]
|
@@ -116,19 +115,15 @@ module Google
|
|
116
115
|
##
|
117
116
|
# Create a new IAMPolicy client object.
|
118
117
|
#
|
119
|
-
#
|
120
|
-
#
|
121
|
-
# To create a new IAMPolicy client with the default
|
122
|
-
# configuration:
|
118
|
+
# @example
|
123
119
|
#
|
124
|
-
#
|
120
|
+
# # Create a client using the default configuration
|
121
|
+
# client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new
|
125
122
|
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
# config.timeout = 10.0
|
131
|
-
# end
|
123
|
+
# # Create a client using a custom configuration
|
124
|
+
# client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new do |config|
|
125
|
+
# config.timeout = 10.0
|
126
|
+
# end
|
132
127
|
#
|
133
128
|
# @yield [config] Configure the IAMPolicy client.
|
134
129
|
# @yieldparam config [Client::Configuration]
|
@@ -148,10 +143,9 @@ module Google
|
|
148
143
|
|
149
144
|
# Create credentials
|
150
145
|
credentials = @config.credentials
|
151
|
-
# Use self-signed JWT if the
|
146
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
152
147
|
# but only if the default endpoint does not have a region prefix.
|
153
|
-
enable_self_signed_jwt = @config.
|
154
|
-
@config.endpoint == Client.configure.endpoint &&
|
148
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
155
149
|
!@config.endpoint.split(".").first.include?("-")
|
156
150
|
credentials ||= Credentials.default scope: @config.scope,
|
157
151
|
enable_self_signed_jwt: enable_self_signed_jwt
|
@@ -208,6 +202,21 @@ module Google
|
|
208
202
|
#
|
209
203
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
210
204
|
#
|
205
|
+
# @example Basic example
|
206
|
+
# require "google/iam/v1"
|
207
|
+
#
|
208
|
+
# # Create a client object. The client can be reused for multiple calls.
|
209
|
+
# client = Google::Cloud::PubSub::V1::IAMPolicy::Client.new
|
210
|
+
#
|
211
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
212
|
+
# request = Google::Iam::V1::SetIamPolicyRequest.new
|
213
|
+
#
|
214
|
+
# # Call the set_iam_policy method.
|
215
|
+
# result = client.set_iam_policy request
|
216
|
+
#
|
217
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
218
|
+
# p result
|
219
|
+
#
|
211
220
|
def set_iam_policy request, options = nil
|
212
221
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
213
222
|
|
@@ -225,16 +234,20 @@ module Google
|
|
225
234
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
226
235
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
227
236
|
|
228
|
-
header_params = {
|
229
|
-
|
230
|
-
|
237
|
+
header_params = {}
|
238
|
+
if request.resource
|
239
|
+
header_params["resource"] = request.resource
|
240
|
+
end
|
241
|
+
|
231
242
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
232
243
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
233
244
|
|
234
245
|
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
235
246
|
metadata: metadata,
|
236
247
|
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
237
|
-
|
248
|
+
|
249
|
+
options.apply_defaults timeout: @config.timeout,
|
250
|
+
metadata: @config.metadata,
|
238
251
|
retry_policy: @config.retry_policy
|
239
252
|
|
240
253
|
@iam_policy_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
@@ -280,6 +293,21 @@ module Google
|
|
280
293
|
#
|
281
294
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
282
295
|
#
|
296
|
+
# @example Basic example
|
297
|
+
# require "google/iam/v1"
|
298
|
+
#
|
299
|
+
# # Create a client object. The client can be reused for multiple calls.
|
300
|
+
# client = Google::Cloud::PubSub::V1::IAMPolicy::Client.new
|
301
|
+
#
|
302
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
303
|
+
# request = Google::Iam::V1::GetIamPolicyRequest.new
|
304
|
+
#
|
305
|
+
# # Call the get_iam_policy method.
|
306
|
+
# result = client.get_iam_policy request
|
307
|
+
#
|
308
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
309
|
+
# p result
|
310
|
+
#
|
283
311
|
def get_iam_policy request, options = nil
|
284
312
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
285
313
|
|
@@ -297,16 +325,20 @@ module Google
|
|
297
325
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
298
326
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
299
327
|
|
300
|
-
header_params = {
|
301
|
-
|
302
|
-
|
328
|
+
header_params = {}
|
329
|
+
if request.resource
|
330
|
+
header_params["resource"] = request.resource
|
331
|
+
end
|
332
|
+
|
303
333
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
304
334
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
305
335
|
|
306
336
|
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
307
337
|
metadata: metadata,
|
308
338
|
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
309
|
-
|
339
|
+
|
340
|
+
options.apply_defaults timeout: @config.timeout,
|
341
|
+
metadata: @config.metadata,
|
310
342
|
retry_policy: @config.retry_policy
|
311
343
|
|
312
344
|
@iam_policy_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
|
@@ -358,6 +390,21 @@ module Google
|
|
358
390
|
#
|
359
391
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
360
392
|
#
|
393
|
+
# @example Basic example
|
394
|
+
# require "google/iam/v1"
|
395
|
+
#
|
396
|
+
# # Create a client object. The client can be reused for multiple calls.
|
397
|
+
# client = Google::Cloud::PubSub::V1::IAMPolicy::Client.new
|
398
|
+
#
|
399
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
400
|
+
# request = Google::Iam::V1::TestIamPermissionsRequest.new
|
401
|
+
#
|
402
|
+
# # Call the test_iam_permissions method.
|
403
|
+
# result = client.test_iam_permissions request
|
404
|
+
#
|
405
|
+
# # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
|
406
|
+
# p result
|
407
|
+
#
|
361
408
|
def test_iam_permissions request, options = nil
|
362
409
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
363
410
|
|
@@ -375,16 +422,20 @@ module Google
|
|
375
422
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
376
423
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
377
424
|
|
378
|
-
header_params = {
|
379
|
-
|
380
|
-
|
425
|
+
header_params = {}
|
426
|
+
if request.resource
|
427
|
+
header_params["resource"] = request.resource
|
428
|
+
end
|
429
|
+
|
381
430
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
382
431
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
383
432
|
|
384
433
|
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
385
434
|
metadata: metadata,
|
386
435
|
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
387
|
-
|
436
|
+
|
437
|
+
options.apply_defaults timeout: @config.timeout,
|
438
|
+
metadata: @config.metadata,
|
388
439
|
retry_policy: @config.retry_policy
|
389
440
|
|
390
441
|
@iam_policy_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
@@ -408,22 +459,21 @@ module Google
|
|
408
459
|
# Configuration can be applied globally to all clients, or to a single client
|
409
460
|
# on construction.
|
410
461
|
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
# to 20 seconds,
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
423
|
-
#
|
424
|
-
#
|
425
|
-
#
|
426
|
-
# end
|
462
|
+
# @example
|
463
|
+
#
|
464
|
+
# # Modify the global config, setting the timeout for
|
465
|
+
# # set_iam_policy to 20 seconds,
|
466
|
+
# # and all remaining timeouts to 10 seconds.
|
467
|
+
# ::Google::Cloud::PubSub::V1::IAMPolicy::Client.configure do |config|
|
468
|
+
# config.timeout = 10.0
|
469
|
+
# config.rpcs.set_iam_policy.timeout = 20.0
|
470
|
+
# end
|
471
|
+
#
|
472
|
+
# # Apply the above configuration only to a new client.
|
473
|
+
# client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new do |config|
|
474
|
+
# config.timeout = 10.0
|
475
|
+
# config.rpcs.set_iam_policy.timeout = 20.0
|
476
|
+
# end
|
427
477
|
#
|
428
478
|
# @!attribute [rw] endpoint
|
429
479
|
# The hostname or hostname:port of the service endpoint.
|