google-cloud-memcache-v1beta2 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/memcache/v1beta2.rb +3 -0
- data/lib/google/cloud/memcache/v1beta2/cloud_memcache.rb +1 -1
- data/lib/google/cloud/memcache/v1beta2/cloud_memcache/client.rb +124 -32
- data/lib/google/cloud/memcache/v1beta2/cloud_memcache/operations.rb +96 -11
- data/lib/google/cloud/memcache/v1beta2/cloud_memcache_pb.rb +8 -0
- data/lib/google/cloud/memcache/v1beta2/cloud_memcache_services_pb.rb +18 -16
- data/lib/google/cloud/memcache/v1beta2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/memcache/v1beta2/cloud_memcache.rb +72 -45
- 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 +12 -9
@@ -45,7 +45,7 @@ module Google
|
|
45
45
|
# * As such, Memcached instances are resources of the form:
|
46
46
|
# `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
47
47
|
#
|
48
|
-
# Note that location_id must be
|
48
|
+
# Note that location_id must be a GCP `region`; for example:
|
49
49
|
# * `projects/my-memcached-project/locations/us-central1/instances/my-memcached`
|
50
50
|
#
|
51
51
|
# To load this service and instantiate a client:
|
@@ -40,7 +40,7 @@ module Google
|
|
40
40
|
# * As such, Memcached instances are resources of the form:
|
41
41
|
# `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
42
42
|
#
|
43
|
-
# Note that location_id must be
|
43
|
+
# Note that location_id must be a GCP `region`; for example:
|
44
44
|
# * `projects/my-memcached-project/locations/us-central1/instances/my-memcached`
|
45
45
|
#
|
46
46
|
class Client
|
@@ -74,7 +74,7 @@ module Google
|
|
74
74
|
parent_config = while namespace.any?
|
75
75
|
parent_name = namespace.join "::"
|
76
76
|
parent_const = const_get parent_name
|
77
|
-
break parent_const.configure if parent_const
|
77
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
78
78
|
namespace.pop
|
79
79
|
end
|
80
80
|
default_config = Client::Configuration.new parent_config
|
@@ -93,6 +93,8 @@ module Google
|
|
93
93
|
|
94
94
|
default_config.rpcs.apply_parameters.timeout = 1200.0
|
95
95
|
|
96
|
+
default_config.rpcs.apply_software_update.timeout = 1200.0
|
97
|
+
|
96
98
|
default_config
|
97
99
|
end
|
98
100
|
yield @configure if block_given?
|
@@ -154,7 +156,13 @@ module Google
|
|
154
156
|
|
155
157
|
# Create credentials
|
156
158
|
credentials = @config.credentials
|
157
|
-
|
159
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
160
|
+
# but only if the default endpoint does not have a region prefix.
|
161
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
162
|
+
@config.endpoint == Client.configure.endpoint &&
|
163
|
+
!@config.endpoint.split(".").first.include?("-")
|
164
|
+
credentials ||= Credentials.default scope: @config.scope,
|
165
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
158
166
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
159
167
|
credentials = Credentials.new credentials, scope: @config.scope
|
160
168
|
end
|
@@ -185,7 +193,7 @@ module Google
|
|
185
193
|
# Service calls
|
186
194
|
|
187
195
|
##
|
188
|
-
# Lists Instances in a given
|
196
|
+
# Lists Instances in a given location.
|
189
197
|
#
|
190
198
|
# @overload list_instances(request, options = nil)
|
191
199
|
# Pass arguments to `list_instances` via a request object, either of type
|
@@ -210,16 +218,15 @@ module Google
|
|
210
218
|
# The maximum number of items to return.
|
211
219
|
#
|
212
220
|
# If not specified, a default value of 1000 will be used by the service.
|
213
|
-
# Regardless of the page_size value, the response may include a partial
|
214
|
-
# and a caller should only rely on response's
|
215
|
-
#
|
221
|
+
# Regardless of the `page_size` value, the response may include a partial
|
222
|
+
# list and a caller should only rely on response's
|
223
|
+
# {::Google::Cloud::Memcache::V1beta2::ListInstancesResponse#next_page_token `next_page_token`}
|
216
224
|
# to determine if there are more instances left to be queried.
|
217
225
|
# @param page_token [::String]
|
218
|
-
# The next_page_token value returned from a previous List request,
|
219
|
-
# if any.
|
226
|
+
# The `next_page_token` value returned from a previous List request, if any.
|
220
227
|
# @param filter [::String]
|
221
228
|
# List filter. For example, exclude all Memcached instances with name as
|
222
|
-
# my-instance by specifying "name != my-instance"
|
229
|
+
# my-instance by specifying `"name != my-instance"`.
|
223
230
|
# @param order_by [::String]
|
224
231
|
# Sort results. Supported values are "name", "name desc" or "" (unsorted).
|
225
232
|
#
|
@@ -338,7 +345,7 @@ module Google
|
|
338
345
|
end
|
339
346
|
|
340
347
|
##
|
341
|
-
# Creates a new Instance in a given
|
348
|
+
# Creates a new Instance in a given location.
|
342
349
|
#
|
343
350
|
# @overload create_instance(request, options = nil)
|
344
351
|
# Pass arguments to `create_instance` via a request object, either of type
|
@@ -367,7 +374,9 @@ module Google
|
|
367
374
|
# * Must start with a letter.
|
368
375
|
# * Must be between 1-40 characters.
|
369
376
|
# * Must end with a number or a letter.
|
370
|
-
# * Must be unique within the user project / location
|
377
|
+
# * Must be unique within the user project / location.
|
378
|
+
#
|
379
|
+
# If any of the above are not met, the API raises an invalid argument error.
|
371
380
|
# @param resource [::Google::Cloud::Memcache::V1beta2::Instance, ::Hash]
|
372
381
|
# Required. A Memcached [Instance] resource
|
373
382
|
#
|
@@ -437,7 +446,7 @@ module Google
|
|
437
446
|
#
|
438
447
|
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
439
448
|
# Required. Mask of fields to update.
|
440
|
-
# *
|
449
|
+
# * `displayName`
|
441
450
|
# @param resource [::Google::Cloud::Memcache::V1beta2::Instance, ::Hash]
|
442
451
|
# Required. A Memcached [Instance] resource.
|
443
452
|
# Only fields specified in update_mask are updated.
|
@@ -489,9 +498,10 @@ module Google
|
|
489
498
|
end
|
490
499
|
|
491
500
|
##
|
492
|
-
# Updates the defined Memcached
|
501
|
+
# Updates the defined Memcached parameters for an existing instance.
|
493
502
|
# This method only stages the parameters, it must be followed by
|
494
|
-
# ApplyParameters to apply the parameters to nodes of the Memcached
|
503
|
+
# `ApplyParameters` to apply the parameters to nodes of the Memcached
|
504
|
+
# instance.
|
495
505
|
#
|
496
506
|
# @overload update_parameters(request, options = nil)
|
497
507
|
# Pass arguments to `update_parameters` via a request object, either of type
|
@@ -581,7 +591,7 @@ module Google
|
|
581
591
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
582
592
|
#
|
583
593
|
# @param name [::String]
|
584
|
-
# Memcached instance resource name in the format:
|
594
|
+
# Required. Memcached instance resource name in the format:
|
585
595
|
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
|
586
596
|
# where `location_id` refers to a GCP region
|
587
597
|
#
|
@@ -632,8 +642,8 @@ module Google
|
|
632
642
|
end
|
633
643
|
|
634
644
|
##
|
635
|
-
# ApplyParameters
|
636
|
-
#
|
645
|
+
# `ApplyParameters` restarts the set of specified nodes in order to update
|
646
|
+
# them to the current set of parameters for the Memcached Instance.
|
637
647
|
#
|
638
648
|
# @overload apply_parameters(request, options = nil)
|
639
649
|
# Pass arguments to `apply_parameters` via a request object, either of type
|
@@ -654,11 +664,11 @@ module Google
|
|
654
664
|
# Required. Resource name of the Memcached instance for which parameter group updates
|
655
665
|
# should be applied.
|
656
666
|
# @param node_ids [::Array<::String>]
|
657
|
-
# Nodes to which
|
667
|
+
# Nodes to which the instance-level parameter group is applied.
|
658
668
|
# @param apply_all [::Boolean]
|
659
669
|
# Whether to apply instance-level parameter group to all nodes. If set to
|
660
|
-
# true,
|
661
|
-
#
|
670
|
+
# true, users are restricted from specifying individual nodes, and
|
671
|
+
# `ApplyParameters` updates all nodes within the instance.
|
662
672
|
#
|
663
673
|
# @yield [response, operation] Access the result along with the RPC operation
|
664
674
|
# @yieldparam response [::Gapic::Operation]
|
@@ -706,6 +716,81 @@ module Google
|
|
706
716
|
raise ::Google::Cloud::Error.from_error(e)
|
707
717
|
end
|
708
718
|
|
719
|
+
##
|
720
|
+
# Updates software on the selected nodes of the Instance.
|
721
|
+
#
|
722
|
+
# @overload apply_software_update(request, options = nil)
|
723
|
+
# Pass arguments to `apply_software_update` via a request object, either of type
|
724
|
+
# {::Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest} or an equivalent Hash.
|
725
|
+
#
|
726
|
+
# @param request [::Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest, ::Hash]
|
727
|
+
# A request object representing the call parameters. Required. To specify no
|
728
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
729
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
730
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
731
|
+
#
|
732
|
+
# @overload apply_software_update(instance: nil, node_ids: nil, apply_all: nil)
|
733
|
+
# Pass arguments to `apply_software_update` via keyword arguments. Note that at
|
734
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
735
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
736
|
+
#
|
737
|
+
# @param instance [::String]
|
738
|
+
# Required. Resource name of the Memcached instance for which software update should be
|
739
|
+
# applied.
|
740
|
+
# @param node_ids [::Array<::String>]
|
741
|
+
# Nodes to which we should apply the update to. Note all the selected nodes
|
742
|
+
# are updated in parallel.
|
743
|
+
# @param apply_all [::Boolean]
|
744
|
+
# Whether to apply the update to all nodes. If set to
|
745
|
+
# true, will explicitly restrict users from specifying any nodes, and apply
|
746
|
+
# software update to all nodes (where applicable) within the instance.
|
747
|
+
#
|
748
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
749
|
+
# @yieldparam response [::Gapic::Operation]
|
750
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
751
|
+
#
|
752
|
+
# @return [::Gapic::Operation]
|
753
|
+
#
|
754
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
755
|
+
#
|
756
|
+
def apply_software_update request, options = nil
|
757
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
758
|
+
|
759
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest
|
760
|
+
|
761
|
+
# Converts hash and nil to an options object
|
762
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
763
|
+
|
764
|
+
# Customize the options with defaults
|
765
|
+
metadata = @config.rpcs.apply_software_update.metadata.to_h
|
766
|
+
|
767
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
768
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
769
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
770
|
+
gapic_version: ::Google::Cloud::Memcache::V1beta2::VERSION
|
771
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
772
|
+
|
773
|
+
header_params = {
|
774
|
+
"instance" => request.instance
|
775
|
+
}
|
776
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
777
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
778
|
+
|
779
|
+
options.apply_defaults timeout: @config.rpcs.apply_software_update.timeout,
|
780
|
+
metadata: metadata,
|
781
|
+
retry_policy: @config.rpcs.apply_software_update.retry_policy
|
782
|
+
options.apply_defaults metadata: @config.metadata,
|
783
|
+
retry_policy: @config.retry_policy
|
784
|
+
|
785
|
+
@cloud_memcache_stub.call_rpc :apply_software_update, request, options: options do |response, operation|
|
786
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
787
|
+
yield response, operation if block_given?
|
788
|
+
return response
|
789
|
+
end
|
790
|
+
rescue ::GRPC::BadStatus => e
|
791
|
+
raise ::Google::Cloud::Error.from_error(e)
|
792
|
+
end
|
793
|
+
|
709
794
|
##
|
710
795
|
# Configuration class for the CloudMemcache API.
|
711
796
|
#
|
@@ -791,14 +876,14 @@ module Google
|
|
791
876
|
|
792
877
|
config_attr :endpoint, "memcache.googleapis.com", ::String
|
793
878
|
config_attr :credentials, nil do |value|
|
794
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
879
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
795
880
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
796
881
|
allowed.any? { |klass| klass === value }
|
797
882
|
end
|
798
883
|
config_attr :scope, nil, ::String, ::Array, nil
|
799
884
|
config_attr :lib_name, nil, ::String, nil
|
800
885
|
config_attr :lib_version, nil, ::String, nil
|
801
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
886
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
802
887
|
config_attr :interceptors, nil, ::Array, nil
|
803
888
|
config_attr :timeout, nil, ::Numeric, nil
|
804
889
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -819,7 +904,7 @@ module Google
|
|
819
904
|
def rpcs
|
820
905
|
@rpcs ||= begin
|
821
906
|
parent_rpcs = nil
|
822
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
907
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
823
908
|
Rpcs.new parent_rpcs
|
824
909
|
end
|
825
910
|
end
|
@@ -831,7 +916,7 @@ module Google
|
|
831
916
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
832
917
|
# the following configuration fields:
|
833
918
|
#
|
834
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
919
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
835
920
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
836
921
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
837
922
|
# include the following keys:
|
@@ -877,23 +962,30 @@ module Google
|
|
877
962
|
# @return [::Gapic::Config::Method]
|
878
963
|
#
|
879
964
|
attr_reader :apply_parameters
|
965
|
+
##
|
966
|
+
# RPC-specific configuration for `apply_software_update`
|
967
|
+
# @return [::Gapic::Config::Method]
|
968
|
+
#
|
969
|
+
attr_reader :apply_software_update
|
880
970
|
|
881
971
|
# @private
|
882
972
|
def initialize parent_rpcs = nil
|
883
|
-
list_instances_config = parent_rpcs
|
973
|
+
list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
|
884
974
|
@list_instances = ::Gapic::Config::Method.new list_instances_config
|
885
|
-
get_instance_config = parent_rpcs
|
975
|
+
get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
|
886
976
|
@get_instance = ::Gapic::Config::Method.new get_instance_config
|
887
|
-
create_instance_config = parent_rpcs
|
977
|
+
create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
|
888
978
|
@create_instance = ::Gapic::Config::Method.new create_instance_config
|
889
|
-
update_instance_config = parent_rpcs
|
979
|
+
update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
|
890
980
|
@update_instance = ::Gapic::Config::Method.new update_instance_config
|
891
|
-
update_parameters_config = parent_rpcs
|
981
|
+
update_parameters_config = parent_rpcs.update_parameters if parent_rpcs.respond_to? :update_parameters
|
892
982
|
@update_parameters = ::Gapic::Config::Method.new update_parameters_config
|
893
|
-
delete_instance_config = parent_rpcs
|
983
|
+
delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
|
894
984
|
@delete_instance = ::Gapic::Config::Method.new delete_instance_config
|
895
|
-
apply_parameters_config = parent_rpcs
|
985
|
+
apply_parameters_config = parent_rpcs.apply_parameters if parent_rpcs.respond_to? :apply_parameters
|
896
986
|
@apply_parameters = ::Gapic::Config::Method.new apply_parameters_config
|
987
|
+
apply_software_update_config = parent_rpcs.apply_software_update if parent_rpcs.respond_to? :apply_software_update
|
988
|
+
@apply_software_update = ::Gapic::Config::Method.new apply_software_update_config
|
897
989
|
|
898
990
|
yield self if block_given?
|
899
991
|
end
|
@@ -103,8 +103,13 @@ module Google
|
|
103
103
|
# Lists operations that match the specified filter in the request. If the
|
104
104
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
105
105
|
#
|
106
|
-
# NOTE: the `name` binding
|
107
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
106
|
+
# NOTE: the `name` binding allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
108
|
+
# override the binding, API services can add a binding such as
|
109
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
110
|
+
# For backwards compatibility, the default name includes the operations
|
111
|
+
# collection id, however overriding users must ensure the name binding
|
112
|
+
# is the parent resource, without the operations collection id.
|
108
113
|
#
|
109
114
|
# @overload list_operations(request, options = nil)
|
110
115
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -122,7 +127,7 @@ module Google
|
|
122
127
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
123
128
|
#
|
124
129
|
# @param name [::String]
|
125
|
-
# The name of the operation
|
130
|
+
# The name of the operation's parent resource.
|
126
131
|
# @param filter [::String]
|
127
132
|
# The standard list filter.
|
128
133
|
# @param page_size [::Integer]
|
@@ -390,6 +395,79 @@ module Google
|
|
390
395
|
raise ::Google::Cloud::Error.from_error(e)
|
391
396
|
end
|
392
397
|
|
398
|
+
##
|
399
|
+
# Waits for the specified long-running operation until it is done or reaches
|
400
|
+
# at most a specified timeout, returning the latest state. If the operation
|
401
|
+
# is already done, the latest state is immediately returned. If the timeout
|
402
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
|
+
# timeout is used. If the server does not support this method, it returns
|
404
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
405
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
406
|
+
# state before the specified timeout (including immediately), meaning even an
|
407
|
+
# immediate response is no guarantee that the operation is done.
|
408
|
+
#
|
409
|
+
# @overload wait_operation(request, options = nil)
|
410
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
411
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
414
|
+
# A request object representing the call parameters. Required. To specify no
|
415
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
416
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
417
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
418
|
+
#
|
419
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
420
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
421
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
422
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
423
|
+
#
|
424
|
+
# @param name [::String]
|
425
|
+
# The name of the operation resource to wait on.
|
426
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
427
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
428
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
429
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
430
|
+
#
|
431
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam response [::Gapic::Operation]
|
433
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
434
|
+
#
|
435
|
+
# @return [::Gapic::Operation]
|
436
|
+
#
|
437
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
|
+
#
|
439
|
+
def wait_operation request, options = nil
|
440
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
|
+
|
442
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
443
|
+
|
444
|
+
# Converts hash and nil to an options object
|
445
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
446
|
+
|
447
|
+
# Customize the options with defaults
|
448
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
449
|
+
|
450
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
451
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
452
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
453
|
+
gapic_version: ::Google::Cloud::Memcache::V1beta2::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -475,14 +553,14 @@ module Google
|
|
475
553
|
|
476
554
|
config_attr :endpoint, "memcache.googleapis.com", ::String
|
477
555
|
config_attr :credentials, nil do |value|
|
478
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
556
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
479
557
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
480
558
|
allowed.any? { |klass| klass === value }
|
481
559
|
end
|
482
560
|
config_attr :scope, nil, ::String, ::Array, nil
|
483
561
|
config_attr :lib_name, nil, ::String, nil
|
484
562
|
config_attr :lib_version, nil, ::String, nil
|
485
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
486
564
|
config_attr :interceptors, nil, ::Array, nil
|
487
565
|
config_attr :timeout, nil, ::Numeric, nil
|
488
566
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -503,7 +581,7 @@ module Google
|
|
503
581
|
def rpcs
|
504
582
|
@rpcs ||= begin
|
505
583
|
parent_rpcs = nil
|
506
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
585
|
Rpcs.new parent_rpcs
|
508
586
|
end
|
509
587
|
end
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,17 +624,24 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
552
|
-
list_operations_config = parent_rpcs
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
553
636
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
-
get_operation_config = parent_rpcs
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
555
638
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
-
delete_operation_config = parent_rpcs
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
-
cancel_operation_config = parent_rpcs
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|