Class: Google::Apis::PubsubV1beta1a::PubsubService

Inherits:
Core::BaseService show all
Defined in:
generated/google/apis/pubsub_v1beta1a/service.rb

Overview

Cloud Pub/Sub API

Provides reliable, many-to-many, asynchronous messaging between applications.

Examples:

require 'google/apis/pubsub_v1beta1a'

Pubsub = Google::Apis::PubsubV1beta1a # Alias the module
service = Pubsub::PubsubService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializePubsubService


45
46
47
48
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 45

def initialize
  super('https://pubsub.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString


38
39
40
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 38

def key
  @key
end

#quota_userString


43
44
45
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 43

def quota_user
  @quota_user
end

Instance Method Details

#acknowledge_subscription(acknowledge_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Empty

Acknowledges a particular received message: the Pub/Sub system can remove the given message from the subscription. Acknowledging a message whose Ack deadline has expired may succeed, but the message could have been already redelivered. Acknowledging a message more than once will not result in an error. This is only used for messages received via pull.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


73
74
75
76
77
78
79
80
81
82
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 73

def acknowledge_subscription(acknowledge_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/subscriptions/acknowledge', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::AcknowledgeRequest::Representation
  command.request_object = acknowledge_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::Empty::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Empty
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_subscription(subscription_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Subscription

Creates a subscription on a given topic for a given subscriber. 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.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


107
108
109
110
111
112
113
114
115
116
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 107

def create_subscription(subscription_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/subscriptions', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::Subscription::Representation
  command.request_object = subscription_object
  command.response_representation = Google::Apis::PubsubV1beta1a::Subscription::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Subscription
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_topic(topic_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Topic

Creates the given topic with the given name.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


366
367
368
369
370
371
372
373
374
375
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 366

def create_topic(topic_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/topics', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::Topic::Representation
  command.request_object = topic_object
  command.response_representation = Google::Apis::PubsubV1beta1a::Topic::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Topic
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_subscription(subscription, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Empty

Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to Pull after deletion will return NOT_FOUND.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


140
141
142
143
144
145
146
147
148
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 140

def delete_subscription(subscription, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'v1beta1a/subscriptions/{+subscription}', options)
  command.response_representation = Google::Apis::PubsubV1beta1a::Empty::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Empty
  command.params['subscription'] = subscription unless subscription.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_topic(topic, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Empty

Deletes the topic with the given name. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


399
400
401
402
403
404
405
406
407
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 399

def delete_topic(topic, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'v1beta1a/topics/{+topic}', options)
  command.response_representation = Google::Apis::PubsubV1beta1a::Empty::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Empty
  command.params['topic'] = topic unless topic.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_subscription(subscription, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Subscription

Gets the configuration details of a subscription.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


170
171
172
173
174
175
176
177
178
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 170

def get_subscription(subscription, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1beta1a/subscriptions/{+subscription}', options)
  command.response_representation = Google::Apis::PubsubV1beta1a::Subscription::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Subscription
  command.params['subscription'] = subscription unless subscription.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_topic(topic, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Topic

Gets the configuration of a topic. Since the topic only has the name attribute, this method is only useful to check the existence of a topic. If other attributes are added in the future, they will be returned here.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


431
432
433
434
435
436
437
438
439
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 431

def get_topic(topic, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1beta1a/topics/{+topic}', options)
  command.response_representation = Google::Apis::PubsubV1beta1a::Topic::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Topic
  command.params['topic'] = topic unless topic.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_subscriptions(max_results: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::ListSubscriptionsResponse

Lists matching subscriptions.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


205
206
207
208
209
210
211
212
213
214
215
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 205

def list_subscriptions(max_results: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1beta1a/subscriptions', options)
  command.response_representation = Google::Apis::PubsubV1beta1a::ListSubscriptionsResponse::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::ListSubscriptionsResponse
  command.query['maxResults'] = max_results unless max_results.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['query'] = query unless query.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_topics(max_results: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::ListTopicsResponse

Lists matching topics.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


466
467
468
469
470
471
472
473
474
475
476
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 466

def list_topics(max_results: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1beta1a/topics', options)
  command.response_representation = Google::Apis::PubsubV1beta1a::ListTopicsResponse::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::ListTopicsResponse
  command.query['maxResults'] = max_results unless max_results.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['query'] = query unless query.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#modify_subscription_ack_deadline(modify_ack_deadline_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Empty

Modifies the Ack deadline for a message received from a pull request.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


236
237
238
239
240
241
242
243
244
245
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 236

def modify_subscription_ack_deadline(modify_ack_deadline_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/subscriptions/modifyAckDeadline', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::ModifyAckDeadlineRequest::Representation
  command.request_object = modify_ack_deadline_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::Empty::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Empty
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#modify_subscription_push_config(modify_push_config_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Empty

Modifies the PushConfig for a specified subscription. This method can be used to suspend the flow of messages to an endpoint by clearing the PushConfig field in the request. Messages will be accumulated for delivery even if no push configuration is defined or while the configuration is modified.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


270
271
272
273
274
275
276
277
278
279
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 270

def modify_subscription_push_config(modify_push_config_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/subscriptions/modifyPushConfig', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::ModifyPushConfigRequest::Representation
  command.request_object = modify_push_config_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::Empty::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Empty
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#publish_topic(publish_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::Empty

Adds a message to the topic. Returns NOT_FOUND if the topic does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


498
499
500
501
502
503
504
505
506
507
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 498

def publish_topic(publish_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/topics/publish', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::PublishRequest::Representation
  command.request_object = publish_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::Empty::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::Empty
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#publish_topic_batch(publish_batch_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::PublishBatchResponse

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


529
530
531
532
533
534
535
536
537
538
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 529

def publish_topic_batch(publish_batch_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/topics/publishBatch', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::PublishBatchRequest::Representation
  command.request_object = publish_batch_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::PublishBatchResponse::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::PublishBatchResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#pull_subscription(pull_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::PullResponse

Pulls a single message from the server. If return_immediately is true, and no messages are available in the subscription, this method returns FAILED_PRECONDITION. The system is free to return an UNAVAILABLE error if no messages are available in a reasonable amount of time (to reduce system load).

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


304
305
306
307
308
309
310
311
312
313
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 304

def pull_subscription(pull_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/subscriptions/pull', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::PullRequest::Representation
  command.request_object = pull_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::PullResponse::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::PullResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#pull_subscription_batch(pull_batch_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PubsubV1beta1a::PullBatchResponse

Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The system is free to return UNAVAILABLE if there are too many pull requests outstanding for the given subscription.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


336
337
338
339
340
341
342
343
344
345
# File 'generated/google/apis/pubsub_v1beta1a/service.rb', line 336

def pull_subscription_batch(pull_batch_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1beta1a/subscriptions/pullBatch', options)
  command.request_representation = Google::Apis::PubsubV1beta1a::PullBatchRequest::Representation
  command.request_object = pull_batch_request_object
  command.response_representation = Google::Apis::PubsubV1beta1a::PullBatchResponse::Representation
  command.response_class = Google::Apis::PubsubV1beta1a::PullBatchResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end