Created
September 29, 2022 10:57
-
-
Save calorie/c4315b27eca724e4bfeda128d92b23f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'google/cloud/tasks/v2' | |
http_method = 'POST' | |
url = '' | |
project = '' | |
location = '' | |
queue = '' | |
parent = "projects/#{project}/locations/#{location}/queues/#{queue}" | |
http_request = ::Google::Cloud::Tasks::V2::HttpRequest.new | |
http_request.http_method = http_method | |
http_request.url = url | |
task = ::Google::Cloud::Tasks::V2::Task.new | |
task.http_request = http_request | |
request = ::Google::Cloud::Tasks::V2::CreateTaskRequest.new(parent: parent, task: task) | |
client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new | |
result = client.create_task request | |
puts result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment