Class: Google::Cloud::Pubsub::V1::SubscriberClient
- Inherits:
-
Object
- Object
- Google::Cloud::Pubsub::V1::SubscriberClient
- Defined in:
- lib/google/cloud/pubsub/v1/subscriber_client.rb
Overview
The service that an application uses to manipulate subscriptions and to consume messages from a subscription via the +Pull+ method or by establishing a bi-directional stream using the +StreamingPull+ method.
Constant Summary collapse
- SERVICE_ADDRESS =
The default address of the service.
"pubsub.googleapis.com".freeze
- DEFAULT_SERVICE_PORT =
The default port of the service.
443
- GRPC_INTERCEPTORS =
The default set of gRPC interceptors.
[]
- DEFAULT_TIMEOUT =
30
- ALL_SCOPES =
The scopes needed to make gRPC calls to all of the methods defined in this service.
[ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/pubsub" ].freeze
Class Method Summary collapse
-
.project_path(project) ⇒ String
Returns a fully-qualified project resource name string.
-
.snapshot_path(project, snapshot) ⇒ String
Returns a fully-qualified snapshot resource name string.
-
.subscription_path(project, subscription) ⇒ String
Returns a fully-qualified subscription resource name string.
-
.topic_path(project, topic) ⇒ String
Returns a fully-qualified topic resource name string.
Instance Method Summary collapse
-
#acknowledge(subscription, ack_ids, options: nil) {|result, operation| ... } ⇒ Object
Acknowledges the messages associated with the +ack_ids+ in the +AcknowledgeRequest+.
-
#create_snapshot(name, subscription, labels: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Snapshot
Creates a snapshot from the requested subscription.
ALPHA: This feature is part of an alpha release. -
#create_subscription(name, topic, push_config: nil, ack_deadline_seconds: nil, retain_acked_messages: nil, message_retention_duration: nil, labels: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Subscription
Creates a subscription to a given topic.
-
#delete_snapshot(snapshot, options: nil) {|result, operation| ... } ⇒ Object
Removes an existing snapshot.
-
#delete_subscription(subscription, options: nil) {|result, operation| ... } ⇒ Object
Deletes an existing subscription.
-
#get_iam_policy(resource, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Gets the access control policy for a resource.
-
#get_subscription(subscription, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Subscription
Gets the configuration details of a subscription.
-
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ SubscriberClient
constructor
A new instance of SubscriberClient.
-
#list_snapshots(project, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Pubsub::V1::Snapshot>
Lists the existing snapshots.
ALPHA: This feature is part of an alpha release. -
#list_subscriptions(project, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Pubsub::V1::Subscription>
Lists matching subscriptions.
-
#modify_ack_deadline(subscription, ack_ids, ack_deadline_seconds, options: nil) {|result, operation| ... } ⇒ Object
Modifies the ack deadline for a specific message.
-
#modify_push_config(subscription, push_config, options: nil) {|result, operation| ... } ⇒ Object
Modifies the +PushConfig+ for a specified subscription.
-
#pull(subscription, max_messages, return_immediately: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::PullResponse
Pulls messages from the server.
-
#seek(subscription, time: nil, snapshot: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::SeekResponse
Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request.
ALPHA: This feature is part of an alpha release. -
#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Sets the access control policy on the specified resource.
-
#streaming_pull(reqs, options: nil) ⇒ Enumerable<Google::Pubsub::V1::StreamingPullResponse>
Establishes a stream with the server, which sends messages down to the client.
-
#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on the specified resource.
-
#update_snapshot(snapshot, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Snapshot
Updates an existing snapshot.
ALPHA: This feature is part of an alpha release. -
#update_subscription(subscription, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Subscription
Updates an existing subscription.
Constructor Details
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ SubscriberClient
Returns a new instance of SubscriberClient
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 175 def initialize \ credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: "" # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "google/gax/grpc" require "google/iam/v1/iam_policy_services_pb" require "google/pubsub/v1/pubsub_services_pb" credentials ||= Google::Cloud::Pubsub::V1::Credentials.default if credentials.is_a?(String) || credentials.is_a?(Hash) updater_proc = Google::Cloud::Pubsub::V1::Credentials.new(credentials).updater_proc end if credentials.is_a?(GRPC::Core::Channel) channel = credentials end if credentials.is_a?(GRPC::Core::ChannelCredentials) chan_creds = credentials end if credentials.is_a?(Proc) updater_proc = credentials end if credentials.is_a?(Google::Auth::Credentials) updater_proc = credentials.updater_proc end package_version = Gem.loaded_specs['google-cloud-pubsub'].version.version google_api_client = "gl-ruby/#{RUBY_VERSION}" google_api_client << " #{lib_name}/#{lib_version}" if lib_name google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}" google_api_client << " grpc/#{GRPC::VERSION}" google_api_client.freeze headers = { :"x-goog-api-client" => google_api_client } headers.merge!() unless .nil? client_config_file = Pathname.new(__dir__).join( "subscriber_client_config.json" ) defaults = client_config_file.open do |f| Google::Gax.construct_settings( "google.pubsub.v1.Subscriber", JSON.parse(f.read), client_config, Google::Gax::Grpc::STATUS_CODE_NAMES, timeout, page_descriptors: PAGE_DESCRIPTORS, errors: Google::Gax::Grpc::API_ERRORS, metadata: headers ) end # Allow overriding the service path/port in subclasses. service_path = self.class::SERVICE_ADDRESS port = self.class::DEFAULT_SERVICE_PORT interceptors = self.class::GRPC_INTERCEPTORS @iam_policy_stub = Google::Gax::Grpc.create_stub( service_path, port, chan_creds: chan_creds, channel: channel, updater_proc: updater_proc, scopes: scopes, interceptors: interceptors, &Google::Iam::V1::IAMPolicy::Stub.method(:new) ) @subscriber_stub = Google::Gax::Grpc.create_stub( service_path, port, chan_creds: chan_creds, channel: channel, updater_proc: updater_proc, scopes: scopes, interceptors: interceptors, &Google::Pubsub::V1::Subscriber::Stub.method(:new) ) @create_subscription = Google::Gax.create_api_call( @subscriber_stub.method(:create_subscription), defaults["create_subscription"], exception_transformer: exception_transformer ) @get_subscription = Google::Gax.create_api_call( @subscriber_stub.method(:get_subscription), defaults["get_subscription"], exception_transformer: exception_transformer ) @update_subscription = Google::Gax.create_api_call( @subscriber_stub.method(:update_subscription), defaults["update_subscription"], exception_transformer: exception_transformer ) @list_subscriptions = Google::Gax.create_api_call( @subscriber_stub.method(:list_subscriptions), defaults["list_subscriptions"], exception_transformer: exception_transformer ) @delete_subscription = Google::Gax.create_api_call( @subscriber_stub.method(:delete_subscription), defaults["delete_subscription"], exception_transformer: exception_transformer ) @modify_ack_deadline = Google::Gax.create_api_call( @subscriber_stub.method(:modify_ack_deadline), defaults["modify_ack_deadline"], exception_transformer: exception_transformer ) @acknowledge = Google::Gax.create_api_call( @subscriber_stub.method(:acknowledge), defaults["acknowledge"], exception_transformer: exception_transformer ) @pull = Google::Gax.create_api_call( @subscriber_stub.method(:pull), defaults["pull"], exception_transformer: exception_transformer ) @streaming_pull = Google::Gax.create_api_call( @subscriber_stub.method(:streaming_pull), defaults["streaming_pull"], exception_transformer: exception_transformer ) @modify_push_config = Google::Gax.create_api_call( @subscriber_stub.method(:modify_push_config), defaults["modify_push_config"], exception_transformer: exception_transformer ) @list_snapshots = Google::Gax.create_api_call( @subscriber_stub.method(:list_snapshots), defaults["list_snapshots"], exception_transformer: exception_transformer ) @create_snapshot = Google::Gax.create_api_call( @subscriber_stub.method(:create_snapshot), defaults["create_snapshot"], exception_transformer: exception_transformer ) @update_snapshot = Google::Gax.create_api_call( @subscriber_stub.method(:update_snapshot), defaults["update_snapshot"], exception_transformer: exception_transformer ) @delete_snapshot = Google::Gax.create_api_call( @subscriber_stub.method(:delete_snapshot), defaults["delete_snapshot"], exception_transformer: exception_transformer ) @seek = Google::Gax.create_api_call( @subscriber_stub.method(:seek), defaults["seek"], exception_transformer: exception_transformer ) @set_iam_policy = Google::Gax.create_api_call( @iam_policy_stub.method(:set_iam_policy), defaults["set_iam_policy"], exception_transformer: exception_transformer ) @get_iam_policy = Google::Gax.create_api_call( @iam_policy_stub.method(:get_iam_policy), defaults["get_iam_policy"], exception_transformer: exception_transformer ) @test_iam_permissions = Google::Gax.create_api_call( @iam_policy_stub.method(:test_iam_permissions), defaults["test_iam_permissions"], exception_transformer: exception_transformer ) end |
Class Method Details
.project_path(project) ⇒ String
Returns a fully-qualified project resource name string.
129 130 131 132 133 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 129 def self.project_path project PROJECT_PATH_TEMPLATE.render( :"project" => project ) end |
.snapshot_path(project, snapshot) ⇒ String
Returns a fully-qualified snapshot resource name string.
139 140 141 142 143 144 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 139 def self.snapshot_path project, snapshot SNAPSHOT_PATH_TEMPLATE.render( :"project" => project, :"snapshot" => snapshot ) end |
.subscription_path(project, subscription) ⇒ String
Returns a fully-qualified subscription resource name string.
108 109 110 111 112 113 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 108 def self.subscription_path project, subscription SUBSCRIPTION_PATH_TEMPLATE.render( :"project" => project, :"subscription" => subscription ) end |
.topic_path(project, topic) ⇒ String
Returns a fully-qualified topic resource name string.
119 120 121 122 123 124 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 119 def self.topic_path project, topic TOPIC_PATH_TEMPLATE.render( :"project" => project, :"topic" => topic ) end |
Instance Method Details
#acknowledge(subscription, ack_ids, options: nil) {|result, operation| ... } ⇒ Object
Acknowledges the messages associated with the +ack_ids+ in the +AcknowledgeRequest+. The Pub/Sub system can remove the relevant messages from the subscription.
Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.
717 718 719 720 721 722 723 724 725 726 727 728 729 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 717 def acknowledge \ subscription, ack_ids, options: nil, &block req = { subscription: subscription, ack_ids: ack_ids }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::AcknowledgeRequest) @acknowledge.call(req, , &block) nil end |
#create_snapshot(name, subscription, labels: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Snapshot
Creates a snapshot from the requested subscription.
ALPHA: This feature is part of an alpha release. This API might be
changed in backward-incompatible ways and is not recommended for production
use. It is not subject to any SLA or deprecation policy.
If the snapshot already exists, returns +ALREADY_EXISTS+.
If the requested subscription doesn't exist, returns +NOT_FOUND+.
If the backlog in the subscription is too old -- and the resulting snapshot
would expire in less than 1 hour -- then +FAILED_PRECONDITION+ is returned.
See also the +Snapshot.expire_time+ field. If the name is not provided in
the request, the server will assign a random
name for this snapshot on the same project as the subscription, conforming
to the resource name format.
The generated
name is populated in the returned Snapshot object. Note that for REST API
requests, you must specify a name in the request.
984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 984 def create_snapshot \ name, subscription, labels: nil, options: nil, &block req = { name: name, subscription: subscription, labels: labels }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::CreateSnapshotRequest) @create_snapshot.call(req, , &block) end |
#create_subscription(name, topic, push_config: nil, ack_deadline_seconds: nil, retain_acked_messages: nil, message_retention_duration: nil, labels: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Subscription
Creates a subscription to a given topic. See the resource name rules. If the subscription already exists, returns +ALREADY_EXISTS+. If the corresponding topic doesn't exist, returns +NOT_FOUND+.
If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the resource name format. The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 443 def create_subscription \ name, topic, push_config: nil, ack_deadline_seconds: nil, retain_acked_messages: nil, message_retention_duration: nil, labels: nil, options: nil, &block req = { name: name, topic: topic, push_config: push_config, ack_deadline_seconds: ack_deadline_seconds, retain_acked_messages: , message_retention_duration: , labels: labels }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::Subscription) @create_subscription.call(req, , &block) end |
#delete_snapshot(snapshot, options: nil) {|result, operation| ... } ⇒ Object
Removes an existing snapshot.
ALPHA: This feature is part of an alpha release. This API might be
changed in backward-incompatible ways and is not recommended for production
use. It is not subject to any SLA or deprecation policy.
When the snapshot is deleted, all messages retained in the snapshot
are immediately dropped. After a snapshot is deleted, a new one may be
created with the same name, but the new one has no association with the old
snapshot or its subscription, unless the same subscription is specified.
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 1073 def delete_snapshot \ snapshot, options: nil, &block req = { snapshot: snapshot }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteSnapshotRequest) @delete_snapshot.call(req, , &block) nil end |
#delete_subscription(subscription, options: nil) {|result, operation| ... } ⇒ Object
Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to +Pull+ after deletion will return +NOT_FOUND+. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.
619 620 621 622 623 624 625 626 627 628 629 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 619 def delete_subscription \ subscription, options: nil, &block req = { subscription: subscription }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteSubscriptionRequest) @delete_subscription.call(req, , &block) nil end |
#get_iam_policy(resource, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 1209 def get_iam_policy \ resource, options: nil, &block req = { resource: resource }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest) @get_iam_policy.call(req, , &block) end |
#get_subscription(subscription, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Subscription
Gets the configuration details of a subscription.
486 487 488 489 490 491 492 493 494 495 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 486 def get_subscription \ subscription, options: nil, &block req = { subscription: subscription }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::GetSubscriptionRequest) @get_subscription.call(req, , &block) end |
#list_snapshots(project, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Pubsub::V1::Snapshot>
Lists the existing snapshots.
ALPHA: This feature is part of an alpha release. This API might be
changed in backward-incompatible ways and is not recommended for production
use. It is not subject to any SLA or deprecation policy.
921 922 923 924 925 926 927 928 929 930 931 932 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 921 def list_snapshots \ project, page_size: nil, options: nil, &block req = { project: project, page_size: page_size }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListSnapshotsRequest) @list_snapshots.call(req, , &block) end |
#list_subscriptions(project, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Pubsub::V1::Subscription>
Lists matching subscriptions.
583 584 585 586 587 588 589 590 591 592 593 594 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 583 def list_subscriptions \ project, page_size: nil, options: nil, &block req = { project: project, page_size: page_size }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListSubscriptionsRequest) @list_subscriptions.call(req, , &block) end |
#modify_ack_deadline(subscription, ack_ids, ack_deadline_seconds, options: nil) {|result, operation| ... } ⇒ Object
Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level +ackDeadlineSeconds+ used for subsequent messages.
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 670 def modify_ack_deadline \ subscription, ack_ids, ack_deadline_seconds, options: nil, &block req = { subscription: subscription, ack_ids: ack_ids, ack_deadline_seconds: ack_deadline_seconds }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::ModifyAckDeadlineRequest) @modify_ack_deadline.call(req, , &block) nil end |
#modify_push_config(subscription, push_config, options: nil) {|result, operation| ... } ⇒ Object
Modifies the +PushConfig+ for a specified subscription.
This may be used to change a push subscription to a pull one (signified by an empty +PushConfig+) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the +PushConfig+.
862 863 864 865 866 867 868 869 870 871 872 873 874 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 862 def modify_push_config \ subscription, push_config, options: nil, &block req = { subscription: subscription, push_config: push_config }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::ModifyPushConfigRequest) @modify_push_config.call(req, , &block) nil end |
#pull(subscription, max_messages, return_immediately: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::PullResponse
Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return +UNAVAILABLE+ if there are too many concurrent pull requests pending for the given subscription.
767 768 769 770 771 772 773 774 775 776 777 778 779 780 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 767 def pull \ subscription, , return_immediately: nil, options: nil, &block req = { subscription: subscription, max_messages: , return_immediately: return_immediately }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::PullRequest) @pull.call(req, , &block) end |
#seek(subscription, time: nil, snapshot: nil, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::SeekResponse
Seeks an existing subscription to a point in time or to a given snapshot,
whichever is provided in the request.
ALPHA: This feature is part of an alpha release. This API might be
changed in backward-incompatible ways and is not recommended for production
use. It is not subject to any SLA or deprecation policy.
1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 1126 def seek \ subscription, time: nil, snapshot: nil, options: nil, &block req = { subscription: subscription, time: time, snapshot: snapshot }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::SeekRequest) @seek.call(req, , &block) end |
#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Sets the access control policy on the specified resource. Replaces any existing policy.
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 1173 def set_iam_policy \ resource, policy, options: nil, &block req = { resource: resource, policy: policy }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest) @set_iam_policy.call(req, , &block) end |
#streaming_pull(reqs, options: nil) ⇒ Enumerable<Google::Pubsub::V1::StreamingPullResponse>
EXPERIMENTAL: Streaming requests are still undergoing review. This method interface might change in the future.
Establishes a stream with the server, which sends messages down to the client. The client streams acknowledgements and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status +UNAVAILABLE+ to reassign server-side resources, in which case, the client should re-establish the stream. Flow control can be achieved by configuring the underlying RPC channel.
819 820 821 822 823 824 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 819 def streaming_pull reqs, options: nil request_protos = reqs.lazy.map do |req| Google::Gax::to_proto(req, Google::Pubsub::V1::StreamingPullRequest) end @streaming_pull.call(request_protos, ) end |
#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 1251 def \ resource, , options: nil, &block req = { resource: resource, permissions: }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest) @test_iam_permissions.call(req, , &block) end |
#update_snapshot(snapshot, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Snapshot
Updates an existing snapshot.
ALPHA: This feature is part of an alpha release. This API might be
changed in backward-incompatible ways and is not recommended for production
use. It is not subject to any SLA or deprecation policy.
Note that certain properties of a snapshot are not modifiable.
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 1034 def update_snapshot \ snapshot, update_mask, options: nil, &block req = { snapshot: snapshot, update_mask: update_mask }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateSnapshotRequest) @update_snapshot.call(req, , &block) end |
#update_subscription(subscription, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Pubsub::V1::Subscription
Updates an existing subscription. Note that certain properties of a subscription, such as its topic, are not modifiable.
528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/google/cloud/pubsub/v1/subscriber_client.rb', line 528 def update_subscription \ subscription, update_mask, options: nil, &block req = { subscription: subscription, update_mask: update_mask }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateSubscriptionRequest) @update_subscription.call(req, , &block) end |