Class: Google::Cloud::Tasks::V2beta3::CloudTasksClient
- Inherits:
-
Object
- Object
- Google::Cloud::Tasks::V2beta3::CloudTasksClient
- Defined in:
- lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb,
lib/google/cloud/tasks/v2beta3/helpers.rb
Overview
Cloud Tasks allows developers to manage the execution of background work in their applications.
Constant Summary collapse
- SERVICE_ADDRESS =
The default address of the service.
"cloudtasks.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" ].freeze
Class Method Summary collapse
-
.location_path(project, location) ⇒ String
Returns a fully-qualified location resource name string.
-
.project_path(project) ⇒ String
Returns a fully-qualified project resource name string.
-
.queue_path(project, location, queue) ⇒ String
Returns a fully-qualified queue resource name string.
-
.task_path(project, location, queue, task) ⇒ String
Returns a fully-qualified task resource name string.
Instance Method Summary collapse
-
#create_queue(parent, queue, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Creates a queue.
-
#create_task(parent, task, response_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Task
Creates a task and adds it to a queue.
-
#delete_queue(name, options: nil) {|result, operation| ... } ⇒ Object
Deletes a queue.
-
#delete_task(name, options: nil) {|result, operation| ... } ⇒ Object
Deletes a task.
-
#get_iam_policy(resource, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Gets the access control policy for a Queue.
-
#get_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Gets a queue.
-
#get_task(name, response_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Task
Gets a task.
-
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ CloudTasksClient
constructor
A new instance of CloudTasksClient.
-
#list_queues(parent, filter: nil, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta3::Queue>
Lists queues.
-
#list_tasks(parent, response_view: nil, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta3::Task>
Lists the tasks in a queue.
-
#location_path(project, location) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.location_path.
-
#pause_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Pauses the queue.
-
#project_path(project) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.project_path.
-
#purge_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Purges a queue by deleting all of its tasks.
-
#queue_path(project, location, queue) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.queue_path.
-
#resume_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Resume a queue.
-
#run_task(name, response_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Task
Forces a task to run now.
-
#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Sets the access control policy for a Queue.
-
#task_path(project, location, queue, task) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.task_path.
-
#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on a Queue.
-
#update_queue(queue, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Updates a queue.
Constructor Details
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ CloudTasksClient
Returns a new instance of CloudTasksClient.
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 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 176 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/cloud/tasks/v2beta3/cloudtasks_services_pb" credentials ||= Google::Cloud::Tasks::V2beta3::Credentials.default if credentials.is_a?(String) || credentials.is_a?(Hash) updater_proc = Google::Cloud::Tasks::V2beta3::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-tasks'].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( "cloud_tasks_client_config.json" ) defaults = client_config_file.open do |f| Google::Gax.construct_settings( "google.cloud.tasks.v2beta3.CloudTasks", 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 @cloud_tasks_stub = Google::Gax::Grpc.create_stub( service_path, port, chan_creds: chan_creds, channel: channel, updater_proc: updater_proc, scopes: scopes, interceptors: interceptors, &Google::Cloud::Tasks::V2beta3::CloudTasks::Stub.method(:new) ) @list_queues = Google::Gax.create_api_call( @cloud_tasks_stub.method(:list_queues), defaults["list_queues"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @get_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:get_queue), defaults["get_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @create_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:create_queue), defaults["create_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @update_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:update_queue), defaults["update_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'queue.name' => request.queue.name} end ) @delete_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:delete_queue), defaults["delete_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @purge_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:purge_queue), defaults["purge_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @pause_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:pause_queue), defaults["pause_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @resume_queue = Google::Gax.create_api_call( @cloud_tasks_stub.method(:resume_queue), defaults["resume_queue"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @get_iam_policy = Google::Gax.create_api_call( @cloud_tasks_stub.method(:get_iam_policy), defaults["get_iam_policy"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'resource' => request.resource} end ) @set_iam_policy = Google::Gax.create_api_call( @cloud_tasks_stub.method(:set_iam_policy), defaults["set_iam_policy"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'resource' => request.resource} end ) = Google::Gax.create_api_call( @cloud_tasks_stub.method(:test_iam_permissions), defaults["test_iam_permissions"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'resource' => request.resource} end ) @list_tasks = Google::Gax.create_api_call( @cloud_tasks_stub.method(:list_tasks), defaults["list_tasks"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @get_task = Google::Gax.create_api_call( @cloud_tasks_stub.method(:get_task), defaults["get_task"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @create_task = Google::Gax.create_api_call( @cloud_tasks_stub.method(:create_task), defaults["create_task"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @delete_task = Google::Gax.create_api_call( @cloud_tasks_stub.method(:delete_task), defaults["delete_task"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @run_task = Google::Gax.create_api_call( @cloud_tasks_stub.method(:run_task), defaults["run_task"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) end |
Class Method Details
.location_path(project, location) ⇒ String
Returns a fully-qualified location resource name string.
112 113 114 115 116 117 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 112 def self.location_path project, location LOCATION_PATH_TEMPLATE.render( :"project" => project, :"location" => location ) end |
.project_path(project) ⇒ String
Returns a fully-qualified project resource name string.
102 103 104 105 106 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 102 def self.project_path project PROJECT_PATH_TEMPLATE.render( :"project" => project ) end |
.queue_path(project, location, queue) ⇒ String
Returns a fully-qualified queue resource name string.
124 125 126 127 128 129 130 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 124 def self.queue_path project, location, queue QUEUE_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"queue" => queue ) end |
.task_path(project, location, queue, task) ⇒ String
Returns a fully-qualified task resource name string.
138 139 140 141 142 143 144 145 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 138 def self.task_path project, location, queue, task TASK_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"queue" => queue, :"task" => task ) end |
Instance Method Details
#create_queue(parent, queue, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Creates a queue.
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are
using an App Engine queue.yaml or queue.xml file to manage your queues.
Read
Overview of Queue Management and
queue.yaml before using
this method.
536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 536 def create_queue \ parent, queue, options: nil, &block req = { parent: parent, queue: queue }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::CreateQueueRequest) @create_queue.call(req, , &block) end |
#create_task(parent, task, response_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Task
Creates a task and adds it to a queue.
Tasks cannot be updated after creation; there is no UpdateTask command.
- For App Engine queues, the maximum task size is 100KB.
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 1143 def create_task \ parent, task, response_view: nil, options: nil, &block req = { parent: parent, task: task, response_view: response_view }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::CreateTaskRequest) @create_task.call(req, , &block) end |
#delete_queue(name, options: nil) {|result, operation| ... } ⇒ Object
Deletes a queue.
This command will delete the queue even if it has tasks in it.
Note: If you delete a queue, a queue with the same name can't be created for 7 days.
WARNING: Using this method may have unintended side effects if you are
using an App Engine queue.yaml or queue.xml file to manage your queues.
Read
Overview of Queue Management and
queue.yaml before using
this method.
648 649 650 651 652 653 654 655 656 657 658 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 648 def delete_queue \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::DeleteQueueRequest) @delete_queue.call(req, , &block) nil end |
#delete_task(name, options: nil) {|result, operation| ... } ⇒ Object
Deletes a task.
A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 1183 def delete_task \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::DeleteTaskRequest) @delete_task.call(req, , &block) nil end |
#get_iam_policy(resource, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Gets the access control policy for a Queue. Returns an empty policy if the resource exists and does not have a policy set.
Authorization requires the following Google IAM permission on the specified resource parent:
cloudtasks.queues.getIamPolicy
814 815 816 817 818 819 820 821 822 823 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 814 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_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Gets a queue.
476 477 478 479 480 481 482 483 484 485 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 476 def get_queue \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::GetQueueRequest) @get_queue.call(req, , &block) end |
#get_task(name, response_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Task
Gets a task.
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 1045 def get_task \ name, response_view: nil, options: nil, &block req = { name: name, response_view: response_view }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::GetTaskRequest) @get_task.call(req, , &block) end |
#list_queues(parent, filter: nil, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta3::Queue>
Lists queues.
Queues are returned in lexicographical order.
439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 439 def list_queues \ parent, filter: nil, page_size: nil, options: nil, &block req = { parent: parent, filter: filter, page_size: page_size }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::ListQueuesRequest) @list_queues.call(req, , &block) end |
#list_tasks(parent, response_view: nil, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta3::Task>
Lists the tasks in a queue.
By default, only the BASIC view is retrieved due to performance considerations; response_view controls the subset of information which is returned.
The tasks may be returned in any order. The ordering may change at any time.
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 994 def list_tasks \ parent, response_view: nil, page_size: nil, options: nil, &block req = { parent: parent, response_view: response_view, page_size: page_size }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::ListTasksRequest) @list_tasks.call(req, , &block) end |
#location_path(project, location) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.location_path.
23 24 25 |
# File 'lib/google/cloud/tasks/v2beta3/helpers.rb', line 23 def location_path project, location self.class.location_path project, location end |
#pause_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
727 728 729 730 731 732 733 734 735 736 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 727 def pause_queue \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::PauseQueueRequest) @pause_queue.call(req, , &block) end |
#project_path(project) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.project_path.
30 31 32 |
# File 'lib/google/cloud/tasks/v2beta3/helpers.rb', line 30 def project_path project self.class.project_path project end |
#purge_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Purges a queue by deleting all of its tasks.
All tasks created before this method is called are permanently deleted.
Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.
687 688 689 690 691 692 693 694 695 696 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 687 def purge_queue \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::PurgeQueueRequest) @purge_queue.call(req, , &block) end |
#queue_path(project, location, queue) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.queue_path.
39 40 41 |
# File 'lib/google/cloud/tasks/v2beta3/helpers.rb', line 39 def queue_path project, location, queue self.class.queue_path project, location, queue end |
#resume_queue(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Resume a queue.
This method resumes a queue after it has been PAUSED or DISABLED. The state of a queue is stored in the queue's state; after calling this method it will be set to RUNNING.
WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in Managing Cloud Tasks Scaling Risks.
774 775 776 777 778 779 780 781 782 783 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 774 def resume_queue \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::ResumeQueueRequest) @resume_queue.call(req, , &block) end |
#run_task(name, response_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Task
Forces a task to run now.
When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its RateLimits or is PAUSED.
This command is meant to be used for manual debugging. For example, RunTask can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.
The dispatched task is returned. That is, the task that is returned contains the status after the task is dispatched but before the task is received by its target.
If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's schedule_time will be reset to the time that RunTask was called plus the retry delay specified in the queue's RetryConfig.
RunTask returns NOT_FOUND when it is called on a task that has already succeeded or permanently failed.
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 1257 def run_task \ name, response_view: nil, options: nil, &block req = { name: name, response_view: response_view }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::RunTaskRequest) @run_task.call(req, , &block) end |
#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Sets the access control policy for a Queue. Replaces any existing policy.
Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.
Authorization requires the following Google IAM permission on the specified resource parent:
cloudtasks.queues.setIamPolicy
866 867 868 869 870 871 872 873 874 875 876 877 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 866 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 |
#task_path(project, location, queue, task) ⇒ String
Alias for Google::Cloud::Tasks::V2beta3::CloudTasksClient.task_path.
49 50 51 |
# File 'lib/google/cloud/tasks/v2beta3/helpers.rb', line 49 def task_path project, location, queue, task self.class.task_path project, location, queue, task end |
#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on a Queue. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
915 916 917 918 919 920 921 922 923 924 925 926 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 915 def \ resource, , options: nil, &block req = { resource: resource, permissions: }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest) .call(req, , &block) end |
#update_queue(queue, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Tasks::V2beta3::Queue
Updates a queue.
This method creates the queue if it does not exist and updates the queue if it does exist.
Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are
using an App Engine queue.yaml or queue.xml file to manage your queues.
Read
Overview of Queue Management and
queue.yaml before using
this method.
602 603 604 605 606 607 608 609 610 611 612 613 |
# File 'lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb', line 602 def update_queue \ queue, update_mask: nil, options: nil, &block req = { queue: queue, update_mask: update_mask }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta3::UpdateQueueRequest) @update_queue.call(req, , &block) end |