google-cloud-firestore-v1 2.2.1 → 2.4.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/README.md +1 -1
- data/lib/google/cloud/firestore/v1/firestore/client.rb +146 -4
- data/lib/google/cloud/firestore/v1/firestore/rest/client.rb +132 -4
- data/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb +56 -0
- data/lib/google/cloud/firestore/v1/version.rb +1 -1
- data/lib/google/firestore/v1/aggregation_result_pb.rb +2 -24
- data/lib/google/firestore/v1/bloom_filter_pb.rb +2 -23
- data/lib/google/firestore/v1/common_pb.rb +5 -25
- data/lib/google/firestore/v1/document_pb.rb +6 -26
- data/lib/google/firestore/v1/explain_stats_pb.rb +23 -0
- data/lib/google/firestore/v1/firestore_pb.rb +7 -33
- data/lib/google/firestore/v1/firestore_services_pb.rb +2 -0
- data/lib/google/firestore/v1/pipeline_pb.rb +24 -0
- data/lib/google/firestore/v1/query_pb.rb +2 -25
- data/lib/google/firestore/v1/query_profile_pb.rb +2 -25
- data/lib/google/firestore/v1/write_pb.rb +2 -27
- data/proto_docs/google/api/client.rb +149 -29
- data/proto_docs/google/api/routing.rb +7 -3
- data/proto_docs/google/firestore/v1/common.rb +22 -3
- data/proto_docs/google/firestore/v1/document.rb +143 -11
- data/proto_docs/google/firestore/v1/explain_stats.rb +41 -0
- data/proto_docs/google/firestore/v1/firestore.rb +95 -1
- data/proto_docs/google/firestore/v1/pipeline.rb +51 -0
- data/proto_docs/google/firestore/v1/query.rb +15 -5
- data/proto_docs/google/protobuf/wrappers.rb +27 -0
- data/proto_docs/google/type/latlng.rb +3 -3
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e093e52014138cbe0d41965e8b447c1550db10456bcb90bf2b20b810f9ac9a3c
|
|
4
|
+
data.tar.gz: 2d9f6cabce314792281aa78db89d7d11d9c2d2043245911f64e405711c9d39ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa89d63bbae003c47dc13750ad1b449f597c6694dd90795226194563d33103ecafe9d695667de371878617d9d1b263aeea513e2e256f3f2aaa6fa3c7717c966c
|
|
7
|
+
data.tar.gz: 7388a57edc18cdab5ded1b84c85fa1a3e009bb6586ee0d8980d12d755763dd1aba36da0b89858148cf890059f9c734b0378ce799c0d0114bd5caa53216f6f1b3
|
data/README.md
CHANGED
|
@@ -86,7 +86,7 @@ To browse ready to use code samples check [Google Cloud Samples](https://cloud.g
|
|
|
86
86
|
|
|
87
87
|
## Supported Ruby Versions
|
|
88
88
|
|
|
89
|
-
This library is supported on Ruby 3.
|
|
89
|
+
This library is supported on Ruby 3.2+.
|
|
90
90
|
|
|
91
91
|
Google provides official support for Ruby versions that are actively supported
|
|
92
92
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
@@ -98,7 +98,7 @@ module Google
|
|
|
98
98
|
|
|
99
99
|
default_config.rpcs.batch_get_documents.timeout = 300.0
|
|
100
100
|
default_config.rpcs.batch_get_documents.retry_policy = {
|
|
101
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
101
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
default_config.rpcs.begin_transaction.timeout = 60.0
|
|
@@ -118,17 +118,22 @@ module Google
|
|
|
118
118
|
|
|
119
119
|
default_config.rpcs.run_query.timeout = 300.0
|
|
120
120
|
default_config.rpcs.run_query.retry_policy = {
|
|
121
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
121
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
default_config.rpcs.execute_pipeline.timeout = 300.0
|
|
125
|
+
default_config.rpcs.execute_pipeline.retry_policy = {
|
|
126
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13]
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
default_config.rpcs.run_aggregation_query.timeout = 300.0
|
|
125
130
|
default_config.rpcs.run_aggregation_query.retry_policy = {
|
|
126
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
131
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
default_config.rpcs.partition_query.timeout = 300.0
|
|
130
135
|
default_config.rpcs.partition_query.retry_policy = {
|
|
131
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
136
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
default_config.rpcs.write.timeout = 86_400.0
|
|
@@ -1236,6 +1241,131 @@ module Google
|
|
|
1236
1241
|
raise ::Google::Cloud::Error.from_error(e)
|
|
1237
1242
|
end
|
|
1238
1243
|
|
|
1244
|
+
##
|
|
1245
|
+
# Executes a pipeline query.
|
|
1246
|
+
#
|
|
1247
|
+
# @overload execute_pipeline(request, options = nil)
|
|
1248
|
+
# Pass arguments to `execute_pipeline` via a request object, either of type
|
|
1249
|
+
# {::Google::Cloud::Firestore::V1::ExecutePipelineRequest} or an equivalent Hash.
|
|
1250
|
+
#
|
|
1251
|
+
# @param request [::Google::Cloud::Firestore::V1::ExecutePipelineRequest, ::Hash]
|
|
1252
|
+
# A request object representing the call parameters. Required. To specify no
|
|
1253
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
1254
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
1255
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
1256
|
+
#
|
|
1257
|
+
# @overload execute_pipeline(database: nil, structured_pipeline: nil, transaction: nil, new_transaction: nil, read_time: nil, auto_commit_transaction: nil)
|
|
1258
|
+
# Pass arguments to `execute_pipeline` via keyword arguments. Note that at
|
|
1259
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
1260
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
1261
|
+
#
|
|
1262
|
+
# @param database [::String]
|
|
1263
|
+
# Required. Database identifier, in the form
|
|
1264
|
+
# `projects/{project}/databases/{database}`.
|
|
1265
|
+
# @param structured_pipeline [::Google::Cloud::Firestore::V1::StructuredPipeline, ::Hash]
|
|
1266
|
+
# A pipelined operation.
|
|
1267
|
+
# @param transaction [::String]
|
|
1268
|
+
# Run the query within an already active transaction.
|
|
1269
|
+
#
|
|
1270
|
+
# The value here is the opaque transaction ID to execute the query in.
|
|
1271
|
+
#
|
|
1272
|
+
# Note: The following parameters are mutually exclusive: `transaction`, `new_transaction`, `read_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
|
|
1273
|
+
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
|
1274
|
+
# Execute the pipeline in a new transaction.
|
|
1275
|
+
#
|
|
1276
|
+
# The identifier of the newly created transaction will be returned in the
|
|
1277
|
+
# first response on the stream. This defaults to a read-only transaction.
|
|
1278
|
+
#
|
|
1279
|
+
# Note: The following parameters are mutually exclusive: `new_transaction`, `transaction`, `read_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
|
|
1280
|
+
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
|
1281
|
+
# Execute the pipeline in a snapshot transaction at the given time.
|
|
1282
|
+
#
|
|
1283
|
+
# This must be a microsecond precision timestamp within the past one hour,
|
|
1284
|
+
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
|
1285
|
+
# minute timestamp within the past 7 days.
|
|
1286
|
+
#
|
|
1287
|
+
# Note: The following parameters are mutually exclusive: `read_time`, `transaction`, `new_transaction`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
|
|
1288
|
+
# @param auto_commit_transaction [::Boolean]
|
|
1289
|
+
# Optional. Automatically commits the transaction after the pipeline has been
|
|
1290
|
+
# executed. Only permitted in combination with `transaction` or
|
|
1291
|
+
# `new_transaction`.
|
|
1292
|
+
#
|
|
1293
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
1294
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Firestore::V1::ExecutePipelineResponse>]
|
|
1295
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
1296
|
+
#
|
|
1297
|
+
# @return [::Enumerable<::Google::Cloud::Firestore::V1::ExecutePipelineResponse>]
|
|
1298
|
+
#
|
|
1299
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
1300
|
+
#
|
|
1301
|
+
# @example Basic example
|
|
1302
|
+
# require "google/cloud/firestore/v1"
|
|
1303
|
+
#
|
|
1304
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
1305
|
+
# client = Google::Cloud::Firestore::V1::Firestore::Client.new
|
|
1306
|
+
#
|
|
1307
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
1308
|
+
# request = Google::Cloud::Firestore::V1::ExecutePipelineRequest.new
|
|
1309
|
+
#
|
|
1310
|
+
# # Call the execute_pipeline method to start streaming.
|
|
1311
|
+
# output = client.execute_pipeline request
|
|
1312
|
+
#
|
|
1313
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
|
1314
|
+
# # ::Google::Cloud::Firestore::V1::ExecutePipelineResponse
|
|
1315
|
+
# output.each do |current_response|
|
|
1316
|
+
# p current_response
|
|
1317
|
+
# end
|
|
1318
|
+
#
|
|
1319
|
+
def execute_pipeline request, options = nil
|
|
1320
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
1321
|
+
|
|
1322
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::ExecutePipelineRequest
|
|
1323
|
+
|
|
1324
|
+
# Converts hash and nil to an options object
|
|
1325
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
1326
|
+
|
|
1327
|
+
# Customize the options with defaults
|
|
1328
|
+
metadata = @config.rpcs.execute_pipeline.metadata.to_h
|
|
1329
|
+
|
|
1330
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
1331
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
1332
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
1333
|
+
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
|
|
1334
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
1335
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
1336
|
+
|
|
1337
|
+
header_params = {}
|
|
1338
|
+
if request.database
|
|
1339
|
+
regex_match = %r{^projects/(?<project_id>[^/]+)(?:/.*)?$}.match request.database
|
|
1340
|
+
if regex_match
|
|
1341
|
+
header_params["project_id"] = regex_match["project_id".to_s]
|
|
1342
|
+
end
|
|
1343
|
+
end
|
|
1344
|
+
if request.database
|
|
1345
|
+
regex_match = %r{^projects/[^/]+/databases/(?<database_id>[^/]+)(?:/.*)?$}.match request.database
|
|
1346
|
+
if regex_match
|
|
1347
|
+
header_params["database_id"] = regex_match["database_id".to_s]
|
|
1348
|
+
end
|
|
1349
|
+
end
|
|
1350
|
+
|
|
1351
|
+
request_params_header = URI.encode_www_form header_params
|
|
1352
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
1353
|
+
|
|
1354
|
+
options.apply_defaults timeout: @config.rpcs.execute_pipeline.timeout,
|
|
1355
|
+
metadata: metadata,
|
|
1356
|
+
retry_policy: @config.rpcs.execute_pipeline.retry_policy
|
|
1357
|
+
|
|
1358
|
+
options.apply_defaults timeout: @config.timeout,
|
|
1359
|
+
metadata: @config.metadata,
|
|
1360
|
+
retry_policy: @config.retry_policy
|
|
1361
|
+
|
|
1362
|
+
@firestore_stub.call_rpc :execute_pipeline, request, options: options do |response, operation|
|
|
1363
|
+
yield response, operation if block_given?
|
|
1364
|
+
end
|
|
1365
|
+
rescue ::GRPC::BadStatus => e
|
|
1366
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
1367
|
+
end
|
|
1368
|
+
|
|
1239
1369
|
##
|
|
1240
1370
|
# Runs an aggregation query.
|
|
1241
1371
|
#
|
|
@@ -1686,6 +1816,9 @@ module Google
|
|
|
1686
1816
|
# `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
|
1687
1817
|
# For example:
|
|
1688
1818
|
# `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
|
|
1819
|
+
#
|
|
1820
|
+
# Use `projects/{project_id}/databases/{database_id}/documents` to list
|
|
1821
|
+
# top-level collections.
|
|
1689
1822
|
# @param page_size [::Integer]
|
|
1690
1823
|
# The maximum number of results to return.
|
|
1691
1824
|
# @param page_token [::String]
|
|
@@ -2065,6 +2198,7 @@ module Google
|
|
|
2065
2198
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
2066
2199
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
2067
2200
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
2201
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
2068
2202
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
2069
2203
|
# trigger a retry.
|
|
2070
2204
|
# @return [::Hash]
|
|
@@ -2148,6 +2282,7 @@ module Google
|
|
|
2148
2282
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
2149
2283
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
2150
2284
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
2285
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
2151
2286
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
2152
2287
|
# trigger a retry.
|
|
2153
2288
|
#
|
|
@@ -2198,6 +2333,11 @@ module Google
|
|
|
2198
2333
|
#
|
|
2199
2334
|
attr_reader :run_query
|
|
2200
2335
|
##
|
|
2336
|
+
# RPC-specific configuration for `execute_pipeline`
|
|
2337
|
+
# @return [::Gapic::Config::Method]
|
|
2338
|
+
#
|
|
2339
|
+
attr_reader :execute_pipeline
|
|
2340
|
+
##
|
|
2201
2341
|
# RPC-specific configuration for `run_aggregation_query`
|
|
2202
2342
|
# @return [::Gapic::Config::Method]
|
|
2203
2343
|
#
|
|
@@ -2253,6 +2393,8 @@ module Google
|
|
|
2253
2393
|
@rollback = ::Gapic::Config::Method.new rollback_config
|
|
2254
2394
|
run_query_config = parent_rpcs.run_query if parent_rpcs.respond_to? :run_query
|
|
2255
2395
|
@run_query = ::Gapic::Config::Method.new run_query_config
|
|
2396
|
+
execute_pipeline_config = parent_rpcs.execute_pipeline if parent_rpcs.respond_to? :execute_pipeline
|
|
2397
|
+
@execute_pipeline = ::Gapic::Config::Method.new execute_pipeline_config
|
|
2256
2398
|
run_aggregation_query_config = parent_rpcs.run_aggregation_query if parent_rpcs.respond_to? :run_aggregation_query
|
|
2257
2399
|
@run_aggregation_query = ::Gapic::Config::Method.new run_aggregation_query_config
|
|
2258
2400
|
partition_query_config = parent_rpcs.partition_query if parent_rpcs.respond_to? :partition_query
|
|
@@ -100,7 +100,7 @@ module Google
|
|
|
100
100
|
|
|
101
101
|
default_config.rpcs.batch_get_documents.timeout = 300.0
|
|
102
102
|
default_config.rpcs.batch_get_documents.retry_policy = {
|
|
103
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
103
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
default_config.rpcs.begin_transaction.timeout = 60.0
|
|
@@ -120,17 +120,22 @@ module Google
|
|
|
120
120
|
|
|
121
121
|
default_config.rpcs.run_query.timeout = 300.0
|
|
122
122
|
default_config.rpcs.run_query.retry_policy = {
|
|
123
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
123
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
default_config.rpcs.execute_pipeline.timeout = 300.0
|
|
127
|
+
default_config.rpcs.execute_pipeline.retry_policy = {
|
|
128
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13]
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
default_config.rpcs.run_aggregation_query.timeout = 300.0
|
|
127
132
|
default_config.rpcs.run_aggregation_query.retry_policy = {
|
|
128
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
133
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
default_config.rpcs.partition_query.timeout = 300.0
|
|
132
137
|
default_config.rpcs.partition_query.retry_policy = {
|
|
133
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [
|
|
138
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
default_config.rpcs.list_collection_ids.timeout = 60.0
|
|
@@ -1160,6 +1165,117 @@ module Google
|
|
|
1160
1165
|
raise ::Google::Cloud::Error.from_error(e)
|
|
1161
1166
|
end
|
|
1162
1167
|
|
|
1168
|
+
##
|
|
1169
|
+
# Executes a pipeline query.
|
|
1170
|
+
#
|
|
1171
|
+
# @overload execute_pipeline(request, options = nil)
|
|
1172
|
+
# Pass arguments to `execute_pipeline` via a request object, either of type
|
|
1173
|
+
# {::Google::Cloud::Firestore::V1::ExecutePipelineRequest} or an equivalent Hash.
|
|
1174
|
+
#
|
|
1175
|
+
# @param request [::Google::Cloud::Firestore::V1::ExecutePipelineRequest, ::Hash]
|
|
1176
|
+
# A request object representing the call parameters. Required. To specify no
|
|
1177
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
1178
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
1179
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
1180
|
+
#
|
|
1181
|
+
# @overload execute_pipeline(database: nil, structured_pipeline: nil, transaction: nil, new_transaction: nil, read_time: nil, auto_commit_transaction: nil)
|
|
1182
|
+
# Pass arguments to `execute_pipeline` via keyword arguments. Note that at
|
|
1183
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
1184
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
1185
|
+
#
|
|
1186
|
+
# @param database [::String]
|
|
1187
|
+
# Required. Database identifier, in the form
|
|
1188
|
+
# `projects/{project}/databases/{database}`.
|
|
1189
|
+
# @param structured_pipeline [::Google::Cloud::Firestore::V1::StructuredPipeline, ::Hash]
|
|
1190
|
+
# A pipelined operation.
|
|
1191
|
+
# @param transaction [::String]
|
|
1192
|
+
# Run the query within an already active transaction.
|
|
1193
|
+
#
|
|
1194
|
+
# The value here is the opaque transaction ID to execute the query in.
|
|
1195
|
+
#
|
|
1196
|
+
# Note: The following parameters are mutually exclusive: `transaction`, `new_transaction`, `read_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
|
|
1197
|
+
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
|
1198
|
+
# Execute the pipeline in a new transaction.
|
|
1199
|
+
#
|
|
1200
|
+
# The identifier of the newly created transaction will be returned in the
|
|
1201
|
+
# first response on the stream. This defaults to a read-only transaction.
|
|
1202
|
+
#
|
|
1203
|
+
# Note: The following parameters are mutually exclusive: `new_transaction`, `transaction`, `read_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
|
|
1204
|
+
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
|
1205
|
+
# Execute the pipeline in a snapshot transaction at the given time.
|
|
1206
|
+
#
|
|
1207
|
+
# This must be a microsecond precision timestamp within the past one hour,
|
|
1208
|
+
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
|
1209
|
+
# minute timestamp within the past 7 days.
|
|
1210
|
+
#
|
|
1211
|
+
# Note: The following parameters are mutually exclusive: `read_time`, `transaction`, `new_transaction`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
|
|
1212
|
+
# @param auto_commit_transaction [::Boolean]
|
|
1213
|
+
# Optional. Automatically commits the transaction after the pipeline has been
|
|
1214
|
+
# executed. Only permitted in combination with `transaction` or
|
|
1215
|
+
# `new_transaction`.
|
|
1216
|
+
# @return [::Enumerable<::Google::Cloud::Firestore::V1::ExecutePipelineResponse>]
|
|
1217
|
+
#
|
|
1218
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
1219
|
+
#
|
|
1220
|
+
# @example Basic example
|
|
1221
|
+
# require "google/cloud/firestore/v1"
|
|
1222
|
+
#
|
|
1223
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
1224
|
+
# client = Google::Cloud::Firestore::V1::Firestore::Rest::Client.new
|
|
1225
|
+
#
|
|
1226
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
1227
|
+
# request = Google::Cloud::Firestore::V1::ExecutePipelineRequest.new
|
|
1228
|
+
#
|
|
1229
|
+
# # Call the execute_pipeline method to start streaming.
|
|
1230
|
+
# output = client.execute_pipeline request
|
|
1231
|
+
#
|
|
1232
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
|
1233
|
+
# # ::Google::Cloud::Firestore::V1::ExecutePipelineResponse
|
|
1234
|
+
# output.each do |current_response|
|
|
1235
|
+
# p current_response
|
|
1236
|
+
# end
|
|
1237
|
+
#
|
|
1238
|
+
def execute_pipeline request, options = nil
|
|
1239
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
1240
|
+
|
|
1241
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::ExecutePipelineRequest
|
|
1242
|
+
|
|
1243
|
+
# Converts hash and nil to an options object
|
|
1244
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
1245
|
+
|
|
1246
|
+
# Customize the options with defaults
|
|
1247
|
+
call_metadata = @config.rpcs.execute_pipeline.metadata.to_h
|
|
1248
|
+
|
|
1249
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
1250
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
1251
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
1252
|
+
gapic_version: ::Google::Cloud::Firestore::V1::VERSION,
|
|
1253
|
+
transports_version_send: [:rest]
|
|
1254
|
+
|
|
1255
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
1256
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
1257
|
+
|
|
1258
|
+
options.apply_defaults timeout: @config.rpcs.execute_pipeline.timeout,
|
|
1259
|
+
metadata: call_metadata,
|
|
1260
|
+
retry_policy: @config.rpcs.execute_pipeline.retry_policy
|
|
1261
|
+
|
|
1262
|
+
options.apply_defaults timeout: @config.timeout,
|
|
1263
|
+
metadata: @config.metadata,
|
|
1264
|
+
retry_policy: @config.retry_policy
|
|
1265
|
+
|
|
1266
|
+
::Gapic::Rest::ServerStream.new(
|
|
1267
|
+
::Google::Cloud::Firestore::V1::ExecutePipelineResponse,
|
|
1268
|
+
::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q|
|
|
1269
|
+
@firestore_stub.execute_pipeline request, options do |chunk|
|
|
1270
|
+
in_q.deq
|
|
1271
|
+
out_q.enq chunk
|
|
1272
|
+
end
|
|
1273
|
+
end
|
|
1274
|
+
)
|
|
1275
|
+
rescue ::Gapic::Rest::Error => e
|
|
1276
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
1277
|
+
end
|
|
1278
|
+
|
|
1163
1279
|
##
|
|
1164
1280
|
# Runs an aggregation query.
|
|
1165
1281
|
#
|
|
@@ -1440,6 +1556,9 @@ module Google
|
|
|
1440
1556
|
# `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
|
1441
1557
|
# For example:
|
|
1442
1558
|
# `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
|
|
1559
|
+
#
|
|
1560
|
+
# Use `projects/{project_id}/databases/{database_id}/documents` to list
|
|
1561
|
+
# top-level collections.
|
|
1443
1562
|
# @param page_size [::Integer]
|
|
1444
1563
|
# The maximum number of results to return.
|
|
1445
1564
|
# @param page_token [::String]
|
|
@@ -1769,6 +1888,7 @@ module Google
|
|
|
1769
1888
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1770
1889
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1771
1890
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1891
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1772
1892
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1773
1893
|
# trigger a retry.
|
|
1774
1894
|
# @return [::Hash]
|
|
@@ -1841,6 +1961,7 @@ module Google
|
|
|
1841
1961
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1842
1962
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1843
1963
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1964
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1844
1965
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1845
1966
|
# trigger a retry.
|
|
1846
1967
|
#
|
|
@@ -1891,6 +2012,11 @@ module Google
|
|
|
1891
2012
|
#
|
|
1892
2013
|
attr_reader :run_query
|
|
1893
2014
|
##
|
|
2015
|
+
# RPC-specific configuration for `execute_pipeline`
|
|
2016
|
+
# @return [::Gapic::Config::Method]
|
|
2017
|
+
#
|
|
2018
|
+
attr_reader :execute_pipeline
|
|
2019
|
+
##
|
|
1894
2020
|
# RPC-specific configuration for `run_aggregation_query`
|
|
1895
2021
|
# @return [::Gapic::Config::Method]
|
|
1896
2022
|
#
|
|
@@ -1936,6 +2062,8 @@ module Google
|
|
|
1936
2062
|
@rollback = ::Gapic::Config::Method.new rollback_config
|
|
1937
2063
|
run_query_config = parent_rpcs.run_query if parent_rpcs.respond_to? :run_query
|
|
1938
2064
|
@run_query = ::Gapic::Config::Method.new run_query_config
|
|
2065
|
+
execute_pipeline_config = parent_rpcs.execute_pipeline if parent_rpcs.respond_to? :execute_pipeline
|
|
2066
|
+
@execute_pipeline = ::Gapic::Config::Method.new execute_pipeline_config
|
|
1939
2067
|
run_aggregation_query_config = parent_rpcs.run_aggregation_query if parent_rpcs.respond_to? :run_aggregation_query
|
|
1940
2068
|
@run_aggregation_query = ::Gapic::Config::Method.new run_aggregation_query_config
|
|
1941
2069
|
partition_query_config = parent_rpcs.partition_query if parent_rpcs.respond_to? :partition_query
|
|
@@ -421,6 +421,40 @@ module Google
|
|
|
421
421
|
::Gapic::Rest::TransportOperation.new response
|
|
422
422
|
end
|
|
423
423
|
|
|
424
|
+
##
|
|
425
|
+
# Baseline implementation for the execute_pipeline REST call
|
|
426
|
+
#
|
|
427
|
+
# @param request_pb [::Google::Cloud::Firestore::V1::ExecutePipelineRequest]
|
|
428
|
+
# A request object representing the call parameters. Required.
|
|
429
|
+
# @param options [::Gapic::CallOptions]
|
|
430
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
431
|
+
#
|
|
432
|
+
# @yieldparam chunk [::String] The chunk of data received during server streaming.
|
|
433
|
+
#
|
|
434
|
+
# @return [::Gapic::Rest::TransportOperation]
|
|
435
|
+
def execute_pipeline(request_pb, options = nil, &)
|
|
436
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
|
437
|
+
|
|
438
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_execute_pipeline_request request_pb
|
|
439
|
+
query_string_params = if query_string_params.any?
|
|
440
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
|
441
|
+
else
|
|
442
|
+
{}
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
response = @client_stub.make_http_request(
|
|
446
|
+
verb,
|
|
447
|
+
uri: uri,
|
|
448
|
+
body: body || "",
|
|
449
|
+
params: query_string_params,
|
|
450
|
+
method_name: "execute_pipeline",
|
|
451
|
+
options: options,
|
|
452
|
+
is_server_streaming: true,
|
|
453
|
+
&
|
|
454
|
+
)
|
|
455
|
+
::Gapic::Rest::TransportOperation.new response
|
|
456
|
+
end
|
|
457
|
+
|
|
424
458
|
##
|
|
425
459
|
# Baseline implementation for the run_aggregation_query REST call
|
|
426
460
|
#
|
|
@@ -827,6 +861,28 @@ module Google
|
|
|
827
861
|
transcoder.transcode request_pb
|
|
828
862
|
end
|
|
829
863
|
|
|
864
|
+
##
|
|
865
|
+
# @private
|
|
866
|
+
#
|
|
867
|
+
# GRPC transcoding helper method for the execute_pipeline REST call
|
|
868
|
+
#
|
|
869
|
+
# @param request_pb [::Google::Cloud::Firestore::V1::ExecutePipelineRequest]
|
|
870
|
+
# A request object representing the call parameters. Required.
|
|
871
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
|
872
|
+
# Uri, Body, Query string parameters
|
|
873
|
+
def self.transcode_execute_pipeline_request request_pb
|
|
874
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
|
875
|
+
.with_bindings(
|
|
876
|
+
uri_method: :post,
|
|
877
|
+
uri_template: "/v1/{database}/documents:executePipeline",
|
|
878
|
+
body: "*",
|
|
879
|
+
matches: [
|
|
880
|
+
["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
|
|
881
|
+
]
|
|
882
|
+
)
|
|
883
|
+
transcoder.transcode request_pb
|
|
884
|
+
end
|
|
885
|
+
|
|
830
886
|
##
|
|
831
887
|
# @private
|
|
832
888
|
#
|
|
@@ -9,30 +9,8 @@ require 'google/firestore/v1/document_pb'
|
|
|
9
9
|
|
|
10
10
|
descriptor_data = "\n,google/firestore/v1/aggregation_result.proto\x12\x13google.firestore.v1\x1a\"google/firestore/v1/document.proto\"\xbe\x01\n\x11\x41ggregationResult\x12U\n\x10\x61ggregate_fields\x18\x02 \x03(\x0b\x32;.google.firestore.v1.AggregationResult.AggregateFieldsEntry\x1aR\n\x14\x41ggregateFieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12)\n\x05value\x18\x02 \x01(\x0b\x32\x1a.google.firestore.v1.Value:\x02\x38\x01\x42\xce\x01\n\x17\x63om.google.firestore.v1B\x16\x41ggregationResultProtoP\x01Z;cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb\xa2\x02\x04GCFS\xaa\x02\x19Google.Cloud.Firestore.V1\xca\x02\x19Google\\Cloud\\Firestore\\V1\xea\x02\x1cGoogle::Cloud::Firestore::V1b\x06proto3"
|
|
11
11
|
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
|
13
|
-
|
|
14
|
-
begin
|
|
15
|
-
pool.add_serialized_file(descriptor_data)
|
|
16
|
-
rescue TypeError
|
|
17
|
-
# Compatibility code: will be removed in the next major version.
|
|
18
|
-
require 'google/protobuf/descriptor_pb'
|
|
19
|
-
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
|
20
|
-
parsed.clear_dependency
|
|
21
|
-
serialized = parsed.class.encode(parsed)
|
|
22
|
-
file = pool.add_serialized_file(serialized)
|
|
23
|
-
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
|
24
|
-
imports = [
|
|
25
|
-
["google.firestore.v1.Value", "google/firestore/v1/document.proto"],
|
|
26
|
-
]
|
|
27
|
-
imports.each do |type_name, expected_filename|
|
|
28
|
-
import_file = pool.lookup(type_name).file_descriptor
|
|
29
|
-
if import_file.name != expected_filename
|
|
30
|
-
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
warn "Each proto file must use a consistent fully-qualified name."
|
|
34
|
-
warn "This will become an error in the next major version."
|
|
35
|
-
end
|
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
13
|
+
pool.add_serialized_file(descriptor_data)
|
|
36
14
|
|
|
37
15
|
module Google
|
|
38
16
|
module Cloud
|
|
@@ -7,29 +7,8 @@ require 'google/protobuf'
|
|
|
7
7
|
|
|
8
8
|
descriptor_data = "\n&google/firestore/v1/bloom_filter.proto\x12\x13google.firestore.v1\".\n\x0b\x42itSequence\x12\x0e\n\x06\x62itmap\x18\x01 \x01(\x0c\x12\x0f\n\x07padding\x18\x02 \x01(\x05\"Q\n\x0b\x42loomFilter\x12.\n\x04\x62its\x18\x01 \x01(\x0b\x32 .google.firestore.v1.BitSequence\x12\x12\n\nhash_count\x18\x02 \x01(\x05\x42\xc8\x01\n\x17\x63om.google.firestore.v1B\x10\x42loomFilterProtoP\x01Z;cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb\xa2\x02\x04GCFS\xaa\x02\x19Google.Cloud.Firestore.V1\xca\x02\x19Google\\Cloud\\Firestore\\V1\xea\x02\x1cGoogle::Cloud::Firestore::V1b\x06proto3"
|
|
9
9
|
|
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
-
|
|
12
|
-
begin
|
|
13
|
-
pool.add_serialized_file(descriptor_data)
|
|
14
|
-
rescue TypeError
|
|
15
|
-
# Compatibility code: will be removed in the next major version.
|
|
16
|
-
require 'google/protobuf/descriptor_pb'
|
|
17
|
-
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
|
18
|
-
parsed.clear_dependency
|
|
19
|
-
serialized = parsed.class.encode(parsed)
|
|
20
|
-
file = pool.add_serialized_file(serialized)
|
|
21
|
-
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
|
22
|
-
imports = [
|
|
23
|
-
]
|
|
24
|
-
imports.each do |type_name, expected_filename|
|
|
25
|
-
import_file = pool.lookup(type_name).file_descriptor
|
|
26
|
-
if import_file.name != expected_filename
|
|
27
|
-
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
warn "Each proto file must use a consistent fully-qualified name."
|
|
31
|
-
warn "This will become an error in the next major version."
|
|
32
|
-
end
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
33
12
|
|
|
34
13
|
module Google
|
|
35
14
|
module Cloud
|
|
@@ -4,35 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
require 'google/protobuf'
|
|
6
6
|
|
|
7
|
+
require 'google/api/field_behavior_pb'
|
|
7
8
|
require 'google/protobuf/timestamp_pb'
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
descriptor_data = "\n google/firestore/v1/common.proto\x12\x13google.firestore.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"#\n\x0c\x44ocumentMask\x12\x13\n\x0b\x66ield_paths\x18\x01 \x03(\t\"e\n\x0cPrecondition\x12\x10\n\x06\x65xists\x18\x01 \x01(\x08H\x00\x12\x31\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x10\n\x0e\x63ondition_type\"\
|
|
11
|
+
descriptor_data = "\n google/firestore/v1/common.proto\x12\x13google.firestore.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"#\n\x0c\x44ocumentMask\x12\x13\n\x0b\x66ield_paths\x18\x01 \x03(\t\"e\n\x0cPrecondition\x12\x10\n\x06\x65xists\x18\x01 \x01(\x08H\x00\x12\x31\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x10\n\x0e\x63ondition_type\"\xd7\x03\n\x12TransactionOptions\x12\x45\n\tread_only\x18\x02 \x01(\x0b\x32\x30.google.firestore.v1.TransactionOptions.ReadOnlyH\x00\x12G\n\nread_write\x18\x03 \x01(\x0b\x32\x31.google.firestore.v1.TransactionOptions.ReadWriteH\x00\x1a~\n\tReadWrite\x12\x19\n\x11retry_transaction\x18\x01 \x01(\x0c\x12V\n\x10\x63oncurrency_mode\x18\x02 \x01(\x0e\x32\x37.google.firestore.v1.TransactionOptions.ConcurrencyModeB\x03\xe0\x41\x01\x1aS\n\x08ReadOnly\x12/\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x16\n\x14\x63onsistency_selector\"T\n\x0f\x43oncurrencyMode\x12 \n\x1c\x43ONCURRENCY_MODE_UNSPECIFIED\x10\x00\x12\x0e\n\nOPTIMISTIC\x10\x01\x12\x0f\n\x0bPESSIMISTIC\x10\x02\x42\x06\n\x04modeB\xc3\x01\n\x17\x63om.google.firestore.v1B\x0b\x43ommonProtoP\x01Z;cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb\xa2\x02\x04GCFS\xaa\x02\x19Google.Cloud.Firestore.V1\xca\x02\x19Google\\Cloud\\Firestore\\V1\xea\x02\x1cGoogle::Cloud::Firestore::V1b\x06proto3"
|
|
11
12
|
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
|
13
|
-
|
|
14
|
-
begin
|
|
15
|
-
pool.add_serialized_file(descriptor_data)
|
|
16
|
-
rescue TypeError
|
|
17
|
-
# Compatibility code: will be removed in the next major version.
|
|
18
|
-
require 'google/protobuf/descriptor_pb'
|
|
19
|
-
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
|
20
|
-
parsed.clear_dependency
|
|
21
|
-
serialized = parsed.class.encode(parsed)
|
|
22
|
-
file = pool.add_serialized_file(serialized)
|
|
23
|
-
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
|
24
|
-
imports = [
|
|
25
|
-
["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"],
|
|
26
|
-
]
|
|
27
|
-
imports.each do |type_name, expected_filename|
|
|
28
|
-
import_file = pool.lookup(type_name).file_descriptor
|
|
29
|
-
if import_file.name != expected_filename
|
|
30
|
-
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
warn "Each proto file must use a consistent fully-qualified name."
|
|
34
|
-
warn "This will become an error in the next major version."
|
|
35
|
-
end
|
|
13
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
14
|
+
pool.add_serialized_file(descriptor_data)
|
|
36
15
|
|
|
37
16
|
module Google
|
|
38
17
|
module Cloud
|
|
@@ -43,6 +22,7 @@ module Google
|
|
|
43
22
|
TransactionOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.TransactionOptions").msgclass
|
|
44
23
|
TransactionOptions::ReadWrite = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.TransactionOptions.ReadWrite").msgclass
|
|
45
24
|
TransactionOptions::ReadOnly = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.TransactionOptions.ReadOnly").msgclass
|
|
25
|
+
TransactionOptions::ConcurrencyMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.TransactionOptions.ConcurrencyMode").enummodule
|
|
46
26
|
end
|
|
47
27
|
end
|
|
48
28
|
end
|