google-cloud-pubsub 1.1.3 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +122 -0
  3. data/EMULATOR.md +1 -1
  4. data/TROUBLESHOOTING.md +2 -8
  5. data/lib/google/cloud/pubsub/async_publisher.rb +15 -19
  6. data/lib/google/cloud/pubsub/project.rb +18 -26
  7. data/lib/google/cloud/pubsub/received_message.rb +38 -0
  8. data/lib/google/cloud/pubsub/retry_policy.rb +90 -0
  9. data/lib/google/cloud/pubsub/service.rb +37 -15
  10. data/lib/google/cloud/pubsub/subscriber/inventory.rb +43 -15
  11. data/lib/google/cloud/pubsub/subscriber/stream.rb +7 -8
  12. data/lib/google/cloud/pubsub/subscriber.rb +86 -15
  13. data/lib/google/cloud/pubsub/subscription/push_config.rb +2 -2
  14. data/lib/google/cloud/pubsub/subscription.rb +296 -6
  15. data/lib/google/cloud/pubsub/topic.rb +65 -2
  16. data/lib/google/cloud/pubsub/v1/credentials.rb +1 -1
  17. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +1 -1
  18. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb +1 -1
  19. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +1 -1
  20. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +1 -1
  21. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +1 -1
  22. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +1 -1
  23. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +1 -1
  24. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +168 -79
  25. data/lib/google/cloud/pubsub/v1/doc/google/type/expr.rb +1 -1
  26. data/lib/google/cloud/pubsub/v1/publisher_client.rb +175 -33
  27. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +16 -1
  28. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +145 -64
  29. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +12 -3
  30. data/lib/google/cloud/pubsub/version.rb +1 -1
  31. data/lib/google/pubsub/v1/pubsub_pb.rb +20 -0
  32. data/lib/google/pubsub/v1/pubsub_services_pb.rb +7 -3
  33. metadata +6 -5
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -222,6 +222,9 @@ module Google
222
222
  google_api_client.freeze
223
223
 
224
224
  headers = { :"x-goog-api-client" => google_api_client }
225
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
226
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
227
+ end
225
228
  headers.merge!(metadata) unless metadata.nil?
226
229
  client_config_file = Pathname.new(__dir__).join(
227
230
  "subscriber_client_config.json"
@@ -304,6 +307,14 @@ module Google
304
307
  {'subscription' => request.subscription}
305
308
  end
306
309
  )
310
+ @get_snapshot = Google::Gax.create_api_call(
311
+ @subscriber_stub.method(:get_snapshot),
312
+ defaults["get_snapshot"],
313
+ exception_transformer: exception_transformer,
314
+ params_extractor: proc do |request|
315
+ {'snapshot' => request.snapshot}
316
+ end
317
+ )
307
318
  @modify_ack_deadline = Google::Gax.create_api_call(
308
319
  @subscriber_stub.method(:modify_ack_deadline),
309
320
  defaults["modify_ack_deadline"],
@@ -424,17 +435,16 @@ module Google
424
435
  # for REST API requests, you must specify a name in the request.
425
436
  #
426
437
  # @param name [String]
427
- # The name of the subscription. It must have the format
438
+ # Required. The name of the subscription. It must have the format
428
439
  # `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
429
440
  # start with a letter, and contain only letters (`[A-Za-z]`), numbers
430
441
  # (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
431
442
  # plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
432
- # in length, and it must not start with `"goog"`
443
+ # in length, and it must not start with `"goog"`.
433
444
  # @param topic [String]
434
- # The name of the topic from which this subscription is receiving messages.
435
- # Format is `projects/{project}/topics/{topic}`.
436
- # The value of this field will be `_deleted-topic_` if the topic has been
437
- # deleted.
445
+ # Required. The name of the topic from which this subscription is receiving
446
+ # messages. Format is `projects/{project}/topics/{topic}`. The value of this
447
+ # field will be `_deleted-topic_` if the topic has been deleted.
438
448
  # @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
439
449
  # If push delivery is used with this subscription, this field is
440
450
  # used to configure it. An empty `pushConfig` signifies that the subscriber
@@ -499,6 +509,12 @@ module Google
499
509
  # value for `expiration_policy.ttl` is 1 day.
500
510
  # A hash of the same form as `Google::Cloud::PubSub::V1::ExpirationPolicy`
501
511
  # can also be provided.
512
+ # @param filter [String]
513
+ # An expression written in the Pub/Sub [filter
514
+ # language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
515
+ # then only `PubsubMessage`s whose `attributes` field matches the filter are
516
+ # delivered on this subscription. If empty, then no messages are filtered
517
+ # out.
502
518
  # @param dead_letter_policy [Google::Cloud::PubSub::V1::DeadLetterPolicy | Hash]
503
519
  # A policy that specifies the conditions for dead lettering messages in
504
520
  # this subscription. If dead_letter_policy is not set, dead lettering
@@ -508,11 +524,24 @@ module Google
508
524
  # parent project (i.e.,
509
525
  # service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
510
526
  # permission to Acknowledge() messages on this subscription.
511
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
512
- # API might be changed in backward-incompatible ways and is not recommended
513
- # for production use. It is not subject to any SLA or deprecation policy.
514
527
  # A hash of the same form as `Google::Cloud::PubSub::V1::DeadLetterPolicy`
515
528
  # can also be provided.
529
+ # @param retry_policy [Google::Cloud::PubSub::V1::RetryPolicy | Hash]
530
+ # A policy that specifies how Pub/Sub retries message delivery for this
531
+ # subscription.
532
+ #
533
+ # If not set, the default retry policy is applied. This generally implies
534
+ # that messages will be retried as soon as possible for healthy subscribers.
535
+ # RetryPolicy will be triggered on NACKs or acknowledgement deadline
536
+ # exceeded events for a given message.
537
+ # A hash of the same form as `Google::Cloud::PubSub::V1::RetryPolicy`
538
+ # can also be provided.
539
+ # @param detached [true, false]
540
+ # Indicates whether the subscription is detached from its topic. Detached
541
+ # subscriptions don't receive messages from their topic and don't retain any
542
+ # backlog. `Pull` and `StreamingPull` requests will return
543
+ # FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
544
+ # the endpoint will not be made.
516
545
  # @param options [Google::Gax::CallOptions]
517
546
  # Overrides the default settings for this call, e.g, timeout,
518
547
  # retries, etc.
@@ -539,7 +568,10 @@ module Google
539
568
  labels: nil,
540
569
  enable_message_ordering: nil,
541
570
  expiration_policy: nil,
571
+ filter: nil,
542
572
  dead_letter_policy: nil,
573
+ retry_policy: nil,
574
+ detached: nil,
543
575
  options: nil,
544
576
  &block
545
577
  req = {
@@ -552,7 +584,10 @@ module Google
552
584
  labels: labels,
553
585
  enable_message_ordering: enable_message_ordering,
554
586
  expiration_policy: expiration_policy,
555
- dead_letter_policy: dead_letter_policy
587
+ filter: filter,
588
+ dead_letter_policy: dead_letter_policy,
589
+ retry_policy: retry_policy,
590
+ detached: detached
556
591
  }.delete_if { |_, v| v.nil? }
557
592
  req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::Subscription)
558
593
  @create_subscription.call(req, options, &block)
@@ -561,7 +596,7 @@ module Google
561
596
  # Gets the configuration details of a subscription.
562
597
  #
563
598
  # @param subscription [String]
564
- # The name of the subscription to get.
599
+ # Required. The name of the subscription to get.
565
600
  # Format is `projects/{project}/subscriptions/{sub}`.
566
601
  # @param options [Google::Gax::CallOptions]
567
602
  # Overrides the default settings for this call, e.g, timeout,
@@ -593,11 +628,11 @@ module Google
593
628
  # subscription, such as its topic, are not modifiable.
594
629
  #
595
630
  # @param subscription [Google::Cloud::PubSub::V1::Subscription | Hash]
596
- # The updated subscription object.
631
+ # Required. The updated subscription object.
597
632
  # A hash of the same form as `Google::Cloud::PubSub::V1::Subscription`
598
633
  # can also be provided.
599
634
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
600
- # Indicates which fields in the provided subscription to update.
635
+ # Required. Indicates which fields in the provided subscription to update.
601
636
  # Must be specified and non-empty.
602
637
  # A hash of the same form as `Google::Protobuf::FieldMask`
603
638
  # can also be provided.
@@ -636,7 +671,7 @@ module Google
636
671
  # Lists matching subscriptions.
637
672
  #
638
673
  # @param project [String]
639
- # The name of the project in which to list subscriptions.
674
+ # Required. The name of the project in which to list subscriptions.
640
675
  # Format is `projects/{project-id}`.
641
676
  # @param page_size [Integer]
642
677
  # The maximum number of resources contained in the underlying API
@@ -695,7 +730,7 @@ module Google
695
730
  # subscription or its topic unless the same topic is specified.
696
731
  #
697
732
  # @param subscription [String]
698
- # The subscription to delete.
733
+ # Required. The subscription to delete.
699
734
  # Format is `projects/{project}/subscriptions/{sub}`.
700
735
  # @param options [Google::Gax::CallOptions]
701
736
  # Overrides the default settings for this call, e.g, timeout,
@@ -723,6 +758,41 @@ module Google
723
758
  nil
724
759
  end
725
760
 
761
+ # Gets the configuration details of a snapshot. Snapshots are used in
762
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
763
+ # operations, which allow you to manage message acknowledgments in bulk. That
764
+ # is, you can set the acknowledgment state of messages in an existing
765
+ # subscription to the state captured by a snapshot.
766
+ #
767
+ # @param snapshot [String]
768
+ # Required. The name of the snapshot to get.
769
+ # Format is `projects/{project}/snapshots/{snap}`.
770
+ # @param options [Google::Gax::CallOptions]
771
+ # Overrides the default settings for this call, e.g, timeout,
772
+ # retries, etc.
773
+ # @yield [result, operation] Access the result along with the RPC operation
774
+ # @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
775
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
776
+ # @return [Google::Cloud::PubSub::V1::Snapshot]
777
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
778
+ # @example
779
+ # require "google/cloud/pubsub"
780
+ #
781
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
782
+ # formatted_snapshot = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
783
+ # response = subscriber_client.get_snapshot(formatted_snapshot)
784
+
785
+ def get_snapshot \
786
+ snapshot,
787
+ options: nil,
788
+ &block
789
+ req = {
790
+ snapshot: snapshot
791
+ }.delete_if { |_, v| v.nil? }
792
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::GetSnapshotRequest)
793
+ @get_snapshot.call(req, options, &block)
794
+ end
795
+
726
796
  # Modifies the ack deadline for a specific message. This method is useful
727
797
  # to indicate that more time is needed to process a message by the
728
798
  # subscriber, or to make the message available for redelivery if the
@@ -730,15 +800,15 @@ module Google
730
800
  # subscription-level `ackDeadlineSeconds` used for subsequent messages.
731
801
  #
732
802
  # @param subscription [String]
733
- # The name of the subscription.
803
+ # Required. The name of the subscription.
734
804
  # Format is `projects/{project}/subscriptions/{sub}`.
735
805
  # @param ack_ids [Array<String>]
736
- # List of acknowledgment IDs.
806
+ # Required. List of acknowledgment IDs.
737
807
  # @param ack_deadline_seconds [Integer]
738
- # The new ack deadline with respect to the time this request was sent to
739
- # the Pub/Sub system. For example, if the value is 10, the new
740
- # ack deadline will expire 10 seconds after the `ModifyAckDeadline` call
741
- # was made. Specifying zero might immediately make the message available for
808
+ # Required. The new ack deadline with respect to the time this request was
809
+ # sent to the Pub/Sub system. For example, if the value is 10, the new ack
810
+ # deadline will expire 10 seconds after the `ModifyAckDeadline` call was
811
+ # made. Specifying zero might immediately make the message available for
742
812
  # delivery to another subscriber client. This typically results in an
743
813
  # increase in the rate of message redeliveries (that is, duplicates).
744
814
  # The minimum deadline you can specify is 0 seconds.
@@ -788,11 +858,12 @@ module Google
788
858
  # than once will not result in an error.
789
859
  #
790
860
  # @param subscription [String]
791
- # The subscription whose message is being acknowledged.
861
+ # Required. The subscription whose message is being acknowledged.
792
862
  # Format is `projects/{project}/subscriptions/{sub}`.
793
863
  # @param ack_ids [Array<String>]
794
- # The acknowledgment ID for the messages being acknowledged that was returned
795
- # by the Pub/Sub system in the `Pull` response. Must not be empty.
864
+ # Required. The acknowledgment ID for the messages being acknowledged that
865
+ # was returned by the Pub/Sub system in the `Pull` response. Must not be
866
+ # empty.
796
867
  # @param options [Google::Gax::CallOptions]
797
868
  # Overrides the default settings for this call, e.g, timeout,
798
869
  # retries, etc.
@@ -829,17 +900,20 @@ module Google
829
900
  # subscription.
830
901
  #
831
902
  # @param subscription [String]
832
- # The subscription from which messages should be pulled.
903
+ # Required. The subscription from which messages should be pulled.
833
904
  # Format is `projects/{project}/subscriptions/{sub}`.
834
905
  # @param max_messages [Integer]
835
- # The maximum number of messages to return for this request. Must be a
836
- # positive integer. The Pub/Sub system may return fewer than the number
906
+ # Required. The maximum number of messages to return for this request. Must
907
+ # be a positive integer. The Pub/Sub system may return fewer than the number
837
908
  # specified.
838
909
  # @param return_immediately [true, false]
839
- # If this field set to true, the system will respond immediately even if
840
- # it there are no messages available to return in the `Pull` response.
841
- # Otherwise, the system may wait (for a bounded amount of time) until at
842
- # least one message is available, rather than returning no messages.
910
+ # Optional. If this field set to true, the system will respond immediately
911
+ # even if it there are no messages available to return in the `Pull`
912
+ # response. Otherwise, the system may wait (for a bounded amount of time)
913
+ # until at least one message is available, rather than returning no messages.
914
+ # Warning: setting this field to `true` is discouraged because it adversely
915
+ # impacts the performance of `Pull` operations. We recommend that users do
916
+ # not set this field.
843
917
  # @param options [Google::Gax::CallOptions]
844
918
  # Overrides the default settings for this call, e.g, timeout,
845
919
  # retries, etc.
@@ -925,10 +999,10 @@ module Google
925
999
  # continuously through the call regardless of changes to the `PushConfig`.
926
1000
  #
927
1001
  # @param subscription [String]
928
- # The name of the subscription.
1002
+ # Required. The name of the subscription.
929
1003
  # Format is `projects/{project}/subscriptions/{sub}`.
930
1004
  # @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
931
- # The push configuration for future deliveries.
1005
+ # Required. The push configuration for future deliveries.
932
1006
  #
933
1007
  # An empty `pushConfig` indicates that the Pub/Sub system should
934
1008
  # stop pushing messages from the given subscription and allow
@@ -975,7 +1049,7 @@ module Google
975
1049
  # captured by a snapshot.
976
1050
  #
977
1051
  # @param project [String]
978
- # The name of the project in which to list snapshots.
1052
+ # Required. The name of the project in which to list snapshots.
979
1053
  # Format is `projects/{project-id}`.
980
1054
  # @param page_size [Integer]
981
1055
  # The maximum number of resources contained in the underlying API
@@ -1047,15 +1121,14 @@ module Google
1047
1121
  # REST API requests, you must specify a name in the request.
1048
1122
  #
1049
1123
  # @param name [String]
1050
- # Optional user-provided name for this snapshot.
1051
- # If the name is not provided in the request, the server will assign a random
1052
- # name for this snapshot on the same project as the subscription.
1053
- # Note that for REST API requests, you must specify a name. See the
1054
- # <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
1055
- # resource name rules</a>.
1056
- # Format is `projects/{project}/snapshots/{snap}`.
1124
+ # Required. User-provided name for this snapshot. If the name is not provided
1125
+ # in the request, the server will assign a random name for this snapshot on
1126
+ # the same project as the subscription. Note that for REST API requests, you
1127
+ # must specify a name. See the <a
1128
+ # href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
1129
+ # name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
1057
1130
  # @param subscription [String]
1058
- # The subscription whose backlog the snapshot retains.
1131
+ # Required. The subscription whose backlog the snapshot retains.
1059
1132
  # Specifically, the created snapshot is guaranteed to retain:
1060
1133
  # (a) The existing backlog on the subscription. More precisely, this is
1061
1134
  # defined as the messages in the subscription's backlog that are
@@ -1106,11 +1179,11 @@ module Google
1106
1179
  # captured by a snapshot.
1107
1180
  #
1108
1181
  # @param snapshot [Google::Cloud::PubSub::V1::Snapshot | Hash]
1109
- # The updated snapshot object.
1182
+ # Required. The updated snapshot object.
1110
1183
  # A hash of the same form as `Google::Cloud::PubSub::V1::Snapshot`
1111
1184
  # can also be provided.
1112
1185
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
1113
- # Indicates which fields in the provided snapshot to update.
1186
+ # Required. Indicates which fields in the provided snapshot to update.
1114
1187
  # Must be specified and non-empty.
1115
1188
  # A hash of the same form as `Google::Protobuf::FieldMask`
1116
1189
  # can also be provided.
@@ -1159,7 +1232,7 @@ module Google
1159
1232
  # snapshot or its subscription, unless the same subscription is specified.
1160
1233
  #
1161
1234
  # @param snapshot [String]
1162
- # The name of the snapshot to delete.
1235
+ # Required. The name of the snapshot to delete.
1163
1236
  # Format is `projects/{project}/snapshots/{snap}`.
1164
1237
  # @param options [Google::Gax::CallOptions]
1165
1238
  # Overrides the default settings for this call, e.g, timeout,
@@ -1197,7 +1270,7 @@ module Google
1197
1270
  # must be on the same topic.
1198
1271
  #
1199
1272
  # @param subscription [String]
1200
- # The subscription to affect.
1273
+ # Required. The subscription to affect.
1201
1274
  # @param time [Google::Protobuf::Timestamp | Hash]
1202
1275
  # The time to seek to.
1203
1276
  # Messages retained in the subscription that were published before this
@@ -1246,8 +1319,11 @@ module Google
1246
1319
  @seek.call(req, options, &block)
1247
1320
  end
1248
1321
 
1249
- # Sets the access control policy on the specified resource. Replaces any
1250
- # existing policy.
1322
+ # Sets the access control policy on the specified resource. Replaces
1323
+ # any existing policy.
1324
+ #
1325
+ # Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1326
+ # errors.
1251
1327
  #
1252
1328
  # @param resource [String]
1253
1329
  # REQUIRED: The resource for which the policy is being specified.
@@ -1271,11 +1347,13 @@ module Google
1271
1347
  # require "google/cloud/pubsub"
1272
1348
  #
1273
1349
  # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1274
- # formatted_resource = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1350
+ #
1351
+ # # TODO: Initialize `resource`:
1352
+ # resource = ''
1275
1353
  #
1276
1354
  # # TODO: Initialize `policy`:
1277
1355
  # policy = {}
1278
- # response = subscriber_client.set_iam_policy(formatted_resource, policy)
1356
+ # response = subscriber_client.set_iam_policy(resource, policy)
1279
1357
 
1280
1358
  def set_iam_policy \
1281
1359
  resource,
@@ -1290,9 +1368,8 @@ module Google
1290
1368
  @set_iam_policy.call(req, options, &block)
1291
1369
  end
1292
1370
 
1293
- # Gets the access control policy for a resource.
1294
- # Returns an empty policy if the resource exists and does not have a policy
1295
- # set.
1371
+ # Gets the access control policy for a resource. Returns an empty policy
1372
+ # if the resource exists and does not have a policy set.
1296
1373
  #
1297
1374
  # @param resource [String]
1298
1375
  # REQUIRED: The resource for which the policy is being requested.
@@ -1314,8 +1391,10 @@ module Google
1314
1391
  # require "google/cloud/pubsub"
1315
1392
  #
1316
1393
  # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1317
- # formatted_resource = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1318
- # response = subscriber_client.get_iam_policy(formatted_resource)
1394
+ #
1395
+ # # TODO: Initialize `resource`:
1396
+ # resource = ''
1397
+ # response = subscriber_client.get_iam_policy(resource)
1319
1398
 
1320
1399
  def get_iam_policy \
1321
1400
  resource,
@@ -1330,13 +1409,13 @@ module Google
1330
1409
  @get_iam_policy.call(req, options, &block)
1331
1410
  end
1332
1411
 
1333
- # Returns permissions that a caller has on the specified resource.
1334
- # If the resource does not exist, this will return an empty set of
1335
- # permissions, not a NOT_FOUND error.
1412
+ # Returns permissions that a caller has on the specified resource. If the
1413
+ # resource does not exist, this will return an empty set of
1414
+ # permissions, not a `NOT_FOUND` error.
1336
1415
  #
1337
- # Note: This operation is designed to be used for building permission-aware
1338
- # UIs and command-line tools, not for authorization checking. This operation
1339
- # may "fail open" without warning.
1416
+ # Note: This operation is designed to be used for building
1417
+ # permission-aware UIs and command-line tools, not for authorization
1418
+ # checking. This operation may "fail open" without warning.
1340
1419
  #
1341
1420
  # @param resource [String]
1342
1421
  # REQUIRED: The resource for which the policy detail is being requested.
@@ -1358,11 +1437,13 @@ module Google
1358
1437
  # require "google/cloud/pubsub"
1359
1438
  #
1360
1439
  # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1361
- # formatted_resource = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1440
+ #
1441
+ # # TODO: Initialize `resource`:
1442
+ # resource = ''
1362
1443
  #
1363
1444
  # # TODO: Initialize `permissions`:
1364
1445
  # permissions = []
1365
- # response = subscriber_client.test_iam_permissions(formatted_resource, permissions)
1446
+ # response = subscriber_client.test_iam_permissions(resource, permissions)
1366
1447
 
1367
1448
  def test_iam_permissions \
1368
1449
  resource,
@@ -10,6 +10,10 @@
10
10
  "non_idempotent": [
11
11
  "UNAVAILABLE"
12
12
  ],
13
+ "idempotent2": [
14
+ "DEADLINE_EXCEEDED",
15
+ "UNAVAILABLE"
16
+ ],
13
17
  "streaming_pull": [
14
18
  "ABORTED",
15
19
  "DEADLINE_EXCEEDED",
@@ -32,9 +36,9 @@
32
36
  "initial_retry_delay_millis": 100,
33
37
  "retry_delay_multiplier": 1.3,
34
38
  "max_retry_delay_millis": 60000,
35
- "initial_rpc_timeout_millis": 5000,
36
- "rpc_timeout_multiplier": 1.3,
37
- "max_rpc_timeout_millis": 600000,
39
+ "initial_rpc_timeout_millis": 25000,
40
+ "rpc_timeout_multiplier": 1.0,
41
+ "max_rpc_timeout_millis": 25000,
38
42
  "total_timeout_millis": 600000
39
43
  },
40
44
  "streaming_messaging": {
@@ -73,6 +77,11 @@
73
77
  "retry_codes_name": "non_idempotent",
74
78
  "retry_params_name": "default"
75
79
  },
80
+ "GetSnapshot": {
81
+ "timeout_millis": 60000,
82
+ "retry_codes_name": "idempotent2",
83
+ "retry_params_name": "default"
84
+ },
76
85
  "ModifyAckDeadline": {
77
86
  "timeout_millis": 60000,
78
87
  "retry_codes_name": "non_idempotent",
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "1.1.3".freeze
19
+ VERSION = "1.10.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -6,6 +6,8 @@ require 'google/protobuf'
6
6
 
7
7
  require 'google/api/annotations_pb'
8
8
  require 'google/api/client_pb'
9
+ require 'google/api/field_behavior_pb'
10
+ require 'google/api/resource_pb'
9
11
  require 'google/protobuf/duration_pb'
10
12
  require 'google/protobuf/empty_pb'
11
13
  require 'google/protobuf/field_mask_pb'
@@ -71,6 +73,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
71
73
  add_message "google.pubsub.v1.DeleteTopicRequest" do
72
74
  optional :topic, :string, 1
73
75
  end
76
+ add_message "google.pubsub.v1.DetachSubscriptionRequest" do
77
+ optional :subscription, :string, 1
78
+ end
79
+ add_message "google.pubsub.v1.DetachSubscriptionResponse" do
80
+ end
74
81
  add_message "google.pubsub.v1.Subscription" do
75
82
  optional :name, :string, 1
76
83
  optional :topic, :string, 2
@@ -81,7 +88,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
81
88
  map :labels, :string, :string, 9
82
89
  optional :enable_message_ordering, :bool, 10
83
90
  optional :expiration_policy, :message, 11, "google.pubsub.v1.ExpirationPolicy"
91
+ optional :filter, :string, 12
84
92
  optional :dead_letter_policy, :message, 13, "google.pubsub.v1.DeadLetterPolicy"
93
+ optional :retry_policy, :message, 14, "google.pubsub.v1.RetryPolicy"
94
+ optional :detached, :bool, 15
95
+ end
96
+ add_message "google.pubsub.v1.RetryPolicy" do
97
+ optional :minimum_backoff, :message, 1, "google.protobuf.Duration"
98
+ optional :maximum_backoff, :message, 2, "google.protobuf.Duration"
85
99
  end
86
100
  add_message "google.pubsub.v1.DeadLetterPolicy" do
87
101
  optional :dead_letter_topic, :string, 1
@@ -152,6 +166,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
152
166
  repeated :modify_deadline_seconds, :int32, 3
153
167
  repeated :modify_deadline_ack_ids, :string, 4
154
168
  optional :stream_ack_deadline_seconds, :int32, 5
169
+ optional :client_id, :string, 6
170
+ optional :max_outstanding_messages, :int64, 7
171
+ optional :max_outstanding_bytes, :int64, 8
155
172
  end
156
173
  add_message "google.pubsub.v1.StreamingPullResponse" do
157
174
  repeated :received_messages, :message, 1, "google.pubsub.v1.ReceivedMessage"
@@ -219,7 +236,10 @@ module Google::Cloud::PubSub::V1
219
236
  ListTopicSnapshotsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.ListTopicSnapshotsRequest").msgclass
220
237
  ListTopicSnapshotsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.ListTopicSnapshotsResponse").msgclass
221
238
  DeleteTopicRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DeleteTopicRequest").msgclass
239
+ DetachSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DetachSubscriptionRequest").msgclass
240
+ DetachSubscriptionResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DetachSubscriptionResponse").msgclass
222
241
  Subscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.Subscription").msgclass
242
+ RetryPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.RetryPolicy").msgclass
223
243
  DeadLetterPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DeadLetterPolicy").msgclass
224
244
  ExpirationPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.ExpirationPolicy").msgclass
225
245
  PushConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.PushConfig").msgclass
@@ -1,7 +1,7 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # Source: google/pubsub/v1/pubsub.proto for package 'Google::Cloud::PubSub::V1'
3
3
  # Original file comments:
4
- # Copyright 2019 Google LLC.
4
+ # Copyright 2020 Google LLC
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
- #
19
18
 
20
19
 
21
20
  require 'grpc'
@@ -54,7 +53,7 @@ module Google::Cloud::PubSub::V1
54
53
  rpc :GetTopic, GetTopicRequest, Topic
55
54
  # Lists matching topics.
56
55
  rpc :ListTopics, ListTopicsRequest, ListTopicsResponse
57
- # Lists the names of the subscriptions on this topic.
56
+ # Lists the names of the attached subscriptions on this topic.
58
57
  rpc :ListTopicSubscriptions, ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse
59
58
  # Lists the names of the snapshots on this topic. Snapshots are used in
60
59
  # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
@@ -69,6 +68,11 @@ module Google::Cloud::PubSub::V1
69
68
  # configuration or subscriptions. Existing subscriptions to this topic are
70
69
  # not deleted, but their `topic` field is set to `_deleted-topic_`.
71
70
  rpc :DeleteTopic, DeleteTopicRequest, Google::Protobuf::Empty
71
+ # Detaches a subscription from this topic. All messages retained in the
72
+ # subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
73
+ # will return FAILED_PRECONDITION. If the subscription is a push
74
+ # subscription, pushes to the endpoint will stop.
75
+ rpc :DetachSubscription, DetachSubscriptionRequest, DetachSubscriptionResponse
72
76
  end
73
77
 
74
78
  Stub = Service.rpc_stub_class
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-20 00:00:00.000000000 Z
12
+ date: 2020-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -141,14 +141,14 @@ dependencies:
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '5.10'
144
+ version: '5.14'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '5.10'
151
+ version: '5.14'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: minitest-autotest
154
154
  requirement: !ruby/object:Gem::Requirement
@@ -278,6 +278,7 @@ files:
278
278
  - lib/google/cloud/pubsub/project.rb
279
279
  - lib/google/cloud/pubsub/publish_result.rb
280
280
  - lib/google/cloud/pubsub/received_message.rb
281
+ - lib/google/cloud/pubsub/retry_policy.rb
281
282
  - lib/google/cloud/pubsub/service.rb
282
283
  - lib/google/cloud/pubsub/snapshot.rb
283
284
  - lib/google/cloud/pubsub/snapshot/list.rb
@@ -329,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
330
  - !ruby/object:Gem::Version
330
331
  version: '0'
331
332
  requirements: []
332
- rubygems_version: 3.0.6
333
+ rubygems_version: 3.1.3
333
334
  signing_key:
334
335
  specification_version: 4
335
336
  summary: API Client library for Google Cloud Pub/Sub