google-cloud-datastore-admin-v1 0.1.1 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/datastore/admin/v1.rb +3 -0
- data/lib/google/cloud/datastore/admin/v1/datastore_admin/client.rb +202 -16
- data/lib/google/cloud/datastore/admin/v1/datastore_admin/operations.rb +95 -10
- data/lib/google/cloud/datastore/admin/v1/version.rb +1 -1
- data/lib/google/datastore/admin/v1/datastore_admin_pb.rb +10 -0
- data/lib/google/datastore/admin/v1/datastore_admin_services_pb.rb +31 -5
- data/lib/google/datastore/admin/v1/migration_pb.rb +44 -0
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/datastore/admin/v1/datastore_admin.rb +27 -0
- data/proto_docs/google/datastore/admin/v1/index.rb +1 -1
- data/proto_docs/google/datastore/admin/v1/migration.rb +90 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +23 -11
@@ -119,7 +119,7 @@ module Google
|
|
119
119
|
parent_config = while namespace.any?
|
120
120
|
parent_name = namespace.join "::"
|
121
121
|
parent_const = const_get parent_name
|
122
|
-
break parent_const.configure if parent_const
|
122
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
123
123
|
namespace.pop
|
124
124
|
end
|
125
125
|
default_config = Client::Configuration.new parent_config
|
@@ -128,20 +128,24 @@ module Google
|
|
128
128
|
|
129
129
|
default_config.rpcs.import_entities.timeout = 60.0
|
130
130
|
|
131
|
+
default_config.rpcs.create_index.timeout = 60.0
|
132
|
+
|
133
|
+
default_config.rpcs.delete_index.timeout = 60.0
|
134
|
+
|
131
135
|
default_config.rpcs.get_index.timeout = 60.0
|
132
136
|
default_config.rpcs.get_index.retry_policy = {
|
133
137
|
initial_delay: 0.1,
|
134
|
-
|
135
|
-
|
136
|
-
|
138
|
+
max_delay: 60.0,
|
139
|
+
multiplier: 1.3,
|
140
|
+
retry_codes: [14, 4]
|
137
141
|
}
|
138
142
|
|
139
143
|
default_config.rpcs.list_indexes.timeout = 60.0
|
140
144
|
default_config.rpcs.list_indexes.retry_policy = {
|
141
145
|
initial_delay: 0.1,
|
142
|
-
|
143
|
-
|
144
|
-
|
146
|
+
max_delay: 60.0,
|
147
|
+
multiplier: 1.3,
|
148
|
+
retry_codes: [14, 4]
|
145
149
|
}
|
146
150
|
|
147
151
|
default_config
|
@@ -205,7 +209,13 @@ module Google
|
|
205
209
|
|
206
210
|
# Create credentials
|
207
211
|
credentials = @config.credentials
|
208
|
-
|
212
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
213
|
+
# but only if the default endpoint does not have a region prefix.
|
214
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
215
|
+
@config.endpoint == Client.configure.endpoint &&
|
216
|
+
!@config.endpoint.split(".").first.include?("-")
|
217
|
+
credentials ||= Credentials.default scope: @config.scope,
|
218
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
209
219
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
210
220
|
credentials = Credentials.new credentials, scope: @config.scope
|
211
221
|
end
|
@@ -424,6 +434,168 @@ module Google
|
|
424
434
|
raise ::Google::Cloud::Error.from_error(e)
|
425
435
|
end
|
426
436
|
|
437
|
+
##
|
438
|
+
# Creates the specified index.
|
439
|
+
# A newly created index's initial state is `CREATING`. On completion of the
|
440
|
+
# returned {::Google::Longrunning::Operation google.longrunning.Operation}, the state will be `READY`.
|
441
|
+
# If the index already exists, the call will return an `ALREADY_EXISTS`
|
442
|
+
# status.
|
443
|
+
#
|
444
|
+
# During index creation, the process could result in an error, in which
|
445
|
+
# case the index will move to the `ERROR` state. The process can be recovered
|
446
|
+
# by fixing the data that caused the error, removing the index with
|
447
|
+
# {::Google::Cloud::Datastore::Admin::V1::DatastoreAdmin::Client#delete_index delete}, then
|
448
|
+
# re-creating the index with [create]
|
449
|
+
# [google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
|
450
|
+
#
|
451
|
+
# Indexes with a single property cannot be created.
|
452
|
+
#
|
453
|
+
# @overload create_index(request, options = nil)
|
454
|
+
# Pass arguments to `create_index` via a request object, either of type
|
455
|
+
# {::Google::Cloud::Datastore::Admin::V1::CreateIndexRequest} or an equivalent Hash.
|
456
|
+
#
|
457
|
+
# @param request [::Google::Cloud::Datastore::Admin::V1::CreateIndexRequest, ::Hash]
|
458
|
+
# A request object representing the call parameters. Required. To specify no
|
459
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
460
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
461
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
462
|
+
#
|
463
|
+
# @overload create_index(project_id: nil, index: nil)
|
464
|
+
# Pass arguments to `create_index` via keyword arguments. Note that at
|
465
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
466
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
467
|
+
#
|
468
|
+
# @param project_id [::String]
|
469
|
+
# Project ID against which to make the request.
|
470
|
+
# @param index [::Google::Cloud::Datastore::Admin::V1::Index, ::Hash]
|
471
|
+
# The index to create. The name and state fields are output only and will be
|
472
|
+
# ignored. Single property indexes cannot be created or deleted.
|
473
|
+
#
|
474
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
475
|
+
# @yieldparam response [::Gapic::Operation]
|
476
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
477
|
+
#
|
478
|
+
# @return [::Gapic::Operation]
|
479
|
+
#
|
480
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
481
|
+
#
|
482
|
+
def create_index request, options = nil
|
483
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
484
|
+
|
485
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Datastore::Admin::V1::CreateIndexRequest
|
486
|
+
|
487
|
+
# Converts hash and nil to an options object
|
488
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
489
|
+
|
490
|
+
# Customize the options with defaults
|
491
|
+
metadata = @config.rpcs.create_index.metadata.to_h
|
492
|
+
|
493
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
494
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
495
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
496
|
+
gapic_version: ::Google::Cloud::Datastore::Admin::V1::VERSION
|
497
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
498
|
+
|
499
|
+
header_params = {
|
500
|
+
"project_id" => request.project_id
|
501
|
+
}
|
502
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
503
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
504
|
+
|
505
|
+
options.apply_defaults timeout: @config.rpcs.create_index.timeout,
|
506
|
+
metadata: metadata,
|
507
|
+
retry_policy: @config.rpcs.create_index.retry_policy
|
508
|
+
options.apply_defaults metadata: @config.metadata,
|
509
|
+
retry_policy: @config.retry_policy
|
510
|
+
|
511
|
+
@datastore_admin_stub.call_rpc :create_index, request, options: options do |response, operation|
|
512
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
513
|
+
yield response, operation if block_given?
|
514
|
+
return response
|
515
|
+
end
|
516
|
+
rescue ::GRPC::BadStatus => e
|
517
|
+
raise ::Google::Cloud::Error.from_error(e)
|
518
|
+
end
|
519
|
+
|
520
|
+
##
|
521
|
+
# Deletes an existing index.
|
522
|
+
# An index can only be deleted if it is in a `READY` or `ERROR` state. On
|
523
|
+
# successful execution of the request, the index will be in a `DELETING`
|
524
|
+
# {::Google::Cloud::Datastore::Admin::V1::Index::State state}. And on completion of the
|
525
|
+
# returned {::Google::Longrunning::Operation google.longrunning.Operation}, the index will be removed.
|
526
|
+
#
|
527
|
+
# During index deletion, the process could result in an error, in which
|
528
|
+
# case the index will move to the `ERROR` state. The process can be recovered
|
529
|
+
# by fixing the data that caused the error, followed by calling
|
530
|
+
# {::Google::Cloud::Datastore::Admin::V1::DatastoreAdmin::Client#delete_index delete} again.
|
531
|
+
#
|
532
|
+
# @overload delete_index(request, options = nil)
|
533
|
+
# Pass arguments to `delete_index` via a request object, either of type
|
534
|
+
# {::Google::Cloud::Datastore::Admin::V1::DeleteIndexRequest} or an equivalent Hash.
|
535
|
+
#
|
536
|
+
# @param request [::Google::Cloud::Datastore::Admin::V1::DeleteIndexRequest, ::Hash]
|
537
|
+
# A request object representing the call parameters. Required. To specify no
|
538
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
539
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
540
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
541
|
+
#
|
542
|
+
# @overload delete_index(project_id: nil, index_id: nil)
|
543
|
+
# Pass arguments to `delete_index` via keyword arguments. Note that at
|
544
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
545
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
546
|
+
#
|
547
|
+
# @param project_id [::String]
|
548
|
+
# Project ID against which to make the request.
|
549
|
+
# @param index_id [::String]
|
550
|
+
# The resource ID of the index to delete.
|
551
|
+
#
|
552
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
553
|
+
# @yieldparam response [::Gapic::Operation]
|
554
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
555
|
+
#
|
556
|
+
# @return [::Gapic::Operation]
|
557
|
+
#
|
558
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
559
|
+
#
|
560
|
+
def delete_index request, options = nil
|
561
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
562
|
+
|
563
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Datastore::Admin::V1::DeleteIndexRequest
|
564
|
+
|
565
|
+
# Converts hash and nil to an options object
|
566
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
567
|
+
|
568
|
+
# Customize the options with defaults
|
569
|
+
metadata = @config.rpcs.delete_index.metadata.to_h
|
570
|
+
|
571
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
572
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
573
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
574
|
+
gapic_version: ::Google::Cloud::Datastore::Admin::V1::VERSION
|
575
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
576
|
+
|
577
|
+
header_params = {
|
578
|
+
"project_id" => request.project_id,
|
579
|
+
"index_id" => request.index_id
|
580
|
+
}
|
581
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
582
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
583
|
+
|
584
|
+
options.apply_defaults timeout: @config.rpcs.delete_index.timeout,
|
585
|
+
metadata: metadata,
|
586
|
+
retry_policy: @config.rpcs.delete_index.retry_policy
|
587
|
+
options.apply_defaults metadata: @config.metadata,
|
588
|
+
retry_policy: @config.retry_policy
|
589
|
+
|
590
|
+
@datastore_admin_stub.call_rpc :delete_index, request, options: options do |response, operation|
|
591
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
592
|
+
yield response, operation if block_given?
|
593
|
+
return response
|
594
|
+
end
|
595
|
+
rescue ::GRPC::BadStatus => e
|
596
|
+
raise ::Google::Cloud::Error.from_error(e)
|
597
|
+
end
|
598
|
+
|
427
599
|
##
|
428
600
|
# Gets an index.
|
429
601
|
#
|
@@ -474,7 +646,7 @@ module Google
|
|
474
646
|
|
475
647
|
header_params = {
|
476
648
|
"project_id" => request.project_id,
|
477
|
-
"index_id"
|
649
|
+
"index_id" => request.index_id
|
478
650
|
}
|
479
651
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
480
652
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
@@ -660,7 +832,7 @@ module Google
|
|
660
832
|
config_attr :scope, nil, ::String, ::Array, nil
|
661
833
|
config_attr :lib_name, nil, ::String, nil
|
662
834
|
config_attr :lib_version, nil, ::String, nil
|
663
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
835
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
664
836
|
config_attr :interceptors, nil, ::Array, nil
|
665
837
|
config_attr :timeout, nil, ::Numeric, nil
|
666
838
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -681,7 +853,7 @@ module Google
|
|
681
853
|
def rpcs
|
682
854
|
@rpcs ||= begin
|
683
855
|
parent_rpcs = nil
|
684
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
856
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
685
857
|
Rpcs.new parent_rpcs
|
686
858
|
end
|
687
859
|
end
|
@@ -693,7 +865,7 @@ module Google
|
|
693
865
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
694
866
|
# the following configuration fields:
|
695
867
|
#
|
696
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
868
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
697
869
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
698
870
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
699
871
|
# include the following keys:
|
@@ -715,6 +887,16 @@ module Google
|
|
715
887
|
#
|
716
888
|
attr_reader :import_entities
|
717
889
|
##
|
890
|
+
# RPC-specific configuration for `create_index`
|
891
|
+
# @return [::Gapic::Config::Method]
|
892
|
+
#
|
893
|
+
attr_reader :create_index
|
894
|
+
##
|
895
|
+
# RPC-specific configuration for `delete_index`
|
896
|
+
# @return [::Gapic::Config::Method]
|
897
|
+
#
|
898
|
+
attr_reader :delete_index
|
899
|
+
##
|
718
900
|
# RPC-specific configuration for `get_index`
|
719
901
|
# @return [::Gapic::Config::Method]
|
720
902
|
#
|
@@ -727,13 +909,17 @@ module Google
|
|
727
909
|
|
728
910
|
# @private
|
729
911
|
def initialize parent_rpcs = nil
|
730
|
-
export_entities_config = parent_rpcs
|
912
|
+
export_entities_config = parent_rpcs.export_entities if parent_rpcs.respond_to? :export_entities
|
731
913
|
@export_entities = ::Gapic::Config::Method.new export_entities_config
|
732
|
-
import_entities_config = parent_rpcs
|
914
|
+
import_entities_config = parent_rpcs.import_entities if parent_rpcs.respond_to? :import_entities
|
733
915
|
@import_entities = ::Gapic::Config::Method.new import_entities_config
|
734
|
-
|
916
|
+
create_index_config = parent_rpcs.create_index if parent_rpcs.respond_to? :create_index
|
917
|
+
@create_index = ::Gapic::Config::Method.new create_index_config
|
918
|
+
delete_index_config = parent_rpcs.delete_index if parent_rpcs.respond_to? :delete_index
|
919
|
+
@delete_index = ::Gapic::Config::Method.new delete_index_config
|
920
|
+
get_index_config = parent_rpcs.get_index if parent_rpcs.respond_to? :get_index
|
735
921
|
@get_index = ::Gapic::Config::Method.new get_index_config
|
736
|
-
list_indexes_config = parent_rpcs
|
922
|
+
list_indexes_config = parent_rpcs.list_indexes if parent_rpcs.respond_to? :list_indexes
|
737
923
|
@list_indexes = ::Gapic::Config::Method.new list_indexes_config
|
738
924
|
|
739
925
|
yield self if block_given?
|
@@ -104,8 +104,13 @@ module Google
|
|
104
104
|
# Lists operations that match the specified filter in the request. If the
|
105
105
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
106
106
|
#
|
107
|
-
# NOTE: the `name` binding
|
108
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
107
|
+
# NOTE: the `name` binding allows API services to override the binding
|
108
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
109
|
+
# override the binding, API services can add a binding such as
|
110
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
111
|
+
# For backwards compatibility, the default name includes the operations
|
112
|
+
# collection id, however overriding users must ensure the name binding
|
113
|
+
# is the parent resource, without the operations collection id.
|
109
114
|
#
|
110
115
|
# @overload list_operations(request, options = nil)
|
111
116
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -123,7 +128,7 @@ module Google
|
|
123
128
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
124
129
|
#
|
125
130
|
# @param name [::String]
|
126
|
-
# The name of the operation
|
131
|
+
# The name of the operation's parent resource.
|
127
132
|
# @param filter [::String]
|
128
133
|
# The standard list filter.
|
129
134
|
# @param page_size [::Integer]
|
@@ -391,6 +396,79 @@ module Google
|
|
391
396
|
raise ::Google::Cloud::Error.from_error(e)
|
392
397
|
end
|
393
398
|
|
399
|
+
##
|
400
|
+
# Waits for the specified long-running operation until it is done or reaches
|
401
|
+
# at most a specified timeout, returning the latest state. If the operation
|
402
|
+
# is already done, the latest state is immediately returned. If the timeout
|
403
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
404
|
+
# timeout is used. If the server does not support this method, it returns
|
405
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
406
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
407
|
+
# state before the specified timeout (including immediately), meaning even an
|
408
|
+
# immediate response is no guarantee that the operation is done.
|
409
|
+
#
|
410
|
+
# @overload wait_operation(request, options = nil)
|
411
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
412
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
413
|
+
#
|
414
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
415
|
+
# A request object representing the call parameters. Required. To specify no
|
416
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
417
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
418
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
419
|
+
#
|
420
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
421
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
422
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
423
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
424
|
+
#
|
425
|
+
# @param name [::String]
|
426
|
+
# The name of the operation resource to wait on.
|
427
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
428
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
429
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
430
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
431
|
+
#
|
432
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
433
|
+
# @yieldparam response [::Gapic::Operation]
|
434
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
435
|
+
#
|
436
|
+
# @return [::Gapic::Operation]
|
437
|
+
#
|
438
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
439
|
+
#
|
440
|
+
def wait_operation request, options = nil
|
441
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
442
|
+
|
443
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
444
|
+
|
445
|
+
# Converts hash and nil to an options object
|
446
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
447
|
+
|
448
|
+
# Customize the options with defaults
|
449
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
450
|
+
|
451
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
452
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
453
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
454
|
+
gapic_version: ::Google::Cloud::Datastore::Admin::V1::VERSION
|
455
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
456
|
+
|
457
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
458
|
+
metadata: metadata,
|
459
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
460
|
+
options.apply_defaults metadata: @config.metadata,
|
461
|
+
retry_policy: @config.retry_policy
|
462
|
+
|
463
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
464
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
465
|
+
yield response, operation if block_given?
|
466
|
+
return response
|
467
|
+
end
|
468
|
+
rescue ::GRPC::BadStatus => e
|
469
|
+
raise ::Google::Cloud::Error.from_error(e)
|
470
|
+
end
|
471
|
+
|
394
472
|
##
|
395
473
|
# Configuration class for the Operations API.
|
396
474
|
#
|
@@ -483,7 +561,7 @@ module Google
|
|
483
561
|
config_attr :scope, nil, ::String, ::Array, nil
|
484
562
|
config_attr :lib_name, nil, ::String, nil
|
485
563
|
config_attr :lib_version, nil, ::String, nil
|
486
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
564
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
487
565
|
config_attr :interceptors, nil, ::Array, nil
|
488
566
|
config_attr :timeout, nil, ::Numeric, nil
|
489
567
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -504,7 +582,7 @@ module Google
|
|
504
582
|
def rpcs
|
505
583
|
@rpcs ||= begin
|
506
584
|
parent_rpcs = nil
|
507
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
585
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
508
586
|
Rpcs.new parent_rpcs
|
509
587
|
end
|
510
588
|
end
|
@@ -516,7 +594,7 @@ module Google
|
|
516
594
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
517
595
|
# the following configuration fields:
|
518
596
|
#
|
519
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
597
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
520
598
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
521
599
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
522
600
|
# include the following keys:
|
@@ -547,17 +625,24 @@ module Google
|
|
547
625
|
# @return [::Gapic::Config::Method]
|
548
626
|
#
|
549
627
|
attr_reader :cancel_operation
|
628
|
+
##
|
629
|
+
# RPC-specific configuration for `wait_operation`
|
630
|
+
# @return [::Gapic::Config::Method]
|
631
|
+
#
|
632
|
+
attr_reader :wait_operation
|
550
633
|
|
551
634
|
# @private
|
552
635
|
def initialize parent_rpcs = nil
|
553
|
-
list_operations_config = parent_rpcs
|
636
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
554
637
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
555
|
-
get_operation_config = parent_rpcs
|
638
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
556
639
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
557
|
-
delete_operation_config = parent_rpcs
|
640
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
558
641
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
559
|
-
cancel_operation_config = parent_rpcs
|
642
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
560
643
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
644
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
645
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
561
646
|
|
562
647
|
yield self if block_given?
|
563
648
|
end
|