Skip to content

Commit b0cf964

Browse files
feat: publish the pipelines API to the stable branch (#32250)
docs: minor api documentation changes PiperOrigin-RevId: 840398028 Source-Link: googleapis/googleapis@bfdeefc Source-Link: googleapis/googleapis-gen@895eb7f Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWZpcmVzdG9yZS12MS8uT3dsQm90LnlhbWwiLCJoIjoiODk1ZWI3ZjM2NWRhNDBkNzE1ZWIzMDE3MTQwMzA4MWIwYjZlM2UwOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: publish the pipelines API to the stable branch PiperOrigin-RevId: 840829013 Source-Link: googleapis/googleapis@534adc5 Source-Link: googleapis/googleapis-gen@38e4d8b Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWZpcmVzdG9yZS12MS8uT3dsQm90LnlhbWwiLCJoIjoiMzhlNGQ4YmY1Nzc0NDQyZGQ3Nzg5MzUxNTRmNWFlNTY1MzdmNTRlMiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent b483beb commit b0cf964

19 files changed

Lines changed: 962 additions & 16 deletions

File tree

google-cloud-firestore-v1/.owlbot-manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
"lib/google/firestore/v1/bloom_filter_pb.rb",
2828
"lib/google/firestore/v1/common_pb.rb",
2929
"lib/google/firestore/v1/document_pb.rb",
30+
"lib/google/firestore/v1/explain_stats_pb.rb",
3031
"lib/google/firestore/v1/firestore_pb.rb",
3132
"lib/google/firestore/v1/firestore_services_pb.rb",
33+
"lib/google/firestore/v1/pipeline_pb.rb",
3234
"lib/google/firestore/v1/query_pb.rb",
3335
"lib/google/firestore/v1/query_profile_pb.rb",
3436
"lib/google/firestore/v1/write_pb.rb",
@@ -42,7 +44,9 @@
4244
"proto_docs/google/firestore/v1/bloom_filter.rb",
4345
"proto_docs/google/firestore/v1/common.rb",
4446
"proto_docs/google/firestore/v1/document.rb",
47+
"proto_docs/google/firestore/v1/explain_stats.rb",
4548
"proto_docs/google/firestore/v1/firestore.rb",
49+
"proto_docs/google/firestore/v1/pipeline.rb",
4650
"proto_docs/google/firestore/v1/query.rb",
4751
"proto_docs/google/firestore/v1/query_profile.rb",
4852
"proto_docs/google/firestore/v1/write.rb",
@@ -61,6 +65,7 @@
6165
"snippets/firestore/commit.rb",
6266
"snippets/firestore/create_document.rb",
6367
"snippets/firestore/delete_document.rb",
68+
"snippets/firestore/execute_pipeline.rb",
6469
"snippets/firestore/get_document.rb",
6570
"snippets/firestore/list_collection_ids.rb",
6671
"snippets/firestore/list_documents.rb",

google-cloud-firestore-v1/gapic_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"run_query"
5656
]
5757
},
58+
"ExecutePipeline": {
59+
"methods": [
60+
"execute_pipeline"
61+
]
62+
},
5863
"RunAggregationQuery": {
5964
"methods": [
6065
"run_aggregation_query"

google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/client.rb

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def self.configure
121121
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
122122
}
123123

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: [8, 14, 13, 4]
127+
}
128+
124129
default_config.rpcs.run_aggregation_query.timeout = 300.0
125130
default_config.rpcs.run_aggregation_query.retry_policy = {
126131
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
@@ -1236,6 +1241,127 @@ def run_query request, options = nil
12361241
raise ::Google::Cloud::Error.from_error(e)
12371242
end
12381243

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)
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+
#
1289+
# @yield [response, operation] Access the result along with the RPC operation
1290+
# @yieldparam response [::Enumerable<::Google::Cloud::Firestore::V1::ExecutePipelineResponse>]
1291+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
1292+
#
1293+
# @return [::Enumerable<::Google::Cloud::Firestore::V1::ExecutePipelineResponse>]
1294+
#
1295+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
1296+
#
1297+
# @example Basic example
1298+
# require "google/cloud/firestore/v1"
1299+
#
1300+
# # Create a client object. The client can be reused for multiple calls.
1301+
# client = Google::Cloud::Firestore::V1::Firestore::Client.new
1302+
#
1303+
# # Create a request. To set request fields, pass in keyword arguments.
1304+
# request = Google::Cloud::Firestore::V1::ExecutePipelineRequest.new
1305+
#
1306+
# # Call the execute_pipeline method to start streaming.
1307+
# output = client.execute_pipeline request
1308+
#
1309+
# # The returned object is a streamed enumerable yielding elements of type
1310+
# # ::Google::Cloud::Firestore::V1::ExecutePipelineResponse
1311+
# output.each do |current_response|
1312+
# p current_response
1313+
# end
1314+
#
1315+
def execute_pipeline request, options = nil
1316+
raise ::ArgumentError, "request must be provided" if request.nil?
1317+
1318+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::ExecutePipelineRequest
1319+
1320+
# Converts hash and nil to an options object
1321+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1322+
1323+
# Customize the options with defaults
1324+
metadata = @config.rpcs.execute_pipeline.metadata.to_h
1325+
1326+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1327+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1328+
lib_name: @config.lib_name, lib_version: @config.lib_version,
1329+
gapic_version: ::Google::Cloud::Firestore::V1::VERSION
1330+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1331+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1332+
1333+
header_params = {}
1334+
if request.database
1335+
regex_match = %r{^projects/(?<project_id>[^/]+)(?:/.*)?$}.match request.database
1336+
if regex_match
1337+
header_params["project_id"] = regex_match["project_id".to_s]
1338+
end
1339+
end
1340+
if request.database
1341+
regex_match = %r{^projects/[^/]+/databases/(?<database_id>[^/]+)(?:/.*)?$}.match request.database
1342+
if regex_match
1343+
header_params["database_id"] = regex_match["database_id".to_s]
1344+
end
1345+
end
1346+
1347+
request_params_header = URI.encode_www_form header_params
1348+
metadata[:"x-goog-request-params"] ||= request_params_header
1349+
1350+
options.apply_defaults timeout: @config.rpcs.execute_pipeline.timeout,
1351+
metadata: metadata,
1352+
retry_policy: @config.rpcs.execute_pipeline.retry_policy
1353+
1354+
options.apply_defaults timeout: @config.timeout,
1355+
metadata: @config.metadata,
1356+
retry_policy: @config.retry_policy
1357+
1358+
@firestore_stub.call_rpc :execute_pipeline, request, options: options do |response, operation|
1359+
yield response, operation if block_given?
1360+
end
1361+
rescue ::GRPC::BadStatus => e
1362+
raise ::Google::Cloud::Error.from_error(e)
1363+
end
1364+
12391365
##
12401366
# Runs an aggregation query.
12411367
#
@@ -2198,6 +2324,11 @@ class Rpcs
21982324
#
21992325
attr_reader :run_query
22002326
##
2327+
# RPC-specific configuration for `execute_pipeline`
2328+
# @return [::Gapic::Config::Method]
2329+
#
2330+
attr_reader :execute_pipeline
2331+
##
22012332
# RPC-specific configuration for `run_aggregation_query`
22022333
# @return [::Gapic::Config::Method]
22032334
#
@@ -2253,6 +2384,8 @@ def initialize parent_rpcs = nil
22532384
@rollback = ::Gapic::Config::Method.new rollback_config
22542385
run_query_config = parent_rpcs.run_query if parent_rpcs.respond_to? :run_query
22552386
@run_query = ::Gapic::Config::Method.new run_query_config
2387+
execute_pipeline_config = parent_rpcs.execute_pipeline if parent_rpcs.respond_to? :execute_pipeline
2388+
@execute_pipeline = ::Gapic::Config::Method.new execute_pipeline_config
22562389
run_aggregation_query_config = parent_rpcs.run_aggregation_query if parent_rpcs.respond_to? :run_aggregation_query
22572390
@run_aggregation_query = ::Gapic::Config::Method.new run_aggregation_query_config
22582391
partition_query_config = parent_rpcs.partition_query if parent_rpcs.respond_to? :partition_query

google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/client.rb

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ def self.configure
123123
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
124124
}
125125

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: [8, 14, 13, 4]
129+
}
130+
126131
default_config.rpcs.run_aggregation_query.timeout = 300.0
127132
default_config.rpcs.run_aggregation_query.retry_policy = {
128133
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
@@ -1160,6 +1165,113 @@ def run_query request, options = nil
11601165
raise ::Google::Cloud::Error.from_error(e)
11611166
end
11621167

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)
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+
# @return [::Enumerable<::Google::Cloud::Firestore::V1::ExecutePipelineResponse>]
1213+
#
1214+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
1215+
#
1216+
# @example Basic example
1217+
# require "google/cloud/firestore/v1"
1218+
#
1219+
# # Create a client object. The client can be reused for multiple calls.
1220+
# client = Google::Cloud::Firestore::V1::Firestore::Rest::Client.new
1221+
#
1222+
# # Create a request. To set request fields, pass in keyword arguments.
1223+
# request = Google::Cloud::Firestore::V1::ExecutePipelineRequest.new
1224+
#
1225+
# # Call the execute_pipeline method to start streaming.
1226+
# output = client.execute_pipeline request
1227+
#
1228+
# # The returned object is a streamed enumerable yielding elements of type
1229+
# # ::Google::Cloud::Firestore::V1::ExecutePipelineResponse
1230+
# output.each do |current_response|
1231+
# p current_response
1232+
# end
1233+
#
1234+
def execute_pipeline request, options = nil
1235+
raise ::ArgumentError, "request must be provided" if request.nil?
1236+
1237+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::ExecutePipelineRequest
1238+
1239+
# Converts hash and nil to an options object
1240+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1241+
1242+
# Customize the options with defaults
1243+
call_metadata = @config.rpcs.execute_pipeline.metadata.to_h
1244+
1245+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1246+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1247+
lib_name: @config.lib_name, lib_version: @config.lib_version,
1248+
gapic_version: ::Google::Cloud::Firestore::V1::VERSION,
1249+
transports_version_send: [:rest]
1250+
1251+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1252+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1253+
1254+
options.apply_defaults timeout: @config.rpcs.execute_pipeline.timeout,
1255+
metadata: call_metadata,
1256+
retry_policy: @config.rpcs.execute_pipeline.retry_policy
1257+
1258+
options.apply_defaults timeout: @config.timeout,
1259+
metadata: @config.metadata,
1260+
retry_policy: @config.retry_policy
1261+
1262+
::Gapic::Rest::ServerStream.new(
1263+
::Google::Cloud::Firestore::V1::ExecutePipelineResponse,
1264+
::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q|
1265+
@firestore_stub.execute_pipeline request, options do |chunk|
1266+
in_q.deq
1267+
out_q.enq chunk
1268+
end
1269+
end
1270+
)
1271+
rescue ::Gapic::Rest::Error => e
1272+
raise ::Google::Cloud::Error.from_error(e)
1273+
end
1274+
11631275
##
11641276
# Runs an aggregation query.
11651277
#
@@ -1891,6 +2003,11 @@ class Rpcs
18912003
#
18922004
attr_reader :run_query
18932005
##
2006+
# RPC-specific configuration for `execute_pipeline`
2007+
# @return [::Gapic::Config::Method]
2008+
#
2009+
attr_reader :execute_pipeline
2010+
##
18942011
# RPC-specific configuration for `run_aggregation_query`
18952012
# @return [::Gapic::Config::Method]
18962013
#
@@ -1936,6 +2053,8 @@ def initialize parent_rpcs = nil
19362053
@rollback = ::Gapic::Config::Method.new rollback_config
19372054
run_query_config = parent_rpcs.run_query if parent_rpcs.respond_to? :run_query
19382055
@run_query = ::Gapic::Config::Method.new run_query_config
2056+
execute_pipeline_config = parent_rpcs.execute_pipeline if parent_rpcs.respond_to? :execute_pipeline
2057+
@execute_pipeline = ::Gapic::Config::Method.new execute_pipeline_config
19392058
run_aggregation_query_config = parent_rpcs.run_aggregation_query if parent_rpcs.respond_to? :run_aggregation_query
19402059
@run_aggregation_query = ::Gapic::Config::Method.new run_aggregation_query_config
19412060
partition_query_config = parent_rpcs.partition_query if parent_rpcs.respond_to? :partition_query

0 commit comments

Comments
 (0)