google-cloud-pubsub-v1 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 441674812241a0cdd2bfe5571966a5f9893f9f247868b13858e854809d2def9b
4
- data.tar.gz: 0b1c9adfc174e0a0ced3341c79d8de58e47501347d1295427b2b13a395c59d99
3
+ metadata.gz: 2233afdcd4fe4c34f387fbfd93371cbdb70a62d3e5a444ee1c4961efb21c8cb5
4
+ data.tar.gz: 22f735a4ed18efc9fb5da808cb83be2982dcd33a967e5bd1c8f037675ab134dd
5
5
  SHA512:
6
- metadata.gz: 892d5ae726abd72028e2915d1d54397afe410bd61fe596edfa06c8ec9e56770dd1be1b3105c6526c1cd34490da2364568083d24650d3f53451efb7b90594aeef
7
- data.tar.gz: bc38b3afe7a0324650f14816feac655604d375018b53e8ba0667cef087aae86adb390b518c7b40a2f07ee318aa3762bba58771af08d550e6dcd813a8a1e28151
6
+ metadata.gz: f34e28248729cc29e28b8ad3b4419125fe189e133782aa40e8713abb57764cd0cafe1e71c511a0235c1c4201a84d96790a48f8f55915b14d518eca97f65f145c
7
+ data.tar.gz: 9e8c6589813541a1167b426f8195acb1922d87be4ebbba066905b6dd2c03f10e3b0fbd0b706422af0664bba9ad7de0ad2d6f4e92fdc501e3b177f89c52cc58a4
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --no-private
2
- --title=Cloud Pub/Sub V1 API
2
+ --title="Cloud Pub/Sub V1 API"
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
5
  --markup-provider redcarpet
data/AUTHENTICATION.md CHANGED
@@ -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 Developers Console][dev-console].
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 slide-out navigation tray and select **API Manager**. From
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
- You should see a screen like one of the following.
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, and click "Generate
164
- new JSON key":
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.
data/README.md CHANGED
@@ -37,7 +37,7 @@ request = ::Google::Cloud::PubSub::V1::CreateSchemaRequest.new # (request fields
37
37
  response = client.create_schema request
38
38
  ```
39
39
 
40
- View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-pubsub-v1/latest)
40
+ View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-pubsub-v1/latest)
41
41
  for class and method documentation.
42
42
 
43
43
  See also the [Product Documentation](https://cloud.google.com/pubsub)
@@ -202,6 +202,21 @@ module Google
202
202
  #
203
203
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
204
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
+ #
205
220
  def set_iam_policy request, options = nil
206
221
  raise ::ArgumentError, "request must be provided" if request.nil?
207
222
 
@@ -219,9 +234,11 @@ module Google
219
234
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
220
235
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
221
236
 
222
- header_params = {
223
- "resource" => request.resource
224
- }
237
+ header_params = {}
238
+ if request.resource
239
+ header_params["resource"] = request.resource
240
+ end
241
+
225
242
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
226
243
  metadata[:"x-goog-request-params"] ||= request_params_header
227
244
 
@@ -276,6 +293,21 @@ module Google
276
293
  #
277
294
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
278
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
+ #
279
311
  def get_iam_policy request, options = nil
280
312
  raise ::ArgumentError, "request must be provided" if request.nil?
281
313
 
@@ -293,9 +325,11 @@ module Google
293
325
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
294
326
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
327
 
296
- header_params = {
297
- "resource" => request.resource
298
- }
328
+ header_params = {}
329
+ if request.resource
330
+ header_params["resource"] = request.resource
331
+ end
332
+
299
333
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
300
334
  metadata[:"x-goog-request-params"] ||= request_params_header
301
335
 
@@ -356,6 +390,21 @@ module Google
356
390
  #
357
391
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
358
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
+ #
359
408
  def test_iam_permissions request, options = nil
360
409
  raise ::ArgumentError, "request must be provided" if request.nil?
361
410
 
@@ -373,9 +422,11 @@ module Google
373
422
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
374
423
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
375
424
 
376
- header_params = {
377
- "resource" => request.resource
378
- }
425
+ header_params = {}
426
+ if request.resource
427
+ header_params["resource"] = request.resource
428
+ end
429
+
379
430
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
380
431
  metadata[:"x-goog-request-params"] ||= request_params_header
381
432
 
@@ -251,6 +251,21 @@ module Google
251
251
  #
252
252
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
253
253
  #
254
+ # @example Basic example
255
+ # require "google/cloud/pubsub/v1"
256
+ #
257
+ # # Create a client object. The client can be reused for multiple calls.
258
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
259
+ #
260
+ # # Create a request. To set request fields, pass in keyword arguments.
261
+ # request = Google::Cloud::PubSub::V1::Topic.new
262
+ #
263
+ # # Call the create_topic method.
264
+ # result = client.create_topic request
265
+ #
266
+ # # The returned object is of type Google::Cloud::PubSub::V1::Topic.
267
+ # p result
268
+ #
254
269
  def create_topic request, options = nil
255
270
  raise ::ArgumentError, "request must be provided" if request.nil?
256
271
 
@@ -268,9 +283,11 @@ module Google
268
283
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
269
284
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
270
285
 
271
- header_params = {
272
- "name" => request.name
273
- }
286
+ header_params = {}
287
+ if request.name
288
+ header_params["name"] = request.name
289
+ end
290
+
274
291
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
275
292
  metadata[:"x-goog-request-params"] ||= request_params_header
276
293
 
@@ -326,6 +343,21 @@ module Google
326
343
  #
327
344
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
328
345
  #
346
+ # @example Basic example
347
+ # require "google/cloud/pubsub/v1"
348
+ #
349
+ # # Create a client object. The client can be reused for multiple calls.
350
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
351
+ #
352
+ # # Create a request. To set request fields, pass in keyword arguments.
353
+ # request = Google::Cloud::PubSub::V1::UpdateTopicRequest.new
354
+ #
355
+ # # Call the update_topic method.
356
+ # result = client.update_topic request
357
+ #
358
+ # # The returned object is of type Google::Cloud::PubSub::V1::Topic.
359
+ # p result
360
+ #
329
361
  def update_topic request, options = nil
330
362
  raise ::ArgumentError, "request must be provided" if request.nil?
331
363
 
@@ -343,9 +375,11 @@ module Google
343
375
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
344
376
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
345
377
 
346
- header_params = {
347
- "topic.name" => request.topic.name
348
- }
378
+ header_params = {}
379
+ if request.topic&.name
380
+ header_params["topic.name"] = request.topic.name
381
+ end
382
+
349
383
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
350
384
  metadata[:"x-goog-request-params"] ||= request_params_header
351
385
 
@@ -398,6 +432,21 @@ module Google
398
432
  #
399
433
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
400
434
  #
435
+ # @example Basic example
436
+ # require "google/cloud/pubsub/v1"
437
+ #
438
+ # # Create a client object. The client can be reused for multiple calls.
439
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
440
+ #
441
+ # # Create a request. To set request fields, pass in keyword arguments.
442
+ # request = Google::Cloud::PubSub::V1::PublishRequest.new
443
+ #
444
+ # # Call the publish method.
445
+ # result = client.publish request
446
+ #
447
+ # # The returned object is of type Google::Cloud::PubSub::V1::PublishResponse.
448
+ # p result
449
+ #
401
450
  def publish request, options = nil
402
451
  raise ::ArgumentError, "request must be provided" if request.nil?
403
452
 
@@ -415,9 +464,11 @@ module Google
415
464
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
416
465
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
417
466
 
418
- header_params = {
419
- "topic" => request.topic
420
- }
467
+ header_params = {}
468
+ if request.topic
469
+ header_params["topic"] = request.topic
470
+ end
471
+
421
472
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
422
473
  metadata[:"x-goog-request-params"] ||= request_params_header
423
474
 
@@ -467,6 +518,21 @@ module Google
467
518
  #
468
519
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
469
520
  #
521
+ # @example Basic example
522
+ # require "google/cloud/pubsub/v1"
523
+ #
524
+ # # Create a client object. The client can be reused for multiple calls.
525
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
526
+ #
527
+ # # Create a request. To set request fields, pass in keyword arguments.
528
+ # request = Google::Cloud::PubSub::V1::GetTopicRequest.new
529
+ #
530
+ # # Call the get_topic method.
531
+ # result = client.get_topic request
532
+ #
533
+ # # The returned object is of type Google::Cloud::PubSub::V1::Topic.
534
+ # p result
535
+ #
470
536
  def get_topic request, options = nil
471
537
  raise ::ArgumentError, "request must be provided" if request.nil?
472
538
 
@@ -484,9 +550,11 @@ module Google
484
550
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
485
551
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
486
552
 
487
- header_params = {
488
- "topic" => request.topic
489
- }
553
+ header_params = {}
554
+ if request.topic
555
+ header_params["topic"] = request.topic
556
+ end
557
+
490
558
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
491
559
  metadata[:"x-goog-request-params"] ||= request_params_header
492
560
 
@@ -542,6 +610,27 @@ module Google
542
610
  #
543
611
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
544
612
  #
613
+ # @example Basic example
614
+ # require "google/cloud/pubsub/v1"
615
+ #
616
+ # # Create a client object. The client can be reused for multiple calls.
617
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
618
+ #
619
+ # # Create a request. To set request fields, pass in keyword arguments.
620
+ # request = Google::Cloud::PubSub::V1::ListTopicsRequest.new
621
+ #
622
+ # # Call the list_topics method.
623
+ # result = client.list_topics request
624
+ #
625
+ # # The returned object is of type Gapic::PagedEnumerable. You can
626
+ # # iterate over all elements by calling #each, and the enumerable
627
+ # # will lazily make API calls to fetch subsequent pages. Other
628
+ # # methods are also available for managing paging directly.
629
+ # result.each do |response|
630
+ # # Each element is of type ::Google::Cloud::PubSub::V1::Topic.
631
+ # p response
632
+ # end
633
+ #
545
634
  def list_topics request, options = nil
546
635
  raise ::ArgumentError, "request must be provided" if request.nil?
547
636
 
@@ -559,9 +648,11 @@ module Google
559
648
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
560
649
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
561
650
 
562
- header_params = {
563
- "project" => request.project
564
- }
651
+ header_params = {}
652
+ if request.project
653
+ header_params["project"] = request.project
654
+ end
655
+
565
656
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
566
657
  metadata[:"x-goog-request-params"] ||= request_params_header
567
658
 
@@ -618,6 +709,21 @@ module Google
618
709
  #
619
710
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
620
711
  #
712
+ # @example Basic example
713
+ # require "google/cloud/pubsub/v1"
714
+ #
715
+ # # Create a client object. The client can be reused for multiple calls.
716
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
717
+ #
718
+ # # Create a request. To set request fields, pass in keyword arguments.
719
+ # request = Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest.new
720
+ #
721
+ # # Call the list_topic_subscriptions method.
722
+ # result = client.list_topic_subscriptions request
723
+ #
724
+ # # The returned object is of type Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse.
725
+ # p result
726
+ #
621
727
  def list_topic_subscriptions request, options = nil
622
728
  raise ::ArgumentError, "request must be provided" if request.nil?
623
729
 
@@ -635,9 +741,11 @@ module Google
635
741
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
636
742
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
637
743
 
638
- header_params = {
639
- "topic" => request.topic
640
- }
744
+ header_params = {}
745
+ if request.topic
746
+ header_params["topic"] = request.topic
747
+ end
748
+
641
749
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
642
750
  metadata[:"x-goog-request-params"] ||= request_params_header
643
751
 
@@ -697,6 +805,21 @@ module Google
697
805
  #
698
806
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
699
807
  #
808
+ # @example Basic example
809
+ # require "google/cloud/pubsub/v1"
810
+ #
811
+ # # Create a client object. The client can be reused for multiple calls.
812
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
813
+ #
814
+ # # Create a request. To set request fields, pass in keyword arguments.
815
+ # request = Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest.new
816
+ #
817
+ # # Call the list_topic_snapshots method.
818
+ # result = client.list_topic_snapshots request
819
+ #
820
+ # # The returned object is of type Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse.
821
+ # p result
822
+ #
700
823
  def list_topic_snapshots request, options = nil
701
824
  raise ::ArgumentError, "request must be provided" if request.nil?
702
825
 
@@ -714,9 +837,11 @@ module Google
714
837
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
715
838
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
716
839
 
717
- header_params = {
718
- "topic" => request.topic
719
- }
840
+ header_params = {}
841
+ if request.topic
842
+ header_params["topic"] = request.topic
843
+ end
844
+
720
845
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
721
846
  metadata[:"x-goog-request-params"] ||= request_params_header
722
847
 
@@ -770,6 +895,21 @@ module Google
770
895
  #
771
896
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
772
897
  #
898
+ # @example Basic example
899
+ # require "google/cloud/pubsub/v1"
900
+ #
901
+ # # Create a client object. The client can be reused for multiple calls.
902
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
903
+ #
904
+ # # Create a request. To set request fields, pass in keyword arguments.
905
+ # request = Google::Cloud::PubSub::V1::DeleteTopicRequest.new
906
+ #
907
+ # # Call the delete_topic method.
908
+ # result = client.delete_topic request
909
+ #
910
+ # # The returned object is of type Google::Protobuf::Empty.
911
+ # p result
912
+ #
773
913
  def delete_topic request, options = nil
774
914
  raise ::ArgumentError, "request must be provided" if request.nil?
775
915
 
@@ -787,9 +927,11 @@ module Google
787
927
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
788
928
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
789
929
 
790
- header_params = {
791
- "topic" => request.topic
792
- }
930
+ header_params = {}
931
+ if request.topic
932
+ header_params["topic"] = request.topic
933
+ end
934
+
793
935
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
794
936
  metadata[:"x-goog-request-params"] ||= request_params_header
795
937
 
@@ -842,6 +984,21 @@ module Google
842
984
  #
843
985
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
844
986
  #
987
+ # @example Basic example
988
+ # require "google/cloud/pubsub/v1"
989
+ #
990
+ # # Create a client object. The client can be reused for multiple calls.
991
+ # client = Google::Cloud::PubSub::V1::Publisher::Client.new
992
+ #
993
+ # # Create a request. To set request fields, pass in keyword arguments.
994
+ # request = Google::Cloud::PubSub::V1::DetachSubscriptionRequest.new
995
+ #
996
+ # # Call the detach_subscription method.
997
+ # result = client.detach_subscription request
998
+ #
999
+ # # The returned object is of type Google::Cloud::PubSub::V1::DetachSubscriptionResponse.
1000
+ # p result
1001
+ #
845
1002
  def detach_subscription request, options = nil
846
1003
  raise ::ArgumentError, "request must be provided" if request.nil?
847
1004
 
@@ -859,9 +1016,11 @@ module Google
859
1016
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
860
1017
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
861
1018
 
862
- header_params = {
863
- "subscription" => request.subscription
864
- }
1019
+ header_params = {}
1020
+ if request.subscription
1021
+ header_params["subscription"] = request.subscription
1022
+ end
1023
+
865
1024
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
866
1025
  metadata[:"x-goog-request-params"] ||= request_params_header
867
1026