google-cloud-pubsub 1.10.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +59 -0
  4. data/OVERVIEW.md +26 -58
  5. data/lib/google-cloud-pubsub.rb +14 -13
  6. data/lib/google/cloud/pubsub.rb +15 -18
  7. data/lib/google/cloud/pubsub/async_publisher.rb +2 -3
  8. data/lib/google/cloud/pubsub/credentials.rb +2 -2
  9. data/lib/google/cloud/pubsub/message.rb +1 -1
  10. data/lib/google/cloud/pubsub/project.rb +1 -1
  11. data/lib/google/cloud/pubsub/received_message.rb +4 -4
  12. data/lib/google/cloud/pubsub/retry_policy.rb +0 -3
  13. data/lib/google/cloud/pubsub/service.rb +102 -256
  14. data/lib/google/cloud/pubsub/subscriber.rb +17 -4
  15. data/lib/google/cloud/pubsub/subscriber/inventory.rb +5 -2
  16. data/lib/google/cloud/pubsub/subscriber/stream.rb +3 -4
  17. data/lib/google/cloud/pubsub/subscription.rb +70 -26
  18. data/lib/google/cloud/pubsub/subscription/push_config.rb +55 -31
  19. data/lib/google/cloud/pubsub/topic.rb +49 -18
  20. data/lib/google/cloud/pubsub/version.rb +1 -1
  21. metadata +8 -79
  22. data/lib/google/cloud/pubsub/v1.rb +0 -17
  23. data/lib/google/cloud/pubsub/v1/credentials.rb +0 -41
  24. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -21
  25. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb +0 -21
  26. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -21
  27. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
  28. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
  29. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -222
  30. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -113
  31. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -833
  32. data/lib/google/cloud/pubsub/v1/doc/google/type/expr.rb +0 -19
  33. data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -928
  34. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -120
  35. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1466
  36. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -153
  37. data/lib/google/pubsub/v1/pubsub_pb.rb +0 -269
  38. data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -215
@@ -41,7 +41,7 @@ module Google
41
41
  # subscriber.start
42
42
  #
43
43
  # # Shut down the subscriber when ready to stop receiving messages.
44
- # subscriber.stop.wait!
44
+ # subscriber.stop!
45
45
  #
46
46
  # @attr_reader [String] subscription_name The name of the subscription the
47
47
  # messages are pulled from.
@@ -240,7 +240,7 @@ module Google
240
240
  # subscriber.start
241
241
  #
242
242
  # # Shut down the subscriber when ready to stop receiving messages.
243
- # subscriber.stop.wait!
243
+ # subscriber.stop!
244
244
  #
245
245
  def on_error &block
246
246
  synchronize do
@@ -276,7 +276,7 @@ module Google
276
276
  # subscriber.last_error #=> nil
277
277
  #
278
278
  # # Shut down the subscriber when ready to stop receiving messages.
279
- # subscriber.stop.wait!
279
+ # subscriber.stop!
280
280
  #
281
281
  def last_error
282
282
  synchronize { @last_error }
@@ -306,6 +306,17 @@ module Google
306
306
  # @deprecated Use {#max_outstanding_bytes}.
307
307
  alias inventory_bytesize max_outstanding_bytes
308
308
 
309
+ ##
310
+ # Whether to enforce flow control at the client side only or to enforce it at both the client and
311
+ # the server. For more details about flow control see https://cloud.google.com/pubsub/docs/pull#config.
312
+ #
313
+ # @return [Boolean] `true` when only client side flow control is enforced, `false` when both client and
314
+ # server side flow control are enforced.
315
+ #
316
+ def use_legacy_flow_control?
317
+ @inventory[:use_legacy_flow_control]
318
+ end
319
+
309
320
  ##
310
321
  # The number of seconds that received messages can be held awaiting processing. Default is 3,600 (1 hour).
311
322
  #
@@ -334,7 +345,8 @@ module Google
334
345
  limit: @inventory[:max_outstanding_messages].fdiv(@streams).ceil,
335
346
  bytesize: @inventory[:max_outstanding_bytes].fdiv(@streams).ceil,
336
347
  extension: @inventory[:max_total_lease_duration],
337
- max_duration_per_lease_extension: @inventory[:max_duration_per_lease_extension]
348
+ max_duration_per_lease_extension: @inventory[:max_duration_per_lease_extension],
349
+ use_legacy_flow_control: @inventory[:use_legacy_flow_control]
338
350
  }
339
351
  end
340
352
 
@@ -377,6 +389,7 @@ module Google
377
389
  @inventory[:max_outstanding_bytes] = Integer(@inventory[:max_outstanding_bytes] || 100_000_000)
378
390
  @inventory[:max_total_lease_duration] = Integer(@inventory[:max_total_lease_duration] || 3600)
379
391
  @inventory[:max_duration_per_lease_extension] = Integer(@inventory[:max_duration_per_lease_extension] || 0)
392
+ @inventory[:use_legacy_flow_control] = @inventory[:use_legacy_flow_control] || false
380
393
  end
381
394
 
382
395
  def default_error_callbacks
@@ -30,15 +30,18 @@ module Google
30
30
 
31
31
  include MonitorMixin
32
32
 
33
- attr_reader :stream, :limit, :bytesize, :extension, :max_duration_per_lease_extension
33
+ attr_reader :stream, :limit, :bytesize, :extension, :max_duration_per_lease_extension,
34
+ :use_legacy_flow_control
34
35
 
35
- def initialize stream, limit:, bytesize:, extension:, max_duration_per_lease_extension:
36
+ def initialize stream, limit:, bytesize:, extension:, max_duration_per_lease_extension:,
37
+ use_legacy_flow_control:
36
38
  super()
37
39
  @stream = stream
38
40
  @limit = limit
39
41
  @bytesize = bytesize
40
42
  @extension = extension
41
43
  @max_duration_per_lease_extension = max_duration_per_lease_extension
44
+ @use_legacy_flow_control = use_legacy_flow_control
42
45
  @inventory = {}
43
46
  @wait_cond = new_cond
44
47
  end
@@ -271,9 +271,8 @@ module Google
271
271
  stop
272
272
  rescue GRPC::Cancelled, GRPC::DeadlineExceeded, GRPC::Internal,
273
273
  GRPC::ResourceExhausted, GRPC::Unauthenticated,
274
- GRPC::Unavailable, GRPC::Core::CallError
274
+ GRPC::Unavailable
275
275
  # Restart the stream with an incremental back for a retriable error.
276
- # Also when GRPC raises the internal CallError.
277
276
 
278
277
  retry
279
278
  rescue RestartStream
@@ -364,8 +363,8 @@ module Google
364
363
  req.modify_deadline_ack_ids += @inventory.ack_ids
365
364
  req.modify_deadline_seconds += @inventory.ack_ids.map { @subscriber.deadline }
366
365
  req.client_id = @subscriber.service.client_id
367
- req.max_outstanding_messages = @inventory.limit
368
- req.max_outstanding_bytes = @inventory.bytesize
366
+ req.max_outstanding_messages = @inventory.use_legacy_flow_control ? 0 : @inventory.limit
367
+ req.max_outstanding_bytes = @inventory.use_legacy_flow_control ? 0 : @inventory.bytesize
369
368
  end
370
369
  end
371
370
 
@@ -43,12 +43,19 @@ module Google
43
43
  # received_message.acknowledge!
44
44
  # end
45
45
  #
46
- # # Start background threads that will call the block passed to listen.
47
- # subscriber.start
46
+ # # Handle exceptions from listener
47
+ # subscriber.on_error do |exception|
48
+ # puts "Exception: #{exception.class} #{exception.message}"
49
+ # end
48
50
  #
49
- # # Shut down the subscriber when ready to stop receiving messages.
50
- # subscriber.stop.wait!
51
+ # # Gracefully shut down the subscriber
52
+ # at_exit do
53
+ # subscriber.stop!
54
+ # end
51
55
  #
56
+ # # Start background threads that will call the block passed to listen.
57
+ # subscriber.start
58
+ # sleep
52
59
  class Subscription
53
60
  ##
54
61
  # @private The Service object.
@@ -346,7 +353,7 @@ module Google
346
353
  # to unset.
347
354
  #
348
355
  def expires_in= ttl
349
- new_expiration_policy = Google::Pubsub::V1::ExpirationPolicy.new ttl: Convert.number_to_duration(ttl)
356
+ new_expiration_policy = Google::Cloud::PubSub::V1::ExpirationPolicy.new ttl: Convert.number_to_duration(ttl)
350
357
 
351
358
  update_grpc = Google::Cloud::PubSub::V1::Subscription.new name: name, expiration_policy: new_expiration_policy
352
359
  @grpc = service.update_subscription update_grpc, :expiration_policy
@@ -370,8 +377,8 @@ module Google
370
377
  # otherwise `nil`. Dead lettering is done on a best effort basis. The same message might be dead lettered
371
378
  # multiple times.
372
379
  #
373
- # See also {#dead_letter_topic=}, {#dead_letter_max_delivery_attempts=} and
374
- # {#dead_letter_max_delivery_attempts}.
380
+ # See also {#dead_letter_topic=}, {#dead_letter_max_delivery_attempts=}, {#dead_letter_max_delivery_attempts}
381
+ # and {#remove_dead_letter_policy}.
375
382
  #
376
383
  # Makes an API call to retrieve the topic name when called on a reference object. See {#reference?}.
377
384
  #
@@ -402,7 +409,8 @@ module Google
402
409
  # The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached
403
410
  # to this topic since messages published to a topic with no subscriptions are lost.
404
411
  #
405
- # See also {#dead_letter_topic}, {#dead_letter_max_delivery_attempts=} and {#dead_letter_max_delivery_attempts}.
412
+ # See also {#dead_letter_topic}, {#dead_letter_max_delivery_attempts=}, {#dead_letter_max_delivery_attempts}
413
+ # and {#remove_dead_letter_policy}.
406
414
  #
407
415
  # @param [Topic] new_dead_letter_topic The topic to which dead letter messages for the subscription should be
408
416
  # published.
@@ -434,14 +442,15 @@ module Google
434
442
  # acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0
435
443
  # deadline. Note that client libraries may automatically extend ack_deadlines.
436
444
  #
437
- # This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
445
+ # This field will be honored on a best effort basis. If this parameter is `nil` or `0`, a default value of `5`
446
+ # is used.
438
447
  #
439
- # See also {#dead_letter_max_delivery_attempts=}, {#dead_letter_topic=} and {#dead_letter_topic}.
448
+ # See also {#dead_letter_max_delivery_attempts=}, {#dead_letter_topic=}, {#dead_letter_topic}
449
+ # and {#remove_dead_letter_policy}.
440
450
  #
441
451
  # Makes an API call to retrieve the value when called on a reference object. See {#reference?}.
442
452
  #
443
- # @return [Integer, nil] A value between 5 and 100, or `nil` if no dead letter policy is configured. If this
444
- # value is 0, a default value of 5 is used.
453
+ # @return [Integer, nil] A value between `5` and `100`, or `nil` if no dead letter policy is configured.
445
454
  #
446
455
  # @example
447
456
  # require "google/cloud/pubsub"
@@ -468,10 +477,13 @@ module Google
468
477
  #
469
478
  # This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
470
479
  #
471
- # The dead letter topic must also be set. See {#dead_letter_topic=} and {#dead_letter_topic}.
480
+ # The dead letter topic must be set first. See {#dead_letter_topic=}, {#dead_letter_topic} and
481
+ # {#remove_dead_letter_policy}.
482
+ #
483
+ # @param [Integer, nil] new_dead_letter_max_delivery_attempts A value between 5 and 100. If this parameter is
484
+ # `nil` or `0`, a default value of 5 is used.
472
485
  #
473
- # @param [Integer] new_dead_letter_max_delivery_attempts A value between 5 and 100. If this parameter is 0, a
474
- # default value of 5 is used.
486
+ # @raise [ArgumentError] if the dead letter topic has not been set. See {#dead_letter_topic=}.
475
487
  #
476
488
  # @example
477
489
  # require "google/cloud/pubsub"
@@ -496,15 +508,45 @@ module Google
496
508
  @resource_name = nil
497
509
  end
498
510
 
511
+ ##
512
+ # Removes an existing dead letter policy. A dead letter policy specifies the conditions for dead lettering
513
+ # messages in the subscription. If a dead letter policy is not set, dead lettering is disabled.
514
+ #
515
+ # See {#dead_letter_topic}, {#dead_letter_topic=}, {#dead_letter_max_delivery_attempts} and
516
+ # {#dead_letter_max_delivery_attempts=}.
517
+ #
518
+ # @return [Boolean] `true` if an existing dead letter policy was removed, `false` if no existing dead letter
519
+ # policy was present.
520
+ #
521
+ # @example
522
+ # require "google/cloud/pubsub"
523
+ #
524
+ # pubsub = Google::Cloud::PubSub.new
525
+ #
526
+ # sub = pubsub.subscription "my-topic-sub"
527
+ #
528
+ # sub.dead_letter_topic.name #=> "projects/my-project/topics/my-dead-letter-topic"
529
+ # sub.dead_letter_max_delivery_attempts #=> 10
530
+ #
531
+ # sub.remove_dead_letter_policy
532
+ #
533
+ # sub.dead_letter_topic #=> nil
534
+ # sub.dead_letter_max_delivery_attempts #=> nil
535
+ #
536
+ def remove_dead_letter_policy
537
+ ensure_grpc!
538
+ return false if @grpc.dead_letter_policy.nil?
539
+ update_grpc = Google::Cloud::PubSub::V1::Subscription.new name: name, dead_letter_policy: nil
540
+ @grpc = service.update_subscription update_grpc, :dead_letter_policy
541
+ true
542
+ end
543
+
499
544
  ##
500
545
  # A policy that specifies how Cloud Pub/Sub retries message delivery for this subscription. If `nil`, the
501
546
  # default retry policy is applied. This generally implies that messages will be retried as soon as possible
502
547
  # for healthy subscribers. Retry Policy will be triggered on NACKs or acknowledgement deadline exceeded events
503
548
  # for a given message.
504
549
  #
505
- # **EXPERIMENTAL:** This API might be changed in backward-incompatible ways and is not recommended for
506
- # production use. It is not subject to any SLA or deprecation policy.
507
- #
508
550
  # @return [RetryPolicy, nil] The retry policy for the subscription, or `nil`.
509
551
  #
510
552
  # @example
@@ -531,9 +573,6 @@ module Google
531
573
  # for healthy subscribers. Retry Policy will be triggered on NACKs or acknowledgement deadline exceeded events
532
574
  # for a given message.
533
575
  #
534
- # **EXPERIMENTAL:** This API might be changed in backward-incompatible ways and is not recommended for
535
- # production use. It is not subject to any SLA or deprecation policy.
536
- #
537
576
  # @param [RetryPolicy, nil] new_retry_policy A new retry policy for the subscription, or `nil`.
538
577
  #
539
578
  # @example
@@ -816,7 +855,8 @@ module Google
816
855
  # @param [Integer] streams The number of concurrent streams to open to
817
856
  # pull messages from the subscription. Default is 4. Optional.
818
857
  # @param [Hash, Integer] inventory The settings to control how received messages are to be handled by the
819
- # subscriber. When provided as an Integer instead of a Hash only the `limit` will be set. Optional.
858
+ # subscriber. When provided as an Integer instead of a Hash only `max_outstanding_messages` will be set.
859
+ # Optional.
820
860
  #
821
861
  # Hash keys and values may include the following:
822
862
  #
@@ -824,6 +864,9 @@ module Google
824
864
  # Default is 1,000. (Note: replaces `:limit`, which is deprecated.)
825
865
  # * `:max_outstanding_bytes` [Integer] The total byte size of received messages to be collected by
826
866
  # subscriber. Default is 100,000,000 (100MB). (Note: replaces `:bytesize`, which is deprecated.)
867
+ # * `:use_legacy_flow_control` [Boolean] Disables enforcing flow control settings at the Cloud PubSub
868
+ # server and the less accurate method of only enforcing flow control at the client side is used instead.
869
+ # Default is false.
827
870
  # * `:max_total_lease_duration` [Integer] The number of seconds that received messages can be held awaiting
828
871
  # processing. Default is 3,600 (1 hour). (Note: replaces `:extension`, which is deprecated.)
829
872
  # * `:max_duration_per_lease_extension` [Integer] The maximum amount of time in seconds for a single lease
@@ -856,6 +899,7 @@ module Google
856
899
  #
857
900
  # subscriber = sub.listen do |received_message|
858
901
  # # process message
902
+ # puts "Data: #{received_message.message.data}, published at #{received_message.message.published_at}"
859
903
  # received_message.acknowledge!
860
904
  # end
861
905
  #
@@ -863,7 +907,7 @@ module Google
863
907
  # subscriber.start
864
908
  #
865
909
  # # Shut down the subscriber when ready to stop receiving messages.
866
- # subscriber.stop.wait!
910
+ # subscriber.stop!
867
911
  #
868
912
  # @example Configuring to increase concurrent callbacks:
869
913
  # require "google/cloud/pubsub"
@@ -882,7 +926,7 @@ module Google
882
926
  # subscriber.start
883
927
  #
884
928
  # # Shut down the subscriber when ready to stop receiving messages.
885
- # subscriber.stop.wait!
929
+ # subscriber.stop!
886
930
  #
887
931
  # @example Ordered messages are supported using ordering_key:
888
932
  # require "google/cloud/pubsub"
@@ -902,7 +946,7 @@ module Google
902
946
  # subscriber.start
903
947
  #
904
948
  # # Shut down the subscriber when ready to stop receiving messages.
905
- # subscriber.stop.wait!
949
+ # subscriber.stop!
906
950
  #
907
951
  # @example Set the maximum amount of time before redelivery if the subscriber fails to extend the deadline:
908
952
  # require "google/cloud/pubsub"
@@ -921,7 +965,7 @@ module Google
921
965
  # subscriber.start
922
966
  #
923
967
  # # Shut down the subscriber when ready to stop receiving messages.
924
- # subscriber.stop.wait!
968
+ # subscriber.stop!
925
969
  #
926
970
  def listen deadline: nil, message_ordering: nil, streams: nil, inventory: nil, threads: {}, &block
927
971
  ensure_service!
@@ -22,7 +22,18 @@ module Google
22
22
  ##
23
23
  # Configuration for a push delivery endpoint.
24
24
  #
25
- # @example
25
+ # @example Create a push config:
26
+ # require "google/cloud/pubsub"
27
+ #
28
+ # pubsub = Google::Cloud::PubSub.new
29
+ # topic = pubsub.topic "my-topic"
30
+ #
31
+ # push_config = Google::Cloud::PubSub::Subscription::PushConfig.new endpoint: "http://example.net/callback"
32
+ # push_config.set_oidc_token "service-account@example.net", "audience-header-value"
33
+ #
34
+ # sub = topic.subscribe "my-subscription", push_config: push_config
35
+ #
36
+ # @example Read a push config:
26
37
  # require "google/cloud/pubsub"
27
38
  #
28
39
  # pubsub = Google::Cloud::PubSub.new
@@ -32,7 +43,7 @@ module Google
32
43
  # sub.push_config.authentication.email #=> "user@example.com"
33
44
  # sub.push_config.authentication.audience #=> "client-12345"
34
45
  #
35
- # @example Update the push configuration by passing a block:
46
+ # @example Update a push config:
36
47
  # require "google/cloud/pubsub"
37
48
  #
38
49
  # pubsub = Google::Cloud::PubSub.new
@@ -45,14 +56,31 @@ module Google
45
56
  #
46
57
  class PushConfig
47
58
  ##
48
- # @private
49
- def initialize
59
+ # Creates a new push configuration.
60
+ #
61
+ # @param [String] endpoint A URL locating the endpoint to which messages should be pushed. For
62
+ # example, a Webhook endpoint might use `https://example.com/push`.
63
+ # @param [String] email The service account email to be used for generating the OIDC token.
64
+ # The caller must have the `iam.serviceAccounts.actAs` permission for the service account.
65
+ # @param [String] audience The audience to be used when generating OIDC token. The audience claim identifies
66
+ # the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having
67
+ # multiple values (array) for the audience field is not supported. More info about the OIDC JWT token
68
+ # audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the `endpoint`
69
+ # URL will be used.
70
+ #
71
+ def initialize endpoint: nil, email: nil, audience: nil
50
72
  @grpc = Google::Cloud::PubSub::V1::PushConfig.new
73
+
74
+ self.endpoint = endpoint unless endpoint.nil?
75
+
76
+ raise ArgumentError, "audience provided without email. Authentication is invalid" if audience && !email
77
+
78
+ set_oidc_token email, audience if email
51
79
  end
52
80
 
53
81
  ##
54
- # A URL locating the endpoint to which messages should be pushed. For
55
- # example, a Webhook endpoint might use `https://example.com/push`.
82
+ # A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use
83
+ # `https://example.com/push`.
56
84
  #
57
85
  # @return [String]
58
86
  def endpoint
@@ -60,9 +88,8 @@ module Google
60
88
  end
61
89
 
62
90
  ##
63
- # Sets the URL locating the endpoint to which messages should be
64
- # pushed. For example, a Webhook endpoint might use
65
- # `https://example.com/push`.
91
+ # Sets the URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might
92
+ # use `https://example.com/push`.
66
93
  #
67
94
  # @param [String, nil] new_endpoint New URL value
68
95
  def endpoint= new_endpoint
@@ -70,8 +97,7 @@ module Google
70
97
  end
71
98
 
72
99
  ##
73
- # The authentication method used by push endpoints to verify the
74
- # source of push requests.
100
+ # The authentication method used by push endpoints to verify the source of push requests.
75
101
  #
76
102
  # @return [OidcToken, nil] An OIDC JWT token if specified, `nil`
77
103
  # otherwise.
@@ -82,8 +108,7 @@ module Google
82
108
  end
83
109
 
84
110
  ##
85
- # Sets the authentication method used by push endpoints to verify the
86
- # source of push requests.
111
+ # Sets the authentication method used by push endpoints to verify the source of push requests.
87
112
  #
88
113
  # @param [OidcToken, nil] new_auth An authentication value.
89
114
  def authentication= new_auth
@@ -118,13 +143,12 @@ module Google
118
143
  end
119
144
 
120
145
  ##
121
- # The format of the pushed message. This attribute indicates the
122
- # version of the data expected by the endpoint. This controls the
123
- # shape of the pushed message (i.e., its fields and metadata). The
124
- # endpoint version is based on the version of the Pub/Sub API.
146
+ # The format of the pushed message. This attribute indicates the version of the data expected by the endpoint.
147
+ # This controls the shape of the pushed message (i.e., its fields and metadata). The endpoint version is based
148
+ # on the version of the Pub/Sub API.
125
149
  #
126
- # If not present during the Subscription creation, it will default to
127
- # the version of the API used to make such call.
150
+ # If not present during the Subscription creation, it will default to the version of the API used to make such
151
+ # call.
128
152
  #
129
153
  # The possible values for this attribute are:
130
154
  #
@@ -182,7 +206,8 @@ module Google
182
206
  end
183
207
 
184
208
  ##
185
- # Service account email to be used for generating the OIDC token.
209
+ # The service account email to be used for generating the OIDC token. The caller must have the
210
+ # `iam.serviceAccounts.actAs` permission for the service account.
186
211
  #
187
212
  # @return [String]
188
213
  def email
@@ -190,7 +215,8 @@ module Google
190
215
  end
191
216
 
192
217
  ##
193
- # Service account email to be used for generating the OIDC token.
218
+ # Sets the service account email to be used for generating the OIDC token. The caller must have the
219
+ # `iam.serviceAccounts.actAs` permission for the service account.
194
220
  #
195
221
  # @param [String] new_email New service account email value.
196
222
  def email= new_email
@@ -198,15 +224,10 @@ module Google
198
224
  end
199
225
 
200
226
  ##
201
- # Audience to be used when generating OIDC token. The audience claim
202
- # identifies the recipients that the JWT is intended for. The
203
- # audience value is a single case-sensitive string.
204
- #
205
- # Having multiple values (array) for the audience field is not
206
- # supported.
207
- #
208
- # More info about the OIDC JWT token audience here:
209
- # https://tools.ietf.org/html/rfc7519#section-4.1.3
227
+ # The audience to be used when generating OIDC token. The audience claim identifies the recipients that
228
+ # the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values
229
+ # (array) for the audience field is not supported. More info about the OIDC JWT token audience here:
230
+ # https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the `endpoint` URL will be used.
210
231
  #
211
232
  # @return [String]
212
233
  def audience
@@ -214,7 +235,10 @@ module Google
214
235
  end
215
236
 
216
237
  ##
217
- # Sets the audience to be used when generating OIDC token.
238
+ # Sets the audience to be used when generating OIDC token. The audience claim identifies the recipients that
239
+ # the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values
240
+ # (array) for the audience field is not supported. More info about the OIDC JWT token audience here:
241
+ # https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the `endpoint` URL will be used.
218
242
  #
219
243
  # @param [String] new_audience New audience value.
220
244
  def audience= new_audience