google-cloud-datastore-v1 0.3.1 → 0.3.5
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/.yardopts +1 -1
- data/AUTHENTICATION.md +15 -33
- data/README.md +1 -1
- data/lib/google/cloud/datastore/v1/datastore/client.rb +194 -77
- data/lib/google/cloud/datastore/v1/version.rb +1 -1
- data/lib/google/datastore/v1/datastore_pb.rb +2 -2
- data/lib/google/datastore/v1/entity_pb.rb +2 -2
- data/lib/google/datastore/v1/query_pb.rb +2 -2
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/api/resource.rb +10 -71
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa99477dff9c2ddb432fa51e5714ecdc61e7179a259b19093c2feb102bfdaef4
|
4
|
+
data.tar.gz: a4161c7bc6daad45e845631819dddf8b8746e5052df3f6859712251b7ab26166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2f9f6e7b0b4a631dc31aa8170a9b7d0828acaaabfd28a0bda14d6c8906e58b07de7942a8c2bd1b1e89b4279a7561e33998bbdecbb783e10462b76df7ba1036a
|
7
|
+
data.tar.gz: dc8e68bcda3b91ec4115fb1c30a265e0866df16d76fa0a0870fbf34d0c4e93b98e1194b684d5873497bc20be4968c366c9322c973c4fa91e5fff4c288a4c21c2
|
data/.yardopts
CHANGED
data/AUTHENTICATION.md
CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-datastore-v1
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
67
|
{::Google::Cloud::Datastore::V1::Datastore::Credentials}):
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
* `DATASTORE_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
|
+
* `DATASTORE_KEYFILE` - Path to JSON file, or JSON contents
|
71
|
+
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
72
|
+
* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
|
73
|
+
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
require "google/cloud/datastore/v1"
|
@@ -82,8 +82,8 @@ client = ::Google::Cloud::Datastore::V1::Datastore::Client.new
|
|
82
82
|
|
83
83
|
### Configuration
|
84
84
|
|
85
|
-
The **Credentials JSON** can be configured instead of
|
86
|
-
environment
|
85
|
+
The path to the **Credentials JSON** file can be configured instead of storing
|
86
|
+
it in an environment variable. Either on an individual client initialization:
|
87
87
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/datastore/v1"
|
@@ -93,7 +93,7 @@ client = ::Google::Cloud::Datastore::V1::Datastore::Client.new do |config|
|
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
96
|
-
Or
|
96
|
+
Or globally for all clients:
|
97
97
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/datastore/v1"
|
@@ -120,15 +120,6 @@ To configure your system for this, simply:
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
121
121
|
*should* only be used during development.
|
122
122
|
|
123
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
124
|
-
[dev-console]: https://console.cloud.google.com/project
|
125
|
-
|
126
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
127
|
-
|
128
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
129
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
130
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
131
|
-
|
132
123
|
## Creating a Service Account
|
133
124
|
|
134
125
|
Google Cloud requires **Service Account Credentials** to
|
@@ -139,31 +130,22 @@ If you are not running this client within
|
|
139
130
|
[Google Cloud Platform environments](#google-cloud-platform-environments), you
|
140
131
|
need a Google Developers service account.
|
141
132
|
|
142
|
-
1. Visit the [Google
|
133
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
143
134
|
2. Create a new project or click on an existing project.
|
144
|
-
3. Activate the
|
135
|
+
3. Activate the menu in the upper left and select **APIs & Services**. From
|
145
136
|
here, you will enable the APIs that your application requires.
|
146
137
|
|
147
|
-
![Enable the APIs that your application requires][enable-apis]
|
148
|
-
|
149
138
|
*Note: You may need to enable billing in order to use these services.*
|
150
139
|
|
151
140
|
4. Select **Credentials** from the side navigation.
|
152
141
|
|
153
|
-
|
154
|
-
|
155
|
-
![Create a new service account][create-new-service-account]
|
156
|
-
|
157
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
158
|
-
|
159
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
160
|
-
guided through downloading a new JSON key file.
|
142
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
143
|
+
"Service account" to be guided through downloading a new JSON key file.
|
161
144
|
|
162
145
|
If you want to re-use an existing service account, you can easily generate a
|
163
|
-
new key file. Just select the account you wish to re-use,
|
164
|
-
|
165
|
-
|
166
|
-
![Re-use an existing service account][reuse-service-account]
|
146
|
+
new key file. Just select the account you wish to re-use, click the pencil
|
147
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
148
|
+
and then select **Add Key**.
|
167
149
|
|
168
150
|
The key file you download will be used by this library to authenticate API
|
169
151
|
requests and should be stored in a secure location.
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
|
|
33
33
|
require "google/cloud/datastore/v1"
|
34
34
|
|
35
35
|
client = ::Google::Cloud::Datastore::V1::Datastore::Client.new
|
36
|
-
request =
|
36
|
+
request = ::Google::Cloud::Datastore::V1::LookupRequest.new # (request fields as keyword arguments...)
|
37
37
|
response = client.lookup request
|
38
38
|
```
|
39
39
|
|
@@ -44,13 +44,12 @@ module Google
|
|
44
44
|
# See {::Google::Cloud::Datastore::V1::Datastore::Client::Configuration}
|
45
45
|
# for a description of the configuration fields.
|
46
46
|
#
|
47
|
-
#
|
47
|
+
# @example
|
48
48
|
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# end
|
49
|
+
# # Modify the configuration for all Datastore clients
|
50
|
+
# ::Google::Cloud::Datastore::V1::Datastore::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
54
53
|
#
|
55
54
|
# @yield [config] Configure the Client client.
|
56
55
|
# @yieldparam config [Client::Configuration]
|
@@ -70,18 +69,12 @@ module Google
|
|
70
69
|
|
71
70
|
default_config.rpcs.lookup.timeout = 60.0
|
72
71
|
default_config.rpcs.lookup.retry_policy = {
|
73
|
-
initial_delay: 0.1,
|
74
|
-
max_delay: 60.0,
|
75
|
-
multiplier: 1.3,
|
76
|
-
retry_codes: [14, 4]
|
72
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
77
73
|
}
|
78
74
|
|
79
75
|
default_config.rpcs.run_query.timeout = 60.0
|
80
76
|
default_config.rpcs.run_query.retry_policy = {
|
81
|
-
initial_delay: 0.1,
|
82
|
-
max_delay: 60.0,
|
83
|
-
multiplier: 1.3,
|
84
|
-
retry_codes: [14, 4]
|
77
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
85
78
|
}
|
86
79
|
|
87
80
|
default_config.rpcs.begin_transaction.timeout = 60.0
|
@@ -94,10 +87,7 @@ module Google
|
|
94
87
|
|
95
88
|
default_config.rpcs.reserve_ids.timeout = 60.0
|
96
89
|
default_config.rpcs.reserve_ids.retry_policy = {
|
97
|
-
initial_delay: 0.1,
|
98
|
-
max_delay: 60.0,
|
99
|
-
multiplier: 1.3,
|
100
|
-
retry_codes: [14, 4]
|
90
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
101
91
|
}
|
102
92
|
|
103
93
|
default_config
|
@@ -129,19 +119,15 @@ module Google
|
|
129
119
|
##
|
130
120
|
# Create a new Datastore client object.
|
131
121
|
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
# To create a new Datastore client with the default
|
135
|
-
# configuration:
|
122
|
+
# @example
|
136
123
|
#
|
137
|
-
#
|
124
|
+
# # Create a client using the default configuration
|
125
|
+
# client = ::Google::Cloud::Datastore::V1::Datastore::Client.new
|
138
126
|
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
# config.timeout = 10.0
|
144
|
-
# end
|
127
|
+
# # Create a client using a custom configuration
|
128
|
+
# client = ::Google::Cloud::Datastore::V1::Datastore::Client.new do |config|
|
129
|
+
# config.timeout = 10.0
|
130
|
+
# end
|
145
131
|
#
|
146
132
|
# @yield [config] Configure the Datastore client.
|
147
133
|
# @yieldparam config [Client::Configuration]
|
@@ -161,14 +147,13 @@ module Google
|
|
161
147
|
|
162
148
|
# Create credentials
|
163
149
|
credentials = @config.credentials
|
164
|
-
# Use self-signed JWT if the
|
150
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
165
151
|
# but only if the default endpoint does not have a region prefix.
|
166
|
-
enable_self_signed_jwt = @config.
|
167
|
-
@config.endpoint == Client.configure.endpoint &&
|
152
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
168
153
|
!@config.endpoint.split(".").first.include?("-")
|
169
154
|
credentials ||= Credentials.default scope: @config.scope,
|
170
155
|
enable_self_signed_jwt: enable_self_signed_jwt
|
171
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
156
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
172
157
|
credentials = Credentials.new credentials, scope: @config.scope
|
173
158
|
end
|
174
159
|
@quota_project_id = @config.quota_project
|
@@ -218,6 +203,21 @@ module Google
|
|
218
203
|
#
|
219
204
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
220
205
|
#
|
206
|
+
# @example Basic example
|
207
|
+
# require "google/cloud/datastore/v1"
|
208
|
+
#
|
209
|
+
# # Create a client object. The client can be reused for multiple calls.
|
210
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
211
|
+
#
|
212
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
213
|
+
# request = Google::Cloud::Datastore::V1::LookupRequest.new
|
214
|
+
#
|
215
|
+
# # Call the lookup method.
|
216
|
+
# result = client.lookup request
|
217
|
+
#
|
218
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::LookupResponse.
|
219
|
+
# p result
|
220
|
+
#
|
221
221
|
def lookup request, options = nil
|
222
222
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
223
223
|
|
@@ -235,16 +235,20 @@ module Google
|
|
235
235
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
236
236
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
237
237
|
|
238
|
-
header_params = {
|
239
|
-
|
240
|
-
|
238
|
+
header_params = {}
|
239
|
+
if request.project_id
|
240
|
+
header_params["project_id"] = request.project_id
|
241
|
+
end
|
242
|
+
|
241
243
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
242
244
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
243
245
|
|
244
246
|
options.apply_defaults timeout: @config.rpcs.lookup.timeout,
|
245
247
|
metadata: metadata,
|
246
248
|
retry_policy: @config.rpcs.lookup.retry_policy
|
247
|
-
|
249
|
+
|
250
|
+
options.apply_defaults timeout: @config.timeout,
|
251
|
+
metadata: @config.metadata,
|
248
252
|
retry_policy: @config.retry_policy
|
249
253
|
|
250
254
|
@datastore_stub.call_rpc :lookup, request, options: options do |response, operation|
|
@@ -295,6 +299,21 @@ module Google
|
|
295
299
|
#
|
296
300
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
297
301
|
#
|
302
|
+
# @example Basic example
|
303
|
+
# require "google/cloud/datastore/v1"
|
304
|
+
#
|
305
|
+
# # Create a client object. The client can be reused for multiple calls.
|
306
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
307
|
+
#
|
308
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
309
|
+
# request = Google::Cloud::Datastore::V1::RunQueryRequest.new
|
310
|
+
#
|
311
|
+
# # Call the run_query method.
|
312
|
+
# result = client.run_query request
|
313
|
+
#
|
314
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::RunQueryResponse.
|
315
|
+
# p result
|
316
|
+
#
|
298
317
|
def run_query request, options = nil
|
299
318
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
300
319
|
|
@@ -312,16 +331,20 @@ module Google
|
|
312
331
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
313
332
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
314
333
|
|
315
|
-
header_params = {
|
316
|
-
|
317
|
-
|
334
|
+
header_params = {}
|
335
|
+
if request.project_id
|
336
|
+
header_params["project_id"] = request.project_id
|
337
|
+
end
|
338
|
+
|
318
339
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
319
340
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
320
341
|
|
321
342
|
options.apply_defaults timeout: @config.rpcs.run_query.timeout,
|
322
343
|
metadata: metadata,
|
323
344
|
retry_policy: @config.rpcs.run_query.retry_policy
|
324
|
-
|
345
|
+
|
346
|
+
options.apply_defaults timeout: @config.timeout,
|
347
|
+
metadata: @config.metadata,
|
325
348
|
retry_policy: @config.retry_policy
|
326
349
|
|
327
350
|
@datastore_stub.call_rpc :run_query, request, options: options do |response, operation|
|
@@ -363,6 +386,21 @@ module Google
|
|
363
386
|
#
|
364
387
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
365
388
|
#
|
389
|
+
# @example Basic example
|
390
|
+
# require "google/cloud/datastore/v1"
|
391
|
+
#
|
392
|
+
# # Create a client object. The client can be reused for multiple calls.
|
393
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
394
|
+
#
|
395
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
396
|
+
# request = Google::Cloud::Datastore::V1::BeginTransactionRequest.new
|
397
|
+
#
|
398
|
+
# # Call the begin_transaction method.
|
399
|
+
# result = client.begin_transaction request
|
400
|
+
#
|
401
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::BeginTransactionResponse.
|
402
|
+
# p result
|
403
|
+
#
|
366
404
|
def begin_transaction request, options = nil
|
367
405
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
368
406
|
|
@@ -380,16 +418,20 @@ module Google
|
|
380
418
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
381
419
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
382
420
|
|
383
|
-
header_params = {
|
384
|
-
|
385
|
-
|
421
|
+
header_params = {}
|
422
|
+
if request.project_id
|
423
|
+
header_params["project_id"] = request.project_id
|
424
|
+
end
|
425
|
+
|
386
426
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
387
427
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
388
428
|
|
389
429
|
options.apply_defaults timeout: @config.rpcs.begin_transaction.timeout,
|
390
430
|
metadata: metadata,
|
391
431
|
retry_policy: @config.rpcs.begin_transaction.retry_policy
|
392
|
-
|
432
|
+
|
433
|
+
options.apply_defaults timeout: @config.timeout,
|
434
|
+
metadata: @config.metadata,
|
393
435
|
retry_policy: @config.retry_policy
|
394
436
|
|
395
437
|
@datastore_stub.call_rpc :begin_transaction, request, options: options do |response, operation|
|
@@ -450,6 +492,21 @@ module Google
|
|
450
492
|
#
|
451
493
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
452
494
|
#
|
495
|
+
# @example Basic example
|
496
|
+
# require "google/cloud/datastore/v1"
|
497
|
+
#
|
498
|
+
# # Create a client object. The client can be reused for multiple calls.
|
499
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
500
|
+
#
|
501
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
502
|
+
# request = Google::Cloud::Datastore::V1::CommitRequest.new
|
503
|
+
#
|
504
|
+
# # Call the commit method.
|
505
|
+
# result = client.commit request
|
506
|
+
#
|
507
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::CommitResponse.
|
508
|
+
# p result
|
509
|
+
#
|
453
510
|
def commit request, options = nil
|
454
511
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
455
512
|
|
@@ -467,16 +524,20 @@ module Google
|
|
467
524
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
468
525
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
469
526
|
|
470
|
-
header_params = {
|
471
|
-
|
472
|
-
|
527
|
+
header_params = {}
|
528
|
+
if request.project_id
|
529
|
+
header_params["project_id"] = request.project_id
|
530
|
+
end
|
531
|
+
|
473
532
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
474
533
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
475
534
|
|
476
535
|
options.apply_defaults timeout: @config.rpcs.commit.timeout,
|
477
536
|
metadata: metadata,
|
478
537
|
retry_policy: @config.rpcs.commit.retry_policy
|
479
|
-
|
538
|
+
|
539
|
+
options.apply_defaults timeout: @config.timeout,
|
540
|
+
metadata: @config.metadata,
|
480
541
|
retry_policy: @config.retry_policy
|
481
542
|
|
482
543
|
@datastore_stub.call_rpc :commit, request, options: options do |response, operation|
|
@@ -519,6 +580,21 @@ module Google
|
|
519
580
|
#
|
520
581
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
521
582
|
#
|
583
|
+
# @example Basic example
|
584
|
+
# require "google/cloud/datastore/v1"
|
585
|
+
#
|
586
|
+
# # Create a client object. The client can be reused for multiple calls.
|
587
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
588
|
+
#
|
589
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
590
|
+
# request = Google::Cloud::Datastore::V1::RollbackRequest.new
|
591
|
+
#
|
592
|
+
# # Call the rollback method.
|
593
|
+
# result = client.rollback request
|
594
|
+
#
|
595
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::RollbackResponse.
|
596
|
+
# p result
|
597
|
+
#
|
522
598
|
def rollback request, options = nil
|
523
599
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
524
600
|
|
@@ -536,16 +612,20 @@ module Google
|
|
536
612
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
537
613
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
538
614
|
|
539
|
-
header_params = {
|
540
|
-
|
541
|
-
|
615
|
+
header_params = {}
|
616
|
+
if request.project_id
|
617
|
+
header_params["project_id"] = request.project_id
|
618
|
+
end
|
619
|
+
|
542
620
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
543
621
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
544
622
|
|
545
623
|
options.apply_defaults timeout: @config.rpcs.rollback.timeout,
|
546
624
|
metadata: metadata,
|
547
625
|
retry_policy: @config.rpcs.rollback.retry_policy
|
548
|
-
|
626
|
+
|
627
|
+
options.apply_defaults timeout: @config.timeout,
|
628
|
+
metadata: @config.metadata,
|
549
629
|
retry_policy: @config.retry_policy
|
550
630
|
|
551
631
|
@datastore_stub.call_rpc :rollback, request, options: options do |response, operation|
|
@@ -589,6 +669,21 @@ module Google
|
|
589
669
|
#
|
590
670
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
591
671
|
#
|
672
|
+
# @example Basic example
|
673
|
+
# require "google/cloud/datastore/v1"
|
674
|
+
#
|
675
|
+
# # Create a client object. The client can be reused for multiple calls.
|
676
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
677
|
+
#
|
678
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
679
|
+
# request = Google::Cloud::Datastore::V1::AllocateIdsRequest.new
|
680
|
+
#
|
681
|
+
# # Call the allocate_ids method.
|
682
|
+
# result = client.allocate_ids request
|
683
|
+
#
|
684
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::AllocateIdsResponse.
|
685
|
+
# p result
|
686
|
+
#
|
592
687
|
def allocate_ids request, options = nil
|
593
688
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
594
689
|
|
@@ -606,16 +701,20 @@ module Google
|
|
606
701
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
607
702
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
608
703
|
|
609
|
-
header_params = {
|
610
|
-
|
611
|
-
|
704
|
+
header_params = {}
|
705
|
+
if request.project_id
|
706
|
+
header_params["project_id"] = request.project_id
|
707
|
+
end
|
708
|
+
|
612
709
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
613
710
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
614
711
|
|
615
712
|
options.apply_defaults timeout: @config.rpcs.allocate_ids.timeout,
|
616
713
|
metadata: metadata,
|
617
714
|
retry_policy: @config.rpcs.allocate_ids.retry_policy
|
618
|
-
|
715
|
+
|
716
|
+
options.apply_defaults timeout: @config.timeout,
|
717
|
+
metadata: @config.metadata,
|
619
718
|
retry_policy: @config.retry_policy
|
620
719
|
|
621
720
|
@datastore_stub.call_rpc :allocate_ids, request, options: options do |response, operation|
|
@@ -661,6 +760,21 @@ module Google
|
|
661
760
|
#
|
662
761
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
663
762
|
#
|
763
|
+
# @example Basic example
|
764
|
+
# require "google/cloud/datastore/v1"
|
765
|
+
#
|
766
|
+
# # Create a client object. The client can be reused for multiple calls.
|
767
|
+
# client = Google::Cloud::Datastore::V1::Datastore::Client.new
|
768
|
+
#
|
769
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
770
|
+
# request = Google::Cloud::Datastore::V1::ReserveIdsRequest.new
|
771
|
+
#
|
772
|
+
# # Call the reserve_ids method.
|
773
|
+
# result = client.reserve_ids request
|
774
|
+
#
|
775
|
+
# # The returned object is of type Google::Cloud::Datastore::V1::ReserveIdsResponse.
|
776
|
+
# p result
|
777
|
+
#
|
664
778
|
def reserve_ids request, options = nil
|
665
779
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
666
780
|
|
@@ -678,16 +792,20 @@ module Google
|
|
678
792
|
gapic_version: ::Google::Cloud::Datastore::V1::VERSION
|
679
793
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
680
794
|
|
681
|
-
header_params = {
|
682
|
-
|
683
|
-
|
795
|
+
header_params = {}
|
796
|
+
if request.project_id
|
797
|
+
header_params["project_id"] = request.project_id
|
798
|
+
end
|
799
|
+
|
684
800
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
685
801
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
686
802
|
|
687
803
|
options.apply_defaults timeout: @config.rpcs.reserve_ids.timeout,
|
688
804
|
metadata: metadata,
|
689
805
|
retry_policy: @config.rpcs.reserve_ids.retry_policy
|
690
|
-
|
806
|
+
|
807
|
+
options.apply_defaults timeout: @config.timeout,
|
808
|
+
metadata: @config.metadata,
|
691
809
|
retry_policy: @config.retry_policy
|
692
810
|
|
693
811
|
@datastore_stub.call_rpc :reserve_ids, request, options: options do |response, operation|
|
@@ -711,22 +829,21 @@ module Google
|
|
711
829
|
# Configuration can be applied globally to all clients, or to a single client
|
712
830
|
# on construction.
|
713
831
|
#
|
714
|
-
#
|
715
|
-
#
|
716
|
-
#
|
717
|
-
# to 20 seconds,
|
718
|
-
#
|
719
|
-
#
|
720
|
-
#
|
721
|
-
#
|
722
|
-
#
|
723
|
-
#
|
724
|
-
#
|
725
|
-
#
|
726
|
-
#
|
727
|
-
#
|
728
|
-
#
|
729
|
-
# end
|
832
|
+
# @example
|
833
|
+
#
|
834
|
+
# # Modify the global config, setting the timeout for
|
835
|
+
# # lookup to 20 seconds,
|
836
|
+
# # and all remaining timeouts to 10 seconds.
|
837
|
+
# ::Google::Cloud::Datastore::V1::Datastore::Client.configure do |config|
|
838
|
+
# config.timeout = 10.0
|
839
|
+
# config.rpcs.lookup.timeout = 20.0
|
840
|
+
# end
|
841
|
+
#
|
842
|
+
# # Apply the above configuration only to a new client.
|
843
|
+
# client = ::Google::Cloud::Datastore::V1::Datastore::Client.new do |config|
|
844
|
+
# config.timeout = 10.0
|
845
|
+
# config.rpcs.lookup.timeout = 20.0
|
846
|
+
# end
|
730
847
|
#
|
731
848
|
# @!attribute [rw] endpoint
|
732
849
|
# The hostname or hostname:port of the service endpoint.
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# source: google/datastore/v1/datastore.proto
|
3
3
|
|
4
|
-
require 'google/protobuf'
|
5
|
-
|
6
4
|
require 'google/api/annotations_pb'
|
7
5
|
require 'google/api/client_pb'
|
8
6
|
require 'google/api/field_behavior_pb'
|
9
7
|
require 'google/datastore/v1/entity_pb'
|
10
8
|
require 'google/datastore/v1/query_pb'
|
9
|
+
require 'google/protobuf'
|
10
|
+
|
11
11
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
12
12
|
add_file("google/datastore/v1/datastore.proto", :syntax => :proto3) do
|
13
13
|
add_message "google.datastore.v1.LookupRequest" do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# source: google/datastore/v1/entity.proto
|
3
3
|
|
4
|
-
require 'google/protobuf'
|
5
|
-
|
6
4
|
require 'google/api/annotations_pb'
|
7
5
|
require 'google/protobuf/struct_pb'
|
8
6
|
require 'google/protobuf/timestamp_pb'
|
9
7
|
require 'google/type/latlng_pb'
|
8
|
+
require 'google/protobuf'
|
9
|
+
|
10
10
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
11
|
add_file("google/datastore/v1/entity.proto", :syntax => :proto3) do
|
12
12
|
add_message "google.datastore.v1.PartitionId" do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# source: google/datastore/v1/query.proto
|
3
3
|
|
4
|
-
require 'google/protobuf'
|
5
|
-
|
6
4
|
require 'google/api/annotations_pb'
|
7
5
|
require 'google/datastore/v1/entity_pb'
|
8
6
|
require 'google/protobuf/wrappers_pb'
|
9
7
|
require 'google/type/latlng_pb'
|
8
|
+
require 'google/protobuf'
|
9
|
+
|
10
10
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
11
|
add_file("google/datastore/v1/query.proto", :syntax => :proto3) do
|
12
12
|
add_message "google.datastore.v1.EntityResult" do
|
@@ -57,9 +57,15 @@ module Google
|
|
57
57
|
|
58
58
|
# Denotes that a (repeated) field is an unordered list.
|
59
59
|
# This indicates that the service may provide the elements of the list
|
60
|
-
# in any arbitrary
|
60
|
+
# in any arbitrary order, rather than the order the user originally
|
61
61
|
# provided. Additionally, the list's order may or may not be stable.
|
62
62
|
UNORDERED_LIST = 6
|
63
|
+
|
64
|
+
# Denotes that this field returns a non-empty default value if not set.
|
65
|
+
# This indicates that if the user provides the empty value in a request,
|
66
|
+
# a non-empty value will be returned. The user will not be aware of what
|
67
|
+
# non-empty value to expect.
|
68
|
+
NON_EMPTY_DEFAULT = 7
|
63
69
|
end
|
64
70
|
end
|
65
71
|
end
|
@@ -33,11 +33,7 @@ module Google
|
|
33
33
|
# // For Kubernetes resources, the format is {api group}/{kind}.
|
34
34
|
# option (google.api.resource) = {
|
35
35
|
# type: "pubsub.googleapis.com/Topic"
|
36
|
-
#
|
37
|
-
# pattern: "projects/{project}/topics/{topic}"
|
38
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
39
|
-
# parent_name_extractor: "projects/{project}"
|
40
|
-
# }
|
36
|
+
# pattern: "projects/{project}/topics/{topic}"
|
41
37
|
# };
|
42
38
|
# }
|
43
39
|
#
|
@@ -45,10 +41,7 @@ module Google
|
|
45
41
|
#
|
46
42
|
# resources:
|
47
43
|
# - type: "pubsub.googleapis.com/Topic"
|
48
|
-
#
|
49
|
-
# - pattern: "projects/{project}/topics/{topic}"
|
50
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
51
|
-
# parent_name_extractor: "projects/{project}"
|
44
|
+
# pattern: "projects/{project}/topics/{topic}"
|
52
45
|
#
|
53
46
|
# Sometimes, resources have multiple patterns, typically because they can
|
54
47
|
# live under multiple parents.
|
@@ -58,26 +51,10 @@ module Google
|
|
58
51
|
# message LogEntry {
|
59
52
|
# option (google.api.resource) = {
|
60
53
|
# type: "logging.googleapis.com/LogEntry"
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# }
|
66
|
-
# name_descriptor: {
|
67
|
-
# pattern: "folders/{folder}/logs/{log}"
|
68
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
69
|
-
# parent_name_extractor: "folders/{folder}"
|
70
|
-
# }
|
71
|
-
# name_descriptor: {
|
72
|
-
# pattern: "organizations/{organization}/logs/{log}"
|
73
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Organization"
|
74
|
-
# parent_name_extractor: "organizations/{organization}"
|
75
|
-
# }
|
76
|
-
# name_descriptor: {
|
77
|
-
# pattern: "billingAccounts/{billing_account}/logs/{log}"
|
78
|
-
# parent_type: "billing.googleapis.com/BillingAccount"
|
79
|
-
# parent_name_extractor: "billingAccounts/{billing_account}"
|
80
|
-
# }
|
54
|
+
# pattern: "projects/{project}/logs/{log}"
|
55
|
+
# pattern: "folders/{folder}/logs/{log}"
|
56
|
+
# pattern: "organizations/{organization}/logs/{log}"
|
57
|
+
# pattern: "billingAccounts/{billing_account}/logs/{log}"
|
81
58
|
# };
|
82
59
|
# }
|
83
60
|
#
|
@@ -85,48 +62,10 @@ module Google
|
|
85
62
|
#
|
86
63
|
# resources:
|
87
64
|
# - type: 'logging.googleapis.com/LogEntry'
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
# - pattern: "folders/{folder}/logs/{log}"
|
93
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
94
|
-
# parent_name_extractor: "folders/{folder}"
|
95
|
-
# - pattern: "organizations/{organization}/logs/{log}"
|
96
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Organization"
|
97
|
-
# parent_name_extractor: "organizations/{organization}"
|
98
|
-
# - pattern: "billingAccounts/{billing_account}/logs/{log}"
|
99
|
-
# parent_type: "billing.googleapis.com/BillingAccount"
|
100
|
-
# parent_name_extractor: "billingAccounts/{billing_account}"
|
101
|
-
#
|
102
|
-
# For flexible resources, the resource name doesn't contain parent names, but
|
103
|
-
# the resource itself has parents for policy evaluation.
|
104
|
-
#
|
105
|
-
# Example:
|
106
|
-
#
|
107
|
-
# message Shelf {
|
108
|
-
# option (google.api.resource) = {
|
109
|
-
# type: "library.googleapis.com/Shelf"
|
110
|
-
# name_descriptor: {
|
111
|
-
# pattern: "shelves/{shelf}"
|
112
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
113
|
-
# }
|
114
|
-
# name_descriptor: {
|
115
|
-
# pattern: "shelves/{shelf}"
|
116
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
117
|
-
# }
|
118
|
-
# };
|
119
|
-
# }
|
120
|
-
#
|
121
|
-
# The ResourceDescriptor Yaml config will look like:
|
122
|
-
#
|
123
|
-
# resources:
|
124
|
-
# - type: 'library.googleapis.com/Shelf'
|
125
|
-
# name_descriptor:
|
126
|
-
# - pattern: "shelves/{shelf}"
|
127
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Project"
|
128
|
-
# - pattern: "shelves/{shelf}"
|
129
|
-
# parent_type: "cloudresourcemanager.googleapis.com/Folder"
|
65
|
+
# pattern: "projects/{project}/logs/{log}"
|
66
|
+
# pattern: "folders/{folder}/logs/{log}"
|
67
|
+
# pattern: "organizations/{organization}/logs/{log}"
|
68
|
+
# pattern: "billingAccounts/{billing_account}/logs/{log}"
|
130
69
|
# @!attribute [rw] type
|
131
70
|
# @return [::String]
|
132
71
|
# The resource type. It must be in the format of
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-datastore-v1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gapic-common
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.7'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 2.a
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.7'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.a
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
211
|
+
rubygems_version: 3.3.4
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: API Client library for the Firestore in Datastore mode V1 API
|