google-cloud-firestore-v1 1.0.0 → 1.3.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 +31 -21
- data/lib/google/cloud/firestore/v1/firestore/client.rb +63 -17
- data/lib/google/cloud/firestore/v1/firestore/rest/client.rb +64 -12
- data/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb +105 -68
- data/lib/google/cloud/firestore/v1/version.rb +1 -1
- data/lib/google/firestore/v1/document_pb.rb +2 -1
- data/lib/google/firestore/v1/query_pb.rb +1 -1
- data/proto_docs/google/api/client.rb +70 -10
- data/proto_docs/google/api/resource.rb +7 -2
- data/proto_docs/google/firestore/v1/common.rb +8 -0
- data/proto_docs/google/firestore/v1/document.rb +23 -1
- data/proto_docs/google/firestore/v1/firestore.rb +52 -0
- data/proto_docs/google/firestore/v1/query.rb +43 -10
- data/proto_docs/google/firestore/v1/write.rb +18 -0
- data/proto_docs/google/protobuf/struct.rb +12 -0
- metadata +6 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b67c52cee2171ce52f3400231c3499eaaed66952ff0276ef2e13524c17913157
|
4
|
+
data.tar.gz: 66698aca23fb4c9b1206a1d4a78d2367170e3773d9a626210e2b4003685bf2fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0a665c4ce2a42693cc9d63845c1a2141e29c2bf38cd9323557eba0752613a0f10d7dd1ab0beae434079c50c993c68649fde760da36bd76222d2681a89b462e6
|
7
|
+
data.tar.gz: 79b4a3ac0c99cb05250bb5a3c7a2c6bab455b72bdc62a8ca99961780ac2ade3243b9d89e659f21b49ca33fdcf3237fd9025d04ffc0192d435311b979f87a7d07
|
data/README.md
CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
|
|
43
43
|
See also the [Product Documentation](https://cloud.google.com/firestore)
|
44
44
|
for general usage information.
|
45
45
|
|
46
|
-
##
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
## Debug Logging
|
47
|
+
|
48
|
+
This library comes with opt-in Debug Logging that can help you troubleshoot
|
49
|
+
your application's integration with the API. When logging is activated, key
|
50
|
+
events such as requests and responses, along with data payloads and metadata
|
51
|
+
such as headers and client configuration, are logged to the standard error
|
52
|
+
stream.
|
53
|
+
|
54
|
+
**WARNING:** Client Library Debug Logging includes your data payloads in
|
55
|
+
plaintext, which could include sensitive data such as PII for yourself or your
|
56
|
+
customers, private keys, or other security data that could be compromising if
|
57
|
+
leaked. Always practice good data hygiene with your application logs, and follow
|
58
|
+
the principle of least access. Google also recommends that Client Library Debug
|
59
|
+
Logging be enabled only temporarily during active debugging, and not used
|
60
|
+
permanently in production.
|
61
|
+
|
62
|
+
To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
|
63
|
+
to the value `all`. Alternatively, you can set the value to a comma-delimited
|
64
|
+
list of client library gem names. This will select the default logging behavior,
|
65
|
+
which writes logs to the standard error stream. On a local workstation, this may
|
66
|
+
result in logs appearing on the console. When running on a Google Cloud hosting
|
67
|
+
service such as [Google Cloud Run](https://cloud.google.com/run), this generally
|
68
|
+
results in logs appearing alongside your application logs in the
|
69
|
+
[Google Cloud Logging](https://cloud.google.com/logging/) service.
|
70
|
+
|
71
|
+
You can customize logging by modifying the `logger` configuration when
|
72
|
+
constructing a client object. For example:
|
55
73
|
|
56
74
|
```ruby
|
75
|
+
require "google/cloud/firestore/v1"
|
57
76
|
require "logger"
|
58
77
|
|
59
|
-
|
60
|
-
|
61
|
-
def logger
|
62
|
-
LOGGER
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
67
|
-
module GRPC
|
68
|
-
extend MyLogger
|
78
|
+
client = ::Google::Cloud::Firestore::V1::Firestore::Client.new do |config|
|
79
|
+
config.logger = Logger.new "my-app.log"
|
69
80
|
end
|
70
81
|
```
|
71
82
|
|
72
|
-
|
73
83
|
## Google Cloud Samples
|
74
84
|
|
75
85
|
To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
|
76
86
|
|
77
87
|
## Supported Ruby Versions
|
78
88
|
|
79
|
-
This library is supported on Ruby
|
89
|
+
This library is supported on Ruby 3.0+.
|
80
90
|
|
81
91
|
Google provides official support for Ruby versions that are actively supported
|
82
92
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
@@ -240,14 +240,26 @@ module Google
|
|
240
240
|
universe_domain: @config.universe_domain,
|
241
241
|
channel_args: @config.channel_args,
|
242
242
|
interceptors: @config.interceptors,
|
243
|
-
channel_pool_config: @config.channel_pool
|
243
|
+
channel_pool_config: @config.channel_pool,
|
244
|
+
logger: @config.logger
|
244
245
|
)
|
245
246
|
|
247
|
+
@firestore_stub.stub_logger&.info do |entry|
|
248
|
+
entry.set_system_name
|
249
|
+
entry.set_service
|
250
|
+
entry.message = "Created client for #{entry.service}"
|
251
|
+
entry.set_credentials_fields credentials
|
252
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
253
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
254
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
255
|
+
end
|
256
|
+
|
246
257
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
247
258
|
config.credentials = credentials
|
248
259
|
config.quota_project = @quota_project_id
|
249
260
|
config.endpoint = @firestore_stub.endpoint
|
250
261
|
config.universe_domain = @firestore_stub.universe_domain
|
262
|
+
config.logger = @firestore_stub.logger if config.respond_to? :logger=
|
251
263
|
end
|
252
264
|
end
|
253
265
|
|
@@ -258,6 +270,15 @@ module Google
|
|
258
270
|
#
|
259
271
|
attr_reader :location_client
|
260
272
|
|
273
|
+
##
|
274
|
+
# The logger used for request/response debug logging.
|
275
|
+
#
|
276
|
+
# @return [Logger]
|
277
|
+
#
|
278
|
+
def logger
|
279
|
+
@firestore_stub.logger
|
280
|
+
end
|
281
|
+
|
261
282
|
# Service calls
|
262
283
|
|
263
284
|
##
|
@@ -288,6 +309,8 @@ module Google
|
|
288
309
|
# will not be returned in the response.
|
289
310
|
# @param transaction [::String]
|
290
311
|
# Reads the document in a transaction.
|
312
|
+
#
|
313
|
+
# Note: The following fields are mutually exclusive: `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
291
314
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
292
315
|
# Reads the version of the document at the given time.
|
293
316
|
#
|
@@ -295,6 +318,8 @@ module Google
|
|
295
318
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
296
319
|
# minute timestamp within the past 7 days.
|
297
320
|
#
|
321
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
322
|
+
#
|
298
323
|
# @yield [response, operation] Access the result along with the RPC operation
|
299
324
|
# @yieldparam response [::Google::Cloud::Firestore::V1::Document]
|
300
325
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
@@ -354,7 +379,6 @@ module Google
|
|
354
379
|
|
355
380
|
@firestore_stub.call_rpc :get_document, request, options: options do |response, operation|
|
356
381
|
yield response, operation if block_given?
|
357
|
-
return response
|
358
382
|
end
|
359
383
|
rescue ::GRPC::BadStatus => e
|
360
384
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -418,12 +442,16 @@ module Google
|
|
418
442
|
# will not be returned in the response.
|
419
443
|
# @param transaction [::String]
|
420
444
|
# Perform the read as part of an already active transaction.
|
445
|
+
#
|
446
|
+
# Note: The following fields are mutually exclusive: `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
421
447
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
422
448
|
# Perform the read at the provided time.
|
423
449
|
#
|
424
450
|
# This must be a microsecond precision timestamp within the past one hour,
|
425
451
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
426
452
|
# minute timestamp within the past 7 days.
|
453
|
+
#
|
454
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
427
455
|
# @param show_missing [::Boolean]
|
428
456
|
# If the list should show missing documents.
|
429
457
|
#
|
@@ -502,7 +530,7 @@ module Google
|
|
502
530
|
@firestore_stub.call_rpc :list_documents, request, options: options do |response, operation|
|
503
531
|
response = ::Gapic::PagedEnumerable.new @firestore_stub, :list_documents, request, response, operation, options
|
504
532
|
yield response, operation if block_given?
|
505
|
-
|
533
|
+
throw :response, response
|
506
534
|
end
|
507
535
|
rescue ::GRPC::BadStatus => e
|
508
536
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -605,7 +633,6 @@ module Google
|
|
605
633
|
|
606
634
|
@firestore_stub.call_rpc :update_document, request, options: options do |response, operation|
|
607
635
|
yield response, operation if block_given?
|
608
|
-
return response
|
609
636
|
end
|
610
637
|
rescue ::GRPC::BadStatus => e
|
611
638
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -695,7 +722,6 @@ module Google
|
|
695
722
|
|
696
723
|
@firestore_stub.call_rpc :delete_document, request, options: options do |response, operation|
|
697
724
|
yield response, operation if block_given?
|
698
|
-
return response
|
699
725
|
end
|
700
726
|
rescue ::GRPC::BadStatus => e
|
701
727
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -737,11 +763,15 @@ module Google
|
|
737
763
|
# not be returned in the response.
|
738
764
|
# @param transaction [::String]
|
739
765
|
# Reads documents in a transaction.
|
766
|
+
#
|
767
|
+
# Note: The following fields are mutually exclusive: `transaction`, `new_transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
740
768
|
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
741
769
|
# Starts a new transaction and reads the documents.
|
742
770
|
# Defaults to a read-only transaction.
|
743
771
|
# The new transaction ID will be returned as the first response in the
|
744
772
|
# stream.
|
773
|
+
#
|
774
|
+
# Note: The following fields are mutually exclusive: `new_transaction`, `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
745
775
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
746
776
|
# Reads documents as they were at the given time.
|
747
777
|
#
|
@@ -749,6 +779,8 @@ module Google
|
|
749
779
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
750
780
|
# minute timestamp within the past 7 days.
|
751
781
|
#
|
782
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`, `new_transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
783
|
+
#
|
752
784
|
# @yield [response, operation] Access the result along with the RPC operation
|
753
785
|
# @yieldparam response [::Enumerable<::Google::Cloud::Firestore::V1::BatchGetDocumentsResponse>]
|
754
786
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
@@ -811,7 +843,6 @@ module Google
|
|
811
843
|
|
812
844
|
@firestore_stub.call_rpc :batch_get_documents, request, options: options do |response, operation|
|
813
845
|
yield response, operation if block_given?
|
814
|
-
return response
|
815
846
|
end
|
816
847
|
rescue ::GRPC::BadStatus => e
|
817
848
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -901,7 +932,6 @@ module Google
|
|
901
932
|
|
902
933
|
@firestore_stub.call_rpc :begin_transaction, request, options: options do |response, operation|
|
903
934
|
yield response, operation if block_given?
|
904
|
-
return response
|
905
935
|
end
|
906
936
|
rescue ::GRPC::BadStatus => e
|
907
937
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -994,7 +1024,6 @@ module Google
|
|
994
1024
|
|
995
1025
|
@firestore_stub.call_rpc :commit, request, options: options do |response, operation|
|
996
1026
|
yield response, operation if block_given?
|
997
|
-
return response
|
998
1027
|
end
|
999
1028
|
rescue ::GRPC::BadStatus => e
|
1000
1029
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1083,7 +1112,6 @@ module Google
|
|
1083
1112
|
|
1084
1113
|
@firestore_stub.call_rpc :rollback, request, options: options do |response, operation|
|
1085
1114
|
yield response, operation if block_given?
|
1086
|
-
return response
|
1087
1115
|
end
|
1088
1116
|
rescue ::GRPC::BadStatus => e
|
1089
1117
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1120,17 +1148,23 @@ module Google
|
|
1120
1148
|
# Run the query within an already active transaction.
|
1121
1149
|
#
|
1122
1150
|
# The value here is the opaque transaction ID to execute the query in.
|
1151
|
+
#
|
1152
|
+
# Note: The following fields are mutually exclusive: `transaction`, `new_transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1123
1153
|
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
1124
1154
|
# Starts a new transaction and reads the documents.
|
1125
1155
|
# Defaults to a read-only transaction.
|
1126
1156
|
# The new transaction ID will be returned as the first response in the
|
1127
1157
|
# stream.
|
1158
|
+
#
|
1159
|
+
# Note: The following fields are mutually exclusive: `new_transaction`, `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1128
1160
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
1129
1161
|
# Reads documents as they were at the given time.
|
1130
1162
|
#
|
1131
1163
|
# This must be a microsecond precision timestamp within the past one hour,
|
1132
1164
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
1133
1165
|
# minute timestamp within the past 7 days.
|
1166
|
+
#
|
1167
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`, `new_transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1134
1168
|
# @param explain_options [::Google::Cloud::Firestore::V1::ExplainOptions, ::Hash]
|
1135
1169
|
# Optional. Explain options for the query. If set, additional query
|
1136
1170
|
# statistics will be returned. If not, only query results will be returned.
|
@@ -1197,7 +1231,6 @@ module Google
|
|
1197
1231
|
|
1198
1232
|
@firestore_stub.call_rpc :run_query, request, options: options do |response, operation|
|
1199
1233
|
yield response, operation if block_given?
|
1200
|
-
return response
|
1201
1234
|
end
|
1202
1235
|
rescue ::GRPC::BadStatus => e
|
1203
1236
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1246,17 +1279,23 @@ module Google
|
|
1246
1279
|
# Run the aggregation within an already active transaction.
|
1247
1280
|
#
|
1248
1281
|
# The value here is the opaque transaction ID to execute the query in.
|
1282
|
+
#
|
1283
|
+
# Note: The following fields are mutually exclusive: `transaction`, `new_transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1249
1284
|
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
1250
1285
|
# Starts a new transaction as part of the query, defaulting to read-only.
|
1251
1286
|
#
|
1252
1287
|
# The new transaction ID will be returned as the first response in the
|
1253
1288
|
# stream.
|
1289
|
+
#
|
1290
|
+
# Note: The following fields are mutually exclusive: `new_transaction`, `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1254
1291
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
1255
1292
|
# Executes the query at the given timestamp.
|
1256
1293
|
#
|
1257
1294
|
# This must be a microsecond precision timestamp within the past one hour,
|
1258
1295
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
1259
1296
|
# minute timestamp within the past 7 days.
|
1297
|
+
#
|
1298
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`, `new_transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1260
1299
|
# @param explain_options [::Google::Cloud::Firestore::V1::ExplainOptions, ::Hash]
|
1261
1300
|
# Optional. Explain options for the query. If set, additional query
|
1262
1301
|
# statistics will be returned. If not, only query results will be returned.
|
@@ -1323,7 +1362,6 @@ module Google
|
|
1323
1362
|
|
1324
1363
|
@firestore_stub.call_rpc :run_aggregation_query, request, options: options do |response, operation|
|
1325
1364
|
yield response, operation if block_given?
|
1326
|
-
return response
|
1327
1365
|
end
|
1328
1366
|
rescue ::GRPC::BadStatus => e
|
1329
1367
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1461,7 +1499,7 @@ module Google
|
|
1461
1499
|
@firestore_stub.call_rpc :partition_query, request, options: options do |response, operation|
|
1462
1500
|
response = ::Gapic::PagedEnumerable.new @firestore_stub, :partition_query, request, response, operation, options
|
1463
1501
|
yield response, operation if block_given?
|
1464
|
-
|
1502
|
+
throw :response, response
|
1465
1503
|
end
|
1466
1504
|
rescue ::GRPC::BadStatus => e
|
1467
1505
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1541,7 +1579,6 @@ module Google
|
|
1541
1579
|
|
1542
1580
|
@firestore_stub.call_rpc :write, request, options: options do |response, operation|
|
1543
1581
|
yield response, operation if block_given?
|
1544
|
-
return response
|
1545
1582
|
end
|
1546
1583
|
rescue ::GRPC::BadStatus => e
|
1547
1584
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1621,7 +1658,6 @@ module Google
|
|
1621
1658
|
|
1622
1659
|
@firestore_stub.call_rpc :listen, request, options: options do |response, operation|
|
1623
1660
|
yield response, operation if block_given?
|
1624
|
-
return response
|
1625
1661
|
end
|
1626
1662
|
rescue ::GRPC::BadStatus => e
|
1627
1663
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1721,7 +1757,6 @@ module Google
|
|
1721
1757
|
|
1722
1758
|
@firestore_stub.call_rpc :list_collection_ids, request, options: options do |response, operation|
|
1723
1759
|
yield response, operation if block_given?
|
1724
|
-
return response
|
1725
1760
|
end
|
1726
1761
|
rescue ::GRPC::BadStatus => e
|
1727
1762
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1825,7 +1860,6 @@ module Google
|
|
1825
1860
|
|
1826
1861
|
@firestore_stub.call_rpc :batch_write, request, options: options do |response, operation|
|
1827
1862
|
yield response, operation if block_given?
|
1828
|
-
return response
|
1829
1863
|
end
|
1830
1864
|
rescue ::GRPC::BadStatus => e
|
1831
1865
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1930,7 +1964,6 @@ module Google
|
|
1930
1964
|
|
1931
1965
|
@firestore_stub.call_rpc :create_document, request, options: options do |response, operation|
|
1932
1966
|
yield response, operation if block_given?
|
1933
|
-
return response
|
1934
1967
|
end
|
1935
1968
|
rescue ::GRPC::BadStatus => e
|
1936
1969
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1980,6 +2013,13 @@ module Google
|
|
1980
2013
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1981
2014
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1982
2015
|
# * (`nil`) indicating no credentials
|
2016
|
+
#
|
2017
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
2018
|
+
# external source for authentication to Google Cloud, you must validate it before
|
2019
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
2020
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
2021
|
+
# For more information, refer to [Validate credential configurations from external
|
2022
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
1983
2023
|
# @return [::Object]
|
1984
2024
|
# @!attribute [rw] scope
|
1985
2025
|
# The OAuth scopes
|
@@ -2019,6 +2059,11 @@ module Google
|
|
2019
2059
|
# default endpoint URL. The default value of nil uses the environment
|
2020
2060
|
# universe (usually the default "googleapis.com" universe).
|
2021
2061
|
# @return [::String,nil]
|
2062
|
+
# @!attribute [rw] logger
|
2063
|
+
# A custom logger to use for request/response debug logging, or the value
|
2064
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
2065
|
+
# explicitly disable logging.
|
2066
|
+
# @return [::Logger,:default,nil]
|
2022
2067
|
#
|
2023
2068
|
class Configuration
|
2024
2069
|
extend ::Gapic::Config
|
@@ -2043,6 +2088,7 @@ module Google
|
|
2043
2088
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
2044
2089
|
config_attr :quota_project, nil, ::String, nil
|
2045
2090
|
config_attr :universe_domain, nil, ::String, nil
|
2091
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
2046
2092
|
|
2047
2093
|
# @private
|
2048
2094
|
def initialize parent_config = nil
|
@@ -226,14 +226,26 @@ module Google
|
|
226
226
|
endpoint: @config.endpoint,
|
227
227
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
228
228
|
universe_domain: @config.universe_domain,
|
229
|
-
credentials: credentials
|
229
|
+
credentials: credentials,
|
230
|
+
logger: @config.logger
|
230
231
|
)
|
231
232
|
|
233
|
+
@firestore_stub.logger(stub: true)&.info do |entry|
|
234
|
+
entry.set_system_name
|
235
|
+
entry.set_service
|
236
|
+
entry.message = "Created client for #{entry.service}"
|
237
|
+
entry.set_credentials_fields credentials
|
238
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
239
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
240
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
241
|
+
end
|
242
|
+
|
232
243
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
233
244
|
config.credentials = credentials
|
234
245
|
config.quota_project = @quota_project_id
|
235
246
|
config.endpoint = @firestore_stub.endpoint
|
236
247
|
config.universe_domain = @firestore_stub.universe_domain
|
248
|
+
config.logger = @firestore_stub.logger if config.respond_to? :logger=
|
237
249
|
end
|
238
250
|
end
|
239
251
|
|
@@ -244,6 +256,15 @@ module Google
|
|
244
256
|
#
|
245
257
|
attr_reader :location_client
|
246
258
|
|
259
|
+
##
|
260
|
+
# The logger used for request/response debug logging.
|
261
|
+
#
|
262
|
+
# @return [Logger]
|
263
|
+
#
|
264
|
+
def logger
|
265
|
+
@firestore_stub.logger
|
266
|
+
end
|
267
|
+
|
247
268
|
# Service calls
|
248
269
|
|
249
270
|
##
|
@@ -274,12 +295,16 @@ module Google
|
|
274
295
|
# will not be returned in the response.
|
275
296
|
# @param transaction [::String]
|
276
297
|
# Reads the document in a transaction.
|
298
|
+
#
|
299
|
+
# Note: The following fields are mutually exclusive: `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
277
300
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
278
301
|
# Reads the version of the document at the given time.
|
279
302
|
#
|
280
303
|
# This must be a microsecond precision timestamp within the past one hour,
|
281
304
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
282
305
|
# minute timestamp within the past 7 days.
|
306
|
+
#
|
307
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
283
308
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
284
309
|
# @yieldparam result [::Google::Cloud::Firestore::V1::Document]
|
285
310
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -333,7 +358,6 @@ module Google
|
|
333
358
|
|
334
359
|
@firestore_stub.get_document request, options do |result, operation|
|
335
360
|
yield result, operation if block_given?
|
336
|
-
return result
|
337
361
|
end
|
338
362
|
rescue ::Gapic::Rest::Error => e
|
339
363
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -397,12 +421,16 @@ module Google
|
|
397
421
|
# will not be returned in the response.
|
398
422
|
# @param transaction [::String]
|
399
423
|
# Perform the read as part of an already active transaction.
|
424
|
+
#
|
425
|
+
# Note: The following fields are mutually exclusive: `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
400
426
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
401
427
|
# Perform the read at the provided time.
|
402
428
|
#
|
403
429
|
# This must be a microsecond precision timestamp within the past one hour,
|
404
430
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
405
431
|
# minute timestamp within the past 7 days.
|
432
|
+
#
|
433
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
406
434
|
# @param show_missing [::Boolean]
|
407
435
|
# If the list should show missing documents.
|
408
436
|
#
|
@@ -471,7 +499,7 @@ module Google
|
|
471
499
|
@firestore_stub.list_documents request, options do |result, operation|
|
472
500
|
result = ::Gapic::Rest::PagedEnumerable.new @firestore_stub, :list_documents, "documents", request, result, options
|
473
501
|
yield result, operation if block_given?
|
474
|
-
|
502
|
+
throw :response, result
|
475
503
|
end
|
476
504
|
rescue ::Gapic::Rest::Error => e
|
477
505
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -567,7 +595,6 @@ module Google
|
|
567
595
|
|
568
596
|
@firestore_stub.update_document request, options do |result, operation|
|
569
597
|
yield result, operation if block_given?
|
570
|
-
return result
|
571
598
|
end
|
572
599
|
rescue ::Gapic::Rest::Error => e
|
573
600
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -650,7 +677,6 @@ module Google
|
|
650
677
|
|
651
678
|
@firestore_stub.delete_document request, options do |result, operation|
|
652
679
|
yield result, operation if block_given?
|
653
|
-
return result
|
654
680
|
end
|
655
681
|
rescue ::Gapic::Rest::Error => e
|
656
682
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -692,17 +718,23 @@ module Google
|
|
692
718
|
# not be returned in the response.
|
693
719
|
# @param transaction [::String]
|
694
720
|
# Reads documents in a transaction.
|
721
|
+
#
|
722
|
+
# Note: The following fields are mutually exclusive: `transaction`, `new_transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
695
723
|
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
696
724
|
# Starts a new transaction and reads the documents.
|
697
725
|
# Defaults to a read-only transaction.
|
698
726
|
# The new transaction ID will be returned as the first response in the
|
699
727
|
# stream.
|
728
|
+
#
|
729
|
+
# Note: The following fields are mutually exclusive: `new_transaction`, `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
700
730
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
701
731
|
# Reads documents as they were at the given time.
|
702
732
|
#
|
703
733
|
# This must be a microsecond precision timestamp within the past one hour,
|
704
734
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
705
735
|
# minute timestamp within the past 7 days.
|
736
|
+
#
|
737
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`, `new_transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
706
738
|
# @return [::Enumerable<::Google::Cloud::Firestore::V1::BatchGetDocumentsResponse>]
|
707
739
|
#
|
708
740
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
@@ -843,7 +875,6 @@ module Google
|
|
843
875
|
|
844
876
|
@firestore_stub.begin_transaction request, options do |result, operation|
|
845
877
|
yield result, operation if block_given?
|
846
|
-
return result
|
847
878
|
end
|
848
879
|
rescue ::Gapic::Rest::Error => e
|
849
880
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -929,7 +960,6 @@ module Google
|
|
929
960
|
|
930
961
|
@firestore_stub.commit request, options do |result, operation|
|
931
962
|
yield result, operation if block_given?
|
932
|
-
return result
|
933
963
|
end
|
934
964
|
rescue ::Gapic::Rest::Error => e
|
935
965
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1011,7 +1041,6 @@ module Google
|
|
1011
1041
|
|
1012
1042
|
@firestore_stub.rollback request, options do |result, operation|
|
1013
1043
|
yield result, operation if block_given?
|
1014
|
-
return result
|
1015
1044
|
end
|
1016
1045
|
rescue ::Gapic::Rest::Error => e
|
1017
1046
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1048,17 +1077,23 @@ module Google
|
|
1048
1077
|
# Run the query within an already active transaction.
|
1049
1078
|
#
|
1050
1079
|
# The value here is the opaque transaction ID to execute the query in.
|
1080
|
+
#
|
1081
|
+
# Note: The following fields are mutually exclusive: `transaction`, `new_transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1051
1082
|
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
1052
1083
|
# Starts a new transaction and reads the documents.
|
1053
1084
|
# Defaults to a read-only transaction.
|
1054
1085
|
# The new transaction ID will be returned as the first response in the
|
1055
1086
|
# stream.
|
1087
|
+
#
|
1088
|
+
# Note: The following fields are mutually exclusive: `new_transaction`, `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1056
1089
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
1057
1090
|
# Reads documents as they were at the given time.
|
1058
1091
|
#
|
1059
1092
|
# This must be a microsecond precision timestamp within the past one hour,
|
1060
1093
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
1061
1094
|
# minute timestamp within the past 7 days.
|
1095
|
+
#
|
1096
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`, `new_transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1062
1097
|
# @param explain_options [::Google::Cloud::Firestore::V1::ExplainOptions, ::Hash]
|
1063
1098
|
# Optional. Explain options for the query. If set, additional query
|
1064
1099
|
# statistics will be returned. If not, only query results will be returned.
|
@@ -1168,17 +1203,23 @@ module Google
|
|
1168
1203
|
# Run the aggregation within an already active transaction.
|
1169
1204
|
#
|
1170
1205
|
# The value here is the opaque transaction ID to execute the query in.
|
1206
|
+
#
|
1207
|
+
# Note: The following fields are mutually exclusive: `transaction`, `new_transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1171
1208
|
# @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
|
1172
1209
|
# Starts a new transaction as part of the query, defaulting to read-only.
|
1173
1210
|
#
|
1174
1211
|
# The new transaction ID will be returned as the first response in the
|
1175
1212
|
# stream.
|
1213
|
+
#
|
1214
|
+
# Note: The following fields are mutually exclusive: `new_transaction`, `transaction`, `read_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1176
1215
|
# @param read_time [::Google::Protobuf::Timestamp, ::Hash]
|
1177
1216
|
# Executes the query at the given timestamp.
|
1178
1217
|
#
|
1179
1218
|
# This must be a microsecond precision timestamp within the past one hour,
|
1180
1219
|
# or if Point-in-Time Recovery is enabled, can additionally be a whole
|
1181
1220
|
# minute timestamp within the past 7 days.
|
1221
|
+
#
|
1222
|
+
# Note: The following fields are mutually exclusive: `read_time`, `transaction`, `new_transaction`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
1182
1223
|
# @param explain_options [::Google::Cloud::Firestore::V1::ExplainOptions, ::Hash]
|
1183
1224
|
# Optional. Explain options for the query. If set, additional query
|
1184
1225
|
# statistics will be returned. If not, only query results will be returned.
|
@@ -1370,7 +1411,7 @@ module Google
|
|
1370
1411
|
@firestore_stub.partition_query request, options do |result, operation|
|
1371
1412
|
result = ::Gapic::Rest::PagedEnumerable.new @firestore_stub, :partition_query, "partitions", request, result, options
|
1372
1413
|
yield result, operation if block_given?
|
1373
|
-
|
1414
|
+
throw :response, result
|
1374
1415
|
end
|
1375
1416
|
rescue ::Gapic::Rest::Error => e
|
1376
1417
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1464,7 +1505,7 @@ module Google
|
|
1464
1505
|
@firestore_stub.list_collection_ids request, options do |result, operation|
|
1465
1506
|
result = ::Gapic::Rest::PagedEnumerable.new @firestore_stub, :list_collection_ids, "collection_ids", request, result, options
|
1466
1507
|
yield result, operation if block_given?
|
1467
|
-
|
1508
|
+
throw :response, result
|
1468
1509
|
end
|
1469
1510
|
rescue ::Gapic::Rest::Error => e
|
1470
1511
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1561,7 +1602,6 @@ module Google
|
|
1561
1602
|
|
1562
1603
|
@firestore_stub.batch_write request, options do |result, operation|
|
1563
1604
|
yield result, operation if block_given?
|
1564
|
-
return result
|
1565
1605
|
end
|
1566
1606
|
rescue ::Gapic::Rest::Error => e
|
1567
1607
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1656,7 +1696,6 @@ module Google
|
|
1656
1696
|
|
1657
1697
|
@firestore_stub.create_document request, options do |result, operation|
|
1658
1698
|
yield result, operation if block_given?
|
1659
|
-
return result
|
1660
1699
|
end
|
1661
1700
|
rescue ::Gapic::Rest::Error => e
|
1662
1701
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1704,6 +1743,13 @@ module Google
|
|
1704
1743
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1705
1744
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1706
1745
|
# * (`nil`) indicating no credentials
|
1746
|
+
#
|
1747
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
1748
|
+
# external source for authentication to Google Cloud, you must validate it before
|
1749
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
1750
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
1751
|
+
# For more information, refer to [Validate credential configurations from external
|
1752
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
1707
1753
|
# @return [::Object]
|
1708
1754
|
# @!attribute [rw] scope
|
1709
1755
|
# The OAuth scopes
|
@@ -1736,6 +1782,11 @@ module Google
|
|
1736
1782
|
# default endpoint URL. The default value of nil uses the environment
|
1737
1783
|
# universe (usually the default "googleapis.com" universe).
|
1738
1784
|
# @return [::String,nil]
|
1785
|
+
# @!attribute [rw] logger
|
1786
|
+
# A custom logger to use for request/response debug logging, or the value
|
1787
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1788
|
+
# explicitly disable logging.
|
1789
|
+
# @return [::Logger,:default,nil]
|
1739
1790
|
#
|
1740
1791
|
class Configuration
|
1741
1792
|
extend ::Gapic::Config
|
@@ -1757,6 +1808,7 @@ module Google
|
|
1757
1808
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1758
1809
|
config_attr :quota_project, nil, ::String, nil
|
1759
1810
|
config_attr :universe_domain, nil, ::String, nil
|
1811
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1760
1812
|
|
1761
1813
|
# @private
|
1762
1814
|
def initialize parent_config = nil
|