lib/google/cloud/automl/v1/prediction_service/operations.rb in google-cloud-automl-v1-0.5.0 vs lib/google/cloud/automl/v1/prediction_service/operations.rb in google-cloud-automl-v1-0.5.1
- old
+ new
@@ -156,17 +156,15 @@
# request = Google::Longrunning::ListOperationsRequest.new
#
# # Call the list_operations method.
# result = client.list_operations request
#
- # # The returned object is of type Gapic::PagedEnumerable. You can
- # # iterate over all elements by calling #each, and the enumerable
- # # will lazily make API calls to fetch subsequent pages. Other
- # # methods are also available for managing paging directly.
- # result.each do |response|
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
+ # # over elements, and API calls will be issued to fetch pages as needed.
+ # result.each do |item|
# # Each element is of type ::Google::Longrunning::Operation.
- # p response
+ # p item
# end
#
def list_operations request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -251,18 +249,18 @@
# request = Google::Longrunning::GetOperationRequest.new
#
# # Call the get_operation method.
# result = client.get_operation request
#
- # # The returned object is of type Gapic::Operation. You can use this
- # # object to check the status of an operation, cancel it, or wait
- # # for results. Here is how to block until completion:
+ # # The returned object is of type Gapic::Operation. You can use it to
+ # # check the status of an operation, cancel it, or wait for results.
+ # # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
- # puts "Error!"
+ # puts "No response received."
# end
#
def get_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -538,18 +536,18 @@
# request = Google::Longrunning::WaitOperationRequest.new
#
# # Call the wait_operation method.
# result = client.wait_operation request
#
- # # The returned object is of type Gapic::Operation. You can use this
- # # object to check the status of an operation, cancel it, or wait
- # # for results. Here is how to block until completion:
+ # # The returned object is of type Gapic::Operation. You can use it to
+ # # check the status of an operation, cancel it, or wait for results.
+ # # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
- # puts "Error!"
+ # puts "No response received."
# end
#
def wait_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -564,9 +562,17 @@
# Set x-goog-api-client and x-goog-user-project headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::AutoML::V1::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
+ metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
metadata: metadata,
retry_policy: @config.rpcs.wait_operation.retry_policy