google-cloud-bigtable-admin-v2 0.2.0 → 0.5.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/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +1 -1
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +2 -2
- data/lib/google/bigtable/admin/v2/instance_pb.rb +5 -0
- data/lib/google/bigtable/admin/v2/table_pb.rb +16 -0
- data/lib/google/cloud/bigtable/admin/v2.rb +3 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/client.rb +69 -61
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/operations.rb +95 -10
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/paths.rb +21 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin/client.rb +84 -58
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin/operations.rb +95 -10
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin/paths.rb +23 -0
- data/lib/google/cloud/bigtable/admin/v2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/bigtable/admin/v2/bigtable_table_admin.rb +2 -2
- data/proto_docs/google/bigtable/admin/v2/instance.rb +21 -1
- data/proto_docs/google/bigtable/admin/v2/table.rb +58 -4
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +12 -9
@@ -63,6 +63,27 @@ module Google
|
|
63
63
|
"projects/#{project}/instances/#{instance}/clusters/#{cluster}"
|
64
64
|
end
|
65
65
|
|
66
|
+
##
|
67
|
+
# Create a fully-qualified CryptoKey resource string.
|
68
|
+
#
|
69
|
+
# The resource will be in the following format:
|
70
|
+
#
|
71
|
+
# `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`
|
72
|
+
#
|
73
|
+
# @param project [String]
|
74
|
+
# @param location [String]
|
75
|
+
# @param key_ring [String]
|
76
|
+
# @param crypto_key [String]
|
77
|
+
#
|
78
|
+
# @return [::String]
|
79
|
+
def crypto_key_path project:, location:, key_ring:, crypto_key:
|
80
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
81
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
82
|
+
raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
|
83
|
+
|
84
|
+
"projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}"
|
85
|
+
end
|
86
|
+
|
66
87
|
##
|
67
88
|
# Create a fully-qualified Instance resource string.
|
68
89
|
#
|
@@ -65,29 +65,27 @@ module Google
|
|
65
65
|
parent_config = while namespace.any?
|
66
66
|
parent_name = namespace.join "::"
|
67
67
|
parent_const = const_get parent_name
|
68
|
-
break parent_const.configure if parent_const
|
68
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
69
69
|
namespace.pop
|
70
70
|
end
|
71
71
|
default_config = Client::Configuration.new parent_config
|
72
72
|
|
73
73
|
default_config.rpcs.create_table.timeout = 300.0
|
74
74
|
|
75
|
-
default_config.rpcs.create_table_from_snapshot.timeout = 60.0
|
76
|
-
|
77
75
|
default_config.rpcs.list_tables.timeout = 60.0
|
78
76
|
default_config.rpcs.list_tables.retry_policy = {
|
79
77
|
initial_delay: 1.0,
|
80
|
-
max_delay:
|
81
|
-
multiplier:
|
82
|
-
retry_codes:
|
78
|
+
max_delay: 60.0,
|
79
|
+
multiplier: 2,
|
80
|
+
retry_codes: [14, 4]
|
83
81
|
}
|
84
82
|
|
85
83
|
default_config.rpcs.get_table.timeout = 60.0
|
86
84
|
default_config.rpcs.get_table.retry_policy = {
|
87
85
|
initial_delay: 1.0,
|
88
|
-
max_delay:
|
89
|
-
multiplier:
|
90
|
-
retry_codes:
|
86
|
+
max_delay: 60.0,
|
87
|
+
multiplier: 2,
|
88
|
+
retry_codes: [14, 4]
|
91
89
|
}
|
92
90
|
|
93
91
|
default_config.rpcs.delete_table.timeout = 60.0
|
@@ -99,45 +97,67 @@ module Google
|
|
99
97
|
default_config.rpcs.generate_consistency_token.timeout = 60.0
|
100
98
|
default_config.rpcs.generate_consistency_token.retry_policy = {
|
101
99
|
initial_delay: 1.0,
|
102
|
-
max_delay:
|
103
|
-
multiplier:
|
104
|
-
retry_codes:
|
100
|
+
max_delay: 60.0,
|
101
|
+
multiplier: 2,
|
102
|
+
retry_codes: [14, 4]
|
105
103
|
}
|
106
104
|
|
107
105
|
default_config.rpcs.check_consistency.timeout = 60.0
|
108
106
|
default_config.rpcs.check_consistency.retry_policy = {
|
109
107
|
initial_delay: 1.0,
|
110
|
-
max_delay:
|
111
|
-
multiplier:
|
112
|
-
retry_codes:
|
108
|
+
max_delay: 60.0,
|
109
|
+
multiplier: 2,
|
110
|
+
retry_codes: [14, 4]
|
113
111
|
}
|
114
112
|
|
115
|
-
default_config.rpcs.snapshot_table.timeout = 60.0
|
116
|
-
|
117
113
|
default_config.rpcs.get_snapshot.timeout = 60.0
|
118
114
|
default_config.rpcs.get_snapshot.retry_policy = {
|
119
115
|
initial_delay: 1.0,
|
120
|
-
max_delay:
|
121
|
-
multiplier:
|
122
|
-
retry_codes:
|
116
|
+
max_delay: 60.0,
|
117
|
+
multiplier: 2,
|
118
|
+
retry_codes: [14, 4]
|
123
119
|
}
|
124
120
|
|
125
121
|
default_config.rpcs.list_snapshots.timeout = 60.0
|
126
122
|
default_config.rpcs.list_snapshots.retry_policy = {
|
127
123
|
initial_delay: 1.0,
|
128
|
-
max_delay:
|
129
|
-
multiplier:
|
130
|
-
retry_codes:
|
124
|
+
max_delay: 60.0,
|
125
|
+
multiplier: 2,
|
126
|
+
retry_codes: [14, 4]
|
131
127
|
}
|
132
128
|
|
133
129
|
default_config.rpcs.delete_snapshot.timeout = 60.0
|
134
130
|
|
131
|
+
default_config.rpcs.create_backup.timeout = 60.0
|
132
|
+
|
133
|
+
default_config.rpcs.get_backup.timeout = 60.0
|
134
|
+
default_config.rpcs.get_backup.retry_policy = {
|
135
|
+
initial_delay: 1.0,
|
136
|
+
max_delay: 60.0,
|
137
|
+
multiplier: 2,
|
138
|
+
retry_codes: [14, 4]
|
139
|
+
}
|
140
|
+
|
141
|
+
default_config.rpcs.update_backup.timeout = 60.0
|
142
|
+
|
143
|
+
default_config.rpcs.delete_backup.timeout = 60.0
|
144
|
+
|
145
|
+
default_config.rpcs.list_backups.timeout = 60.0
|
146
|
+
default_config.rpcs.list_backups.retry_policy = {
|
147
|
+
initial_delay: 1.0,
|
148
|
+
max_delay: 60.0,
|
149
|
+
multiplier: 2,
|
150
|
+
retry_codes: [14, 4]
|
151
|
+
}
|
152
|
+
|
153
|
+
default_config.rpcs.restore_table.timeout = 60.0
|
154
|
+
|
135
155
|
default_config.rpcs.get_iam_policy.timeout = 60.0
|
136
156
|
default_config.rpcs.get_iam_policy.retry_policy = {
|
137
157
|
initial_delay: 1.0,
|
138
|
-
max_delay:
|
139
|
-
multiplier:
|
140
|
-
retry_codes:
|
158
|
+
max_delay: 60.0,
|
159
|
+
multiplier: 2,
|
160
|
+
retry_codes: [14, 4]
|
141
161
|
}
|
142
162
|
|
143
163
|
default_config.rpcs.set_iam_policy.timeout = 60.0
|
@@ -145,9 +165,9 @@ module Google
|
|
145
165
|
default_config.rpcs.test_iam_permissions.timeout = 60.0
|
146
166
|
default_config.rpcs.test_iam_permissions.retry_policy = {
|
147
167
|
initial_delay: 1.0,
|
148
|
-
max_delay:
|
149
|
-
multiplier:
|
150
|
-
retry_codes:
|
168
|
+
max_delay: 60.0,
|
169
|
+
multiplier: 2,
|
170
|
+
retry_codes: [14, 4]
|
151
171
|
}
|
152
172
|
|
153
173
|
default_config
|
@@ -211,7 +231,13 @@ module Google
|
|
211
231
|
|
212
232
|
# Create credentials
|
213
233
|
credentials = @config.credentials
|
214
|
-
|
234
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
235
|
+
# but only if the default endpoint does not have a region prefix.
|
236
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
237
|
+
@config.endpoint == Client.configure.endpoint &&
|
238
|
+
!@config.endpoint.split(".").first.include?("-")
|
239
|
+
credentials ||= Credentials.default scope: @config.scope,
|
240
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
215
241
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
216
242
|
credentials = Credentials.new credentials, scope: @config.scope
|
217
243
|
end
|
@@ -1685,7 +1711,7 @@ module Google
|
|
1685
1711
|
|
1686
1712
|
##
|
1687
1713
|
# Create a new table by restoring from a completed backup. The new table
|
1688
|
-
# must be in the same
|
1714
|
+
# must be in the same project as the instance containing the backup. The
|
1689
1715
|
# returned table {::Google::Longrunning::Operation long-running operation} can
|
1690
1716
|
# be used to track the progress of the operation, and to cancel it. The
|
1691
1717
|
# {::Google::Longrunning::Operation#metadata metadata} field type is
|
@@ -1710,8 +1736,8 @@ module Google
|
|
1710
1736
|
#
|
1711
1737
|
# @param parent [::String]
|
1712
1738
|
# Required. The name of the instance in which to create the restored
|
1713
|
-
# table. This instance must be the
|
1714
|
-
# of the form `projects/<project>/instances/<instance>`.
|
1739
|
+
# table. This instance must be in the same project as the source backup.
|
1740
|
+
# Values are of the form `projects/<project>/instances/<instance>`.
|
1715
1741
|
# @param table_id [::String]
|
1716
1742
|
# Required. The id of the table to create and restore to. This
|
1717
1743
|
# table must not already exist. The `table_id` appended to
|
@@ -2076,7 +2102,7 @@ module Google
|
|
2076
2102
|
config_attr :scope, nil, ::String, ::Array, nil
|
2077
2103
|
config_attr :lib_name, nil, ::String, nil
|
2078
2104
|
config_attr :lib_version, nil, ::String, nil
|
2079
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
2105
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
2080
2106
|
config_attr :interceptors, nil, ::Array, nil
|
2081
2107
|
config_attr :timeout, nil, ::Numeric, nil
|
2082
2108
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -2097,7 +2123,7 @@ module Google
|
|
2097
2123
|
def rpcs
|
2098
2124
|
@rpcs ||= begin
|
2099
2125
|
parent_rpcs = nil
|
2100
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
2126
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
2101
2127
|
Rpcs.new parent_rpcs
|
2102
2128
|
end
|
2103
2129
|
end
|
@@ -2109,7 +2135,7 @@ module Google
|
|
2109
2135
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
2110
2136
|
# the following configuration fields:
|
2111
2137
|
#
|
2112
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
2138
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
2113
2139
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
2114
2140
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
2115
2141
|
# include the following keys:
|
@@ -2233,49 +2259,49 @@ module Google
|
|
2233
2259
|
|
2234
2260
|
# @private
|
2235
2261
|
def initialize parent_rpcs = nil
|
2236
|
-
create_table_config = parent_rpcs
|
2262
|
+
create_table_config = parent_rpcs.create_table if parent_rpcs.respond_to? :create_table
|
2237
2263
|
@create_table = ::Gapic::Config::Method.new create_table_config
|
2238
|
-
create_table_from_snapshot_config = parent_rpcs
|
2264
|
+
create_table_from_snapshot_config = parent_rpcs.create_table_from_snapshot if parent_rpcs.respond_to? :create_table_from_snapshot
|
2239
2265
|
@create_table_from_snapshot = ::Gapic::Config::Method.new create_table_from_snapshot_config
|
2240
|
-
list_tables_config = parent_rpcs
|
2266
|
+
list_tables_config = parent_rpcs.list_tables if parent_rpcs.respond_to? :list_tables
|
2241
2267
|
@list_tables = ::Gapic::Config::Method.new list_tables_config
|
2242
|
-
get_table_config = parent_rpcs
|
2268
|
+
get_table_config = parent_rpcs.get_table if parent_rpcs.respond_to? :get_table
|
2243
2269
|
@get_table = ::Gapic::Config::Method.new get_table_config
|
2244
|
-
delete_table_config = parent_rpcs
|
2270
|
+
delete_table_config = parent_rpcs.delete_table if parent_rpcs.respond_to? :delete_table
|
2245
2271
|
@delete_table = ::Gapic::Config::Method.new delete_table_config
|
2246
|
-
modify_column_families_config = parent_rpcs
|
2272
|
+
modify_column_families_config = parent_rpcs.modify_column_families if parent_rpcs.respond_to? :modify_column_families
|
2247
2273
|
@modify_column_families = ::Gapic::Config::Method.new modify_column_families_config
|
2248
|
-
drop_row_range_config = parent_rpcs
|
2274
|
+
drop_row_range_config = parent_rpcs.drop_row_range if parent_rpcs.respond_to? :drop_row_range
|
2249
2275
|
@drop_row_range = ::Gapic::Config::Method.new drop_row_range_config
|
2250
|
-
generate_consistency_token_config = parent_rpcs
|
2276
|
+
generate_consistency_token_config = parent_rpcs.generate_consistency_token if parent_rpcs.respond_to? :generate_consistency_token
|
2251
2277
|
@generate_consistency_token = ::Gapic::Config::Method.new generate_consistency_token_config
|
2252
|
-
check_consistency_config = parent_rpcs
|
2278
|
+
check_consistency_config = parent_rpcs.check_consistency if parent_rpcs.respond_to? :check_consistency
|
2253
2279
|
@check_consistency = ::Gapic::Config::Method.new check_consistency_config
|
2254
|
-
snapshot_table_config = parent_rpcs
|
2280
|
+
snapshot_table_config = parent_rpcs.snapshot_table if parent_rpcs.respond_to? :snapshot_table
|
2255
2281
|
@snapshot_table = ::Gapic::Config::Method.new snapshot_table_config
|
2256
|
-
get_snapshot_config = parent_rpcs
|
2282
|
+
get_snapshot_config = parent_rpcs.get_snapshot if parent_rpcs.respond_to? :get_snapshot
|
2257
2283
|
@get_snapshot = ::Gapic::Config::Method.new get_snapshot_config
|
2258
|
-
list_snapshots_config = parent_rpcs
|
2284
|
+
list_snapshots_config = parent_rpcs.list_snapshots if parent_rpcs.respond_to? :list_snapshots
|
2259
2285
|
@list_snapshots = ::Gapic::Config::Method.new list_snapshots_config
|
2260
|
-
delete_snapshot_config = parent_rpcs
|
2286
|
+
delete_snapshot_config = parent_rpcs.delete_snapshot if parent_rpcs.respond_to? :delete_snapshot
|
2261
2287
|
@delete_snapshot = ::Gapic::Config::Method.new delete_snapshot_config
|
2262
|
-
create_backup_config = parent_rpcs
|
2288
|
+
create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
|
2263
2289
|
@create_backup = ::Gapic::Config::Method.new create_backup_config
|
2264
|
-
get_backup_config = parent_rpcs
|
2290
|
+
get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
|
2265
2291
|
@get_backup = ::Gapic::Config::Method.new get_backup_config
|
2266
|
-
update_backup_config = parent_rpcs
|
2292
|
+
update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
|
2267
2293
|
@update_backup = ::Gapic::Config::Method.new update_backup_config
|
2268
|
-
delete_backup_config = parent_rpcs
|
2294
|
+
delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
|
2269
2295
|
@delete_backup = ::Gapic::Config::Method.new delete_backup_config
|
2270
|
-
list_backups_config = parent_rpcs
|
2296
|
+
list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
|
2271
2297
|
@list_backups = ::Gapic::Config::Method.new list_backups_config
|
2272
|
-
restore_table_config = parent_rpcs
|
2298
|
+
restore_table_config = parent_rpcs.restore_table if parent_rpcs.respond_to? :restore_table
|
2273
2299
|
@restore_table = ::Gapic::Config::Method.new restore_table_config
|
2274
|
-
get_iam_policy_config = parent_rpcs
|
2300
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
2275
2301
|
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
2276
|
-
set_iam_policy_config = parent_rpcs
|
2302
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
2277
2303
|
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
2278
|
-
test_iam_permissions_config = parent_rpcs
|
2304
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
2279
2305
|
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
2280
2306
|
|
2281
2307
|
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::Bigtable::Admin::V2::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
|