google-cloud-datastore-v1 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5756bbbfdf9b930addfb17ff508cd1ff58e698c1381a922a2a1d06c442cc3499
4
- data.tar.gz: '0087211fa2c48a1c58801db241b387eb29543cabe28c5eca2b290ab96c0370cd'
3
+ metadata.gz: 9037ce9b9a83196dc252e29b5210dd7aa5e36c75e9015e5cd685ffa66b4a8294
4
+ data.tar.gz: 932f181b9b2726f89ffa2f59c2b6de3f8d39608c17900ea64cb6ad7a05b24cee
5
5
  SHA512:
6
- metadata.gz: df7ce1dd9962a3e286eab555739ccbd3223b937b53d98f0f68ed5a3b2b3d2e163832f7298e8202e08c961b18788a1de3e7ce8ceec3576009e7ec3522576fedf0
7
- data.tar.gz: e37399f05e9dae3dbec09a7c9f3d4d56cc525d76cda7ccf42b9da787246e387348f034bc5496e3c446c14a325eeba256adb01c4734fe6e85cea999d27c057452
6
+ metadata.gz: bc98b055ee9214faa13ff29a42fabad5857d8c2b50e7ca76d85d251db574ed5a95a6fc34e39dd9920351dccfa9b2637c0886d66a29a6abf51ca49266def389a6
7
+ data.tar.gz: 962be531e28ceae5ca7c621c68b5ec0e2c33a89d3128ad649d14472cb1af02b8abec6978e912d8f0d4d11928542d8dd161239c693902965a1ae7d14d03b4251f
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
@@ -77,6 +77,11 @@ module Google
77
77
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
78
78
  }
79
79
 
80
+ default_config.rpcs.run_aggregation_query.timeout = 60.0
81
+ default_config.rpcs.run_aggregation_query.retry_policy = {
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
83
+ }
84
+
80
85
  default_config.rpcs.begin_transaction.timeout = 60.0
81
86
 
82
87
  default_config.rpcs.commit.timeout = 60.0
@@ -183,13 +188,18 @@ module Google
183
188
  # @param options [::Gapic::CallOptions, ::Hash]
184
189
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
185
190
  #
186
- # @overload lookup(project_id: nil, read_options: nil, keys: nil)
191
+ # @overload lookup(project_id: nil, database_id: nil, read_options: nil, keys: nil)
187
192
  # Pass arguments to `lookup` via keyword arguments. Note that at
188
193
  # least one keyword argument is required. To specify no parameters, or to keep all
189
194
  # the default parameter values, pass an empty Hash as a request object (see above).
190
195
  #
191
196
  # @param project_id [::String]
192
197
  # Required. The ID of the project against which to make the request.
198
+ # @param database_id [::String]
199
+ # The ID of the database against which to make the request.
200
+ #
201
+ # '(default)' is not allowed; please use empty string '' to refer the default
202
+ # database.
193
203
  # @param read_options [::Google::Cloud::Datastore::V1::ReadOptions, ::Hash]
194
204
  # The options for this lookup request.
195
205
  # @param keys [::Array<::Google::Cloud::Datastore::V1::Key, ::Hash>]
@@ -272,13 +282,18 @@ module Google
272
282
  # @param options [::Gapic::CallOptions, ::Hash]
273
283
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
274
284
  #
275
- # @overload run_query(project_id: nil, partition_id: nil, read_options: nil, query: nil, gql_query: nil)
285
+ # @overload run_query(project_id: nil, database_id: nil, partition_id: nil, read_options: nil, query: nil, gql_query: nil)
276
286
  # Pass arguments to `run_query` via keyword arguments. Note that at
277
287
  # least one keyword argument is required. To specify no parameters, or to keep all
278
288
  # the default parameter values, pass an empty Hash as a request object (see above).
279
289
  #
280
290
  # @param project_id [::String]
281
291
  # Required. The ID of the project against which to make the request.
292
+ # @param database_id [::String]
293
+ # The ID of the database against which to make the request.
294
+ #
295
+ # '(default)' is not allowed; please use empty string '' to refer the default
296
+ # database.
282
297
  # @param partition_id [::Google::Cloud::Datastore::V1::PartitionId, ::Hash]
283
298
  # Entities are partitioned into subsets, identified by a partition ID.
284
299
  # Queries are scoped to a single partition.
@@ -289,7 +304,7 @@ module Google
289
304
  # @param query [::Google::Cloud::Datastore::V1::Query, ::Hash]
290
305
  # The query to run.
291
306
  # @param gql_query [::Google::Cloud::Datastore::V1::GqlQuery, ::Hash]
292
- # The GQL query to run.
307
+ # The GQL query to run. This query must be a non-aggregation query.
293
308
  #
294
309
  # @yield [response, operation] Access the result along with the RPC operation
295
310
  # @yieldparam response [::Google::Cloud::Datastore::V1::RunQueryResponse]
@@ -355,6 +370,107 @@ module Google
355
370
  raise ::Google::Cloud::Error.from_error(e)
356
371
  end
357
372
 
373
+ ##
374
+ # Runs an aggregation query.
375
+ #
376
+ # @overload run_aggregation_query(request, options = nil)
377
+ # Pass arguments to `run_aggregation_query` via a request object, either of type
378
+ # {::Google::Cloud::Datastore::V1::RunAggregationQueryRequest} or an equivalent Hash.
379
+ #
380
+ # @param request [::Google::Cloud::Datastore::V1::RunAggregationQueryRequest, ::Hash]
381
+ # A request object representing the call parameters. Required. To specify no
382
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
383
+ # @param options [::Gapic::CallOptions, ::Hash]
384
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
385
+ #
386
+ # @overload run_aggregation_query(project_id: nil, database_id: nil, partition_id: nil, read_options: nil, aggregation_query: nil, gql_query: nil)
387
+ # Pass arguments to `run_aggregation_query` via keyword arguments. Note that at
388
+ # least one keyword argument is required. To specify no parameters, or to keep all
389
+ # the default parameter values, pass an empty Hash as a request object (see above).
390
+ #
391
+ # @param project_id [::String]
392
+ # Required. The ID of the project against which to make the request.
393
+ # @param database_id [::String]
394
+ # The ID of the database against which to make the request.
395
+ #
396
+ # '(default)' is not allowed; please use empty string '' to refer the default
397
+ # database.
398
+ # @param partition_id [::Google::Cloud::Datastore::V1::PartitionId, ::Hash]
399
+ # Entities are partitioned into subsets, identified by a partition ID.
400
+ # Queries are scoped to a single partition.
401
+ # This partition ID is normalized with the standard default context
402
+ # partition ID.
403
+ # @param read_options [::Google::Cloud::Datastore::V1::ReadOptions, ::Hash]
404
+ # The options for this query.
405
+ # @param aggregation_query [::Google::Cloud::Datastore::V1::AggregationQuery, ::Hash]
406
+ # The query to run.
407
+ # @param gql_query [::Google::Cloud::Datastore::V1::GqlQuery, ::Hash]
408
+ # The GQL query to run. This query must be an aggregation query.
409
+ #
410
+ # @yield [response, operation] Access the result along with the RPC operation
411
+ # @yieldparam response [::Google::Cloud::Datastore::V1::RunAggregationQueryResponse]
412
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
413
+ #
414
+ # @return [::Google::Cloud::Datastore::V1::RunAggregationQueryResponse]
415
+ #
416
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
417
+ #
418
+ # @example Basic example
419
+ # require "google/cloud/datastore/v1"
420
+ #
421
+ # # Create a client object. The client can be reused for multiple calls.
422
+ # client = Google::Cloud::Datastore::V1::Datastore::Client.new
423
+ #
424
+ # # Create a request. To set request fields, pass in keyword arguments.
425
+ # request = Google::Cloud::Datastore::V1::RunAggregationQueryRequest.new
426
+ #
427
+ # # Call the run_aggregation_query method.
428
+ # result = client.run_aggregation_query request
429
+ #
430
+ # # The returned object is of type Google::Cloud::Datastore::V1::RunAggregationQueryResponse.
431
+ # p result
432
+ #
433
+ def run_aggregation_query request, options = nil
434
+ raise ::ArgumentError, "request must be provided" if request.nil?
435
+
436
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Datastore::V1::RunAggregationQueryRequest
437
+
438
+ # Converts hash and nil to an options object
439
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
440
+
441
+ # Customize the options with defaults
442
+ metadata = @config.rpcs.run_aggregation_query.metadata.to_h
443
+
444
+ # Set x-goog-api-client and x-goog-user-project headers
445
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
446
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
447
+ gapic_version: ::Google::Cloud::Datastore::V1::VERSION
448
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
449
+
450
+ header_params = {}
451
+ if request.project_id
452
+ header_params["project_id"] = request.project_id
453
+ end
454
+
455
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
456
+ metadata[:"x-goog-request-params"] ||= request_params_header
457
+
458
+ options.apply_defaults timeout: @config.rpcs.run_aggregation_query.timeout,
459
+ metadata: metadata,
460
+ retry_policy: @config.rpcs.run_aggregation_query.retry_policy
461
+
462
+ options.apply_defaults timeout: @config.timeout,
463
+ metadata: @config.metadata,
464
+ retry_policy: @config.retry_policy
465
+
466
+ @datastore_stub.call_rpc :run_aggregation_query, request, options: options do |response, operation|
467
+ yield response, operation if block_given?
468
+ return response
469
+ end
470
+ rescue ::GRPC::BadStatus => e
471
+ raise ::Google::Cloud::Error.from_error(e)
472
+ end
473
+
358
474
  ##
359
475
  # Begins a new transaction.
360
476
  #
@@ -368,13 +484,18 @@ module Google
368
484
  # @param options [::Gapic::CallOptions, ::Hash]
369
485
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
370
486
  #
371
- # @overload begin_transaction(project_id: nil, transaction_options: nil)
487
+ # @overload begin_transaction(project_id: nil, database_id: nil, transaction_options: nil)
372
488
  # Pass arguments to `begin_transaction` via keyword arguments. Note that at
373
489
  # least one keyword argument is required. To specify no parameters, or to keep all
374
490
  # the default parameter values, pass an empty Hash as a request object (see above).
375
491
  #
376
492
  # @param project_id [::String]
377
493
  # Required. The ID of the project against which to make the request.
494
+ # @param database_id [::String]
495
+ # The ID of the database against which to make the request.
496
+ #
497
+ # '(default)' is not allowed; please use empty string '' to refer the default
498
+ # database.
378
499
  # @param transaction_options [::Google::Cloud::Datastore::V1::TransactionOptions, ::Hash]
379
500
  # Options for a new transaction.
380
501
  #
@@ -456,13 +577,18 @@ module Google
456
577
  # @param options [::Gapic::CallOptions, ::Hash]
457
578
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
458
579
  #
459
- # @overload commit(project_id: nil, mode: nil, transaction: nil, mutations: nil)
580
+ # @overload commit(project_id: nil, database_id: nil, mode: nil, transaction: nil, mutations: nil)
460
581
  # Pass arguments to `commit` via keyword arguments. Note that at
461
582
  # least one keyword argument is required. To specify no parameters, or to keep all
462
583
  # the default parameter values, pass an empty Hash as a request object (see above).
463
584
  #
464
585
  # @param project_id [::String]
465
586
  # Required. The ID of the project against which to make the request.
587
+ # @param database_id [::String]
588
+ # The ID of the database against which to make the request.
589
+ #
590
+ # '(default)' is not allowed; please use empty string '' to refer the default
591
+ # database.
466
592
  # @param mode [::Google::Cloud::Datastore::V1::CommitRequest::Mode]
467
593
  # The type of commit to perform. Defaults to `TRANSACTIONAL`.
468
594
  # @param transaction [::String]
@@ -561,13 +687,18 @@ module Google
561
687
  # @param options [::Gapic::CallOptions, ::Hash]
562
688
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
563
689
  #
564
- # @overload rollback(project_id: nil, transaction: nil)
690
+ # @overload rollback(project_id: nil, database_id: nil, transaction: nil)
565
691
  # Pass arguments to `rollback` via keyword arguments. Note that at
566
692
  # least one keyword argument is required. To specify no parameters, or to keep all
567
693
  # the default parameter values, pass an empty Hash as a request object (see above).
568
694
  #
569
695
  # @param project_id [::String]
570
696
  # Required. The ID of the project against which to make the request.
697
+ # @param database_id [::String]
698
+ # The ID of the database against which to make the request.
699
+ #
700
+ # '(default)' is not allowed; please use empty string '' to refer the default
701
+ # database.
571
702
  # @param transaction [::String]
572
703
  # Required. The transaction identifier, returned by a call to
573
704
  # {::Google::Cloud::Datastore::V1::Datastore::Client#begin_transaction Datastore.BeginTransaction}.
@@ -650,13 +781,18 @@ module Google
650
781
  # @param options [::Gapic::CallOptions, ::Hash]
651
782
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
652
783
  #
653
- # @overload allocate_ids(project_id: nil, keys: nil)
784
+ # @overload allocate_ids(project_id: nil, database_id: nil, keys: nil)
654
785
  # Pass arguments to `allocate_ids` via keyword arguments. Note that at
655
786
  # least one keyword argument is required. To specify no parameters, or to keep all
656
787
  # the default parameter values, pass an empty Hash as a request object (see above).
657
788
  #
658
789
  # @param project_id [::String]
659
790
  # Required. The ID of the project against which to make the request.
791
+ # @param database_id [::String]
792
+ # The ID of the database against which to make the request.
793
+ #
794
+ # '(default)' is not allowed; please use empty string '' to refer the default
795
+ # database.
660
796
  # @param keys [::Array<::Google::Cloud::Datastore::V1::Key, ::Hash>]
661
797
  # Required. A list of keys with incomplete key paths for which to allocate IDs.
662
798
  # No key may be reserved/read-only.
@@ -747,7 +883,10 @@ module Google
747
883
  # @param project_id [::String]
748
884
  # Required. The ID of the project against which to make the request.
749
885
  # @param database_id [::String]
750
- # If not empty, the ID of the database against which to make the request.
886
+ # The ID of the database against which to make the request.
887
+ #
888
+ # '(default)' is not allowed; please use empty string '' to refer the default
889
+ # database.
751
890
  # @param keys [::Array<::Google::Cloud::Datastore::V1::Key, ::Hash>]
752
891
  # Required. A list of keys with complete key paths whose numeric IDs should not be
753
892
  # auto-allocated.
@@ -962,6 +1101,11 @@ module Google
962
1101
  #
963
1102
  attr_reader :run_query
964
1103
  ##
1104
+ # RPC-specific configuration for `run_aggregation_query`
1105
+ # @return [::Gapic::Config::Method]
1106
+ #
1107
+ attr_reader :run_aggregation_query
1108
+ ##
965
1109
  # RPC-specific configuration for `begin_transaction`
966
1110
  # @return [::Gapic::Config::Method]
967
1111
  #
@@ -993,6 +1137,8 @@ module Google
993
1137
  @lookup = ::Gapic::Config::Method.new lookup_config
994
1138
  run_query_config = parent_rpcs.run_query if parent_rpcs.respond_to? :run_query
995
1139
  @run_query = ::Gapic::Config::Method.new run_query_config
1140
+ run_aggregation_query_config = parent_rpcs.run_aggregation_query if parent_rpcs.respond_to? :run_aggregation_query
1141
+ @run_aggregation_query = ::Gapic::Config::Method.new run_aggregation_query_config
996
1142
  begin_transaction_config = parent_rpcs.begin_transaction if parent_rpcs.respond_to? :begin_transaction
997
1143
  @begin_transaction = ::Gapic::Config::Method.new begin_transaction_config
998
1144
  commit_config = parent_rpcs.commit if parent_rpcs.respond_to? :commit
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Datastore
23
23
  module V1
24
- VERSION = "0.6.0"
24
+ VERSION = "0.7.0"
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,32 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/datastore/v1/aggregation_result.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/datastore/v1/entity_pb'
7
+ require 'google/datastore/v1/query_pb'
8
+ require 'google/protobuf/timestamp_pb'
9
+
10
+ Google::Protobuf::DescriptorPool.generated_pool.build do
11
+ add_file("google/datastore/v1/aggregation_result.proto", :syntax => :proto3) do
12
+ add_message "google.datastore.v1.AggregationResult" do
13
+ map :aggregate_properties, :string, :message, 2, "google.datastore.v1.Value"
14
+ end
15
+ add_message "google.datastore.v1.AggregationResultBatch" do
16
+ repeated :aggregation_results, :message, 1, "google.datastore.v1.AggregationResult"
17
+ optional :more_results, :enum, 2, "google.datastore.v1.QueryResultBatch.MoreResultsType"
18
+ optional :read_time, :message, 3, "google.protobuf.Timestamp"
19
+ end
20
+ end
21
+ end
22
+
23
+ module Google
24
+ module Cloud
25
+ module Datastore
26
+ module V1
27
+ AggregationResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.AggregationResult").msgclass
28
+ AggregationResultBatch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.AggregationResultBatch").msgclass
29
+ end
30
+ end
31
+ end
32
+ end
@@ -6,6 +6,7 @@ require 'google/protobuf'
6
6
  require 'google/api/annotations_pb'
7
7
  require 'google/api/client_pb'
8
8
  require 'google/api/field_behavior_pb'
9
+ require 'google/datastore/v1/aggregation_result_pb'
9
10
  require 'google/datastore/v1/entity_pb'
10
11
  require 'google/datastore/v1/query_pb'
11
12
  require 'google/protobuf/timestamp_pb'
@@ -14,6 +15,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
14
15
  add_file("google/datastore/v1/datastore.proto", :syntax => :proto3) do
15
16
  add_message "google.datastore.v1.LookupRequest" do
16
17
  optional :project_id, :string, 8
18
+ optional :database_id, :string, 9
17
19
  optional :read_options, :message, 1, "google.datastore.v1.ReadOptions"
18
20
  repeated :keys, :message, 3, "google.datastore.v1.Key"
19
21
  end
@@ -25,6 +27,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
25
27
  end
26
28
  add_message "google.datastore.v1.RunQueryRequest" do
27
29
  optional :project_id, :string, 8
30
+ optional :database_id, :string, 9
28
31
  optional :partition_id, :message, 2, "google.datastore.v1.PartitionId"
29
32
  optional :read_options, :message, 1, "google.datastore.v1.ReadOptions"
30
33
  oneof :query_type do
@@ -36,8 +39,23 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
36
39
  optional :batch, :message, 1, "google.datastore.v1.QueryResultBatch"
37
40
  optional :query, :message, 2, "google.datastore.v1.Query"
38
41
  end
42
+ add_message "google.datastore.v1.RunAggregationQueryRequest" do
43
+ optional :project_id, :string, 8
44
+ optional :database_id, :string, 9
45
+ optional :partition_id, :message, 2, "google.datastore.v1.PartitionId"
46
+ optional :read_options, :message, 1, "google.datastore.v1.ReadOptions"
47
+ oneof :query_type do
48
+ optional :aggregation_query, :message, 3, "google.datastore.v1.AggregationQuery"
49
+ optional :gql_query, :message, 7, "google.datastore.v1.GqlQuery"
50
+ end
51
+ end
52
+ add_message "google.datastore.v1.RunAggregationQueryResponse" do
53
+ optional :batch, :message, 1, "google.datastore.v1.AggregationResultBatch"
54
+ optional :query, :message, 2, "google.datastore.v1.AggregationQuery"
55
+ end
39
56
  add_message "google.datastore.v1.BeginTransactionRequest" do
40
57
  optional :project_id, :string, 8
58
+ optional :database_id, :string, 9
41
59
  optional :transaction_options, :message, 10, "google.datastore.v1.TransactionOptions"
42
60
  end
43
61
  add_message "google.datastore.v1.BeginTransactionResponse" do
@@ -45,12 +63,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
45
63
  end
46
64
  add_message "google.datastore.v1.RollbackRequest" do
47
65
  optional :project_id, :string, 8
66
+ optional :database_id, :string, 9
48
67
  optional :transaction, :bytes, 1
49
68
  end
50
69
  add_message "google.datastore.v1.RollbackResponse" do
51
70
  end
52
71
  add_message "google.datastore.v1.CommitRequest" do
53
72
  optional :project_id, :string, 8
73
+ optional :database_id, :string, 9
54
74
  optional :mode, :enum, 5, "google.datastore.v1.CommitRequest.Mode"
55
75
  repeated :mutations, :message, 6, "google.datastore.v1.Mutation"
56
76
  oneof :transaction_selector do
@@ -69,6 +89,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
69
89
  end
70
90
  add_message "google.datastore.v1.AllocateIdsRequest" do
71
91
  optional :project_id, :string, 8
92
+ optional :database_id, :string, 9
72
93
  repeated :keys, :message, 1, "google.datastore.v1.Key"
73
94
  end
74
95
  add_message "google.datastore.v1.AllocateIdsResponse" do
@@ -134,6 +155,8 @@ module Google
134
155
  LookupResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.LookupResponse").msgclass
135
156
  RunQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.RunQueryRequest").msgclass
136
157
  RunQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.RunQueryResponse").msgclass
158
+ RunAggregationQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.RunAggregationQueryRequest").msgclass
159
+ RunAggregationQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.RunAggregationQueryResponse").msgclass
137
160
  BeginTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.BeginTransactionRequest").msgclass
138
161
  BeginTransactionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.BeginTransactionResponse").msgclass
139
162
  RollbackRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.RollbackRequest").msgclass
@@ -43,6 +43,8 @@ module Google
43
43
  rpc :Lookup, ::Google::Cloud::Datastore::V1::LookupRequest, ::Google::Cloud::Datastore::V1::LookupResponse
44
44
  # Queries for entities.
45
45
  rpc :RunQuery, ::Google::Cloud::Datastore::V1::RunQueryRequest, ::Google::Cloud::Datastore::V1::RunQueryResponse
46
+ # Runs an aggregation query.
47
+ rpc :RunAggregationQuery, ::Google::Cloud::Datastore::V1::RunAggregationQueryRequest, ::Google::Cloud::Datastore::V1::RunAggregationQueryResponse
46
48
  # Begins a new transaction.
47
49
  rpc :BeginTransaction, ::Google::Cloud::Datastore::V1::BeginTransactionRequest, ::Google::Cloud::Datastore::V1::BeginTransactionResponse
48
50
  # Commits a transaction, optionally creating, deleting or modifying some
@@ -11,6 +11,7 @@ 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
13
13
  optional :project_id, :string, 2
14
+ optional :database_id, :string, 3
14
15
  optional :namespace_id, :string, 4
15
16
  end
16
17
  add_message "google.datastore.v1.Key" do
@@ -3,6 +3,7 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
+ require 'google/api/field_behavior_pb'
6
7
  require 'google/datastore/v1/entity_pb'
7
8
  require 'google/protobuf/timestamp_pb'
8
9
  require 'google/protobuf/wrappers_pb'
@@ -32,6 +33,21 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
32
33
  optional :offset, :int32, 10
33
34
  optional :limit, :message, 12, "google.protobuf.Int32Value"
34
35
  end
36
+ add_message "google.datastore.v1.AggregationQuery" do
37
+ repeated :aggregations, :message, 3, "google.datastore.v1.AggregationQuery.Aggregation"
38
+ oneof :query_type do
39
+ optional :nested_query, :message, 1, "google.datastore.v1.Query"
40
+ end
41
+ end
42
+ add_message "google.datastore.v1.AggregationQuery.Aggregation" do
43
+ optional :alias, :string, 7
44
+ oneof :operator do
45
+ optional :count, :message, 1, "google.datastore.v1.AggregationQuery.Aggregation.Count"
46
+ end
47
+ end
48
+ add_message "google.datastore.v1.AggregationQuery.Aggregation.Count" do
49
+ optional :up_to, :message, 1, "google.protobuf.Int64Value"
50
+ end
35
51
  add_message "google.datastore.v1.KindExpression" do
36
52
  optional :name, :string, 1
37
53
  end
@@ -120,6 +136,9 @@ module Google
120
136
  EntityResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.EntityResult").msgclass
121
137
  EntityResult::ResultType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.EntityResult.ResultType").enummodule
122
138
  Query = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.Query").msgclass
139
+ AggregationQuery = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.AggregationQuery").msgclass
140
+ AggregationQuery::Aggregation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.AggregationQuery.Aggregation").msgclass
141
+ AggregationQuery::Aggregation::Count = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.AggregationQuery.Aggregation.Count").msgclass
123
142
  KindExpression = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.KindExpression").msgclass
124
143
  PropertyReference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.PropertyReference").msgclass
125
144
  Projection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.datastore.v1.Projection").msgclass
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Datastore
23
+ module V1
24
+ # The result of a single bucket from a Datastore aggregation query.
25
+ #
26
+ # The keys of `aggregate_properties` are the same for all results in an
27
+ # aggregation query, unlike entity queries which can have different fields
28
+ # present for each result.
29
+ # @!attribute [rw] aggregate_properties
30
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Datastore::V1::Value}]
31
+ # The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
32
+ #
33
+ # The key is the {::Google::Cloud::Datastore::V1::AggregationQuery::Aggregation#alias alias}
34
+ # assigned to the aggregation function on input and the size of this map
35
+ # equals the number of aggregation functions in the query.
36
+ class AggregationResult
37
+ include ::Google::Protobuf::MessageExts
38
+ extend ::Google::Protobuf::MessageExts::ClassMethods
39
+
40
+ # @!attribute [rw] key
41
+ # @return [::String]
42
+ # @!attribute [rw] value
43
+ # @return [::Google::Cloud::Datastore::V1::Value]
44
+ class AggregatePropertiesEntry
45
+ include ::Google::Protobuf::MessageExts
46
+ extend ::Google::Protobuf::MessageExts::ClassMethods
47
+ end
48
+ end
49
+
50
+ # A batch of aggregation results produced by an aggregation query.
51
+ # @!attribute [rw] aggregation_results
52
+ # @return [::Array<::Google::Cloud::Datastore::V1::AggregationResult>]
53
+ # The aggregation results for this batch.
54
+ # @!attribute [rw] more_results
55
+ # @return [::Google::Cloud::Datastore::V1::QueryResultBatch::MoreResultsType]
56
+ # The state of the query after the current batch.
57
+ # Only COUNT(*) aggregations are supported in the initial launch. Therefore,
58
+ # expected result type is limited to `NO_MORE_RESULTS`.
59
+ # @!attribute [rw] read_time
60
+ # @return [::Google::Protobuf::Timestamp]
61
+ # Read timestamp this batch was returned from.
62
+ #
63
+ # In a single transaction, subsequent query result batches for the same query
64
+ # can have a greater timestamp. Each batch's read timestamp
65
+ # is valid for all preceding batches.
66
+ class AggregationResultBatch
67
+ include ::Google::Protobuf::MessageExts
68
+ extend ::Google::Protobuf::MessageExts::ClassMethods
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -25,6 +25,12 @@ module Google
25
25
  # @!attribute [rw] project_id
26
26
  # @return [::String]
27
27
  # Required. The ID of the project against which to make the request.
28
+ # @!attribute [rw] database_id
29
+ # @return [::String]
30
+ # The ID of the database against which to make the request.
31
+ #
32
+ # '(default)' is not allowed; please use empty string '' to refer the default
33
+ # database.
28
34
  # @!attribute [rw] read_options
29
35
  # @return [::Google::Cloud::Datastore::V1::ReadOptions]
30
36
  # The options for this lookup request.
@@ -64,6 +70,12 @@ module Google
64
70
  # @!attribute [rw] project_id
65
71
  # @return [::String]
66
72
  # Required. The ID of the project against which to make the request.
73
+ # @!attribute [rw] database_id
74
+ # @return [::String]
75
+ # The ID of the database against which to make the request.
76
+ #
77
+ # '(default)' is not allowed; please use empty string '' to refer the default
78
+ # database.
67
79
  # @!attribute [rw] partition_id
68
80
  # @return [::Google::Cloud::Datastore::V1::PartitionId]
69
81
  # Entities are partitioned into subsets, identified by a partition ID.
@@ -78,7 +90,7 @@ module Google
78
90
  # The query to run.
79
91
  # @!attribute [rw] gql_query
80
92
  # @return [::Google::Cloud::Datastore::V1::GqlQuery]
81
- # The GQL query to run.
93
+ # The GQL query to run. This query must be a non-aggregation query.
82
94
  class RunQueryRequest
83
95
  include ::Google::Protobuf::MessageExts
84
96
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -96,10 +108,58 @@ module Google
96
108
  extend ::Google::Protobuf::MessageExts::ClassMethods
97
109
  end
98
110
 
111
+ # The request for {::Google::Cloud::Datastore::V1::Datastore::Client#run_aggregation_query Datastore.RunAggregationQuery}.
112
+ # @!attribute [rw] project_id
113
+ # @return [::String]
114
+ # Required. The ID of the project against which to make the request.
115
+ # @!attribute [rw] database_id
116
+ # @return [::String]
117
+ # The ID of the database against which to make the request.
118
+ #
119
+ # '(default)' is not allowed; please use empty string '' to refer the default
120
+ # database.
121
+ # @!attribute [rw] partition_id
122
+ # @return [::Google::Cloud::Datastore::V1::PartitionId]
123
+ # Entities are partitioned into subsets, identified by a partition ID.
124
+ # Queries are scoped to a single partition.
125
+ # This partition ID is normalized with the standard default context
126
+ # partition ID.
127
+ # @!attribute [rw] read_options
128
+ # @return [::Google::Cloud::Datastore::V1::ReadOptions]
129
+ # The options for this query.
130
+ # @!attribute [rw] aggregation_query
131
+ # @return [::Google::Cloud::Datastore::V1::AggregationQuery]
132
+ # The query to run.
133
+ # @!attribute [rw] gql_query
134
+ # @return [::Google::Cloud::Datastore::V1::GqlQuery]
135
+ # The GQL query to run. This query must be an aggregation query.
136
+ class RunAggregationQueryRequest
137
+ include ::Google::Protobuf::MessageExts
138
+ extend ::Google::Protobuf::MessageExts::ClassMethods
139
+ end
140
+
141
+ # The response for {::Google::Cloud::Datastore::V1::Datastore::Client#run_aggregation_query Datastore.RunAggregationQuery}.
142
+ # @!attribute [rw] batch
143
+ # @return [::Google::Cloud::Datastore::V1::AggregationResultBatch]
144
+ # A batch of aggregation results. Always present.
145
+ # @!attribute [rw] query
146
+ # @return [::Google::Cloud::Datastore::V1::AggregationQuery]
147
+ # The parsed form of the `GqlQuery` from the request, if it was set.
148
+ class RunAggregationQueryResponse
149
+ include ::Google::Protobuf::MessageExts
150
+ extend ::Google::Protobuf::MessageExts::ClassMethods
151
+ end
152
+
99
153
  # The request for {::Google::Cloud::Datastore::V1::Datastore::Client#begin_transaction Datastore.BeginTransaction}.
100
154
  # @!attribute [rw] project_id
101
155
  # @return [::String]
102
156
  # Required. The ID of the project against which to make the request.
157
+ # @!attribute [rw] database_id
158
+ # @return [::String]
159
+ # The ID of the database against which to make the request.
160
+ #
161
+ # '(default)' is not allowed; please use empty string '' to refer the default
162
+ # database.
103
163
  # @!attribute [rw] transaction_options
104
164
  # @return [::Google::Cloud::Datastore::V1::TransactionOptions]
105
165
  # Options for a new transaction.
@@ -121,6 +181,12 @@ module Google
121
181
  # @!attribute [rw] project_id
122
182
  # @return [::String]
123
183
  # Required. The ID of the project against which to make the request.
184
+ # @!attribute [rw] database_id
185
+ # @return [::String]
186
+ # The ID of the database against which to make the request.
187
+ #
188
+ # '(default)' is not allowed; please use empty string '' to refer the default
189
+ # database.
124
190
  # @!attribute [rw] transaction
125
191
  # @return [::String]
126
192
  # Required. The transaction identifier, returned by a call to
@@ -141,6 +207,12 @@ module Google
141
207
  # @!attribute [rw] project_id
142
208
  # @return [::String]
143
209
  # Required. The ID of the project against which to make the request.
210
+ # @!attribute [rw] database_id
211
+ # @return [::String]
212
+ # The ID of the database against which to make the request.
213
+ #
214
+ # '(default)' is not allowed; please use empty string '' to refer the default
215
+ # database.
144
216
  # @!attribute [rw] mode
145
217
  # @return [::Google::Cloud::Datastore::V1::CommitRequest::Mode]
146
218
  # The type of commit to perform. Defaults to `TRANSACTIONAL`.
@@ -204,6 +276,12 @@ module Google
204
276
  # @!attribute [rw] project_id
205
277
  # @return [::String]
206
278
  # Required. The ID of the project against which to make the request.
279
+ # @!attribute [rw] database_id
280
+ # @return [::String]
281
+ # The ID of the database against which to make the request.
282
+ #
283
+ # '(default)' is not allowed; please use empty string '' to refer the default
284
+ # database.
207
285
  # @!attribute [rw] keys
208
286
  # @return [::Array<::Google::Cloud::Datastore::V1::Key>]
209
287
  # Required. A list of keys with incomplete key paths for which to allocate IDs.
@@ -229,7 +307,10 @@ module Google
229
307
  # Required. The ID of the project against which to make the request.
230
308
  # @!attribute [rw] database_id
231
309
  # @return [::String]
232
- # If not empty, the ID of the database against which to make the request.
310
+ # The ID of the database against which to make the request.
311
+ #
312
+ # '(default)' is not allowed; please use empty string '' to refer the default
313
+ # database.
233
314
  # @!attribute [rw] keys
234
315
  # @return [::Array<::Google::Cloud::Datastore::V1::Key>]
235
316
  # Required. A list of keys with complete key paths whose numeric IDs should not be
@@ -308,7 +389,6 @@ module Google
308
389
  # @!attribute [rw] read_consistency
309
390
  # @return [::Google::Cloud::Datastore::V1::ReadOptions::ReadConsistency]
310
391
  # The non-transactional read consistency to use.
311
- # Cannot be set to `STRONG` for global queries.
312
392
  # @!attribute [rw] transaction
313
393
  # @return [::String]
314
394
  # The identifier of the transaction in which to read. A
@@ -43,6 +43,10 @@ module Google
43
43
  # @!attribute [rw] project_id
44
44
  # @return [::String]
45
45
  # The ID of the project to which the entities belong.
46
+ # @!attribute [rw] database_id
47
+ # @return [::String]
48
+ # If not empty, the ID of the database to which the entities
49
+ # belong.
46
50
  # @!attribute [rw] namespace_id
47
51
  # @return [::String]
48
52
  # If not empty, the ID of the namespace to which the entities belong.
@@ -116,6 +116,96 @@ module Google
116
116
  extend ::Google::Protobuf::MessageExts::ClassMethods
117
117
  end
118
118
 
119
+ # Datastore query for running an aggregation over a {::Google::Cloud::Datastore::V1::Query Query}.
120
+ # @!attribute [rw] nested_query
121
+ # @return [::Google::Cloud::Datastore::V1::Query]
122
+ # Nested query for aggregation
123
+ # @!attribute [rw] aggregations
124
+ # @return [::Array<::Google::Cloud::Datastore::V1::AggregationQuery::Aggregation>]
125
+ # Optional. Series of aggregations to apply over the results of the `nested_query`.
126
+ #
127
+ # Requires:
128
+ #
129
+ # * A minimum of one and maximum of five aggregations per query.
130
+ class AggregationQuery
131
+ include ::Google::Protobuf::MessageExts
132
+ extend ::Google::Protobuf::MessageExts::ClassMethods
133
+
134
+ # Defines a aggregation that produces a single result.
135
+ # @!attribute [rw] count
136
+ # @return [::Google::Cloud::Datastore::V1::AggregationQuery::Aggregation::Count]
137
+ # Count aggregator.
138
+ # @!attribute [rw] alias
139
+ # @return [::String]
140
+ # Optional. Optional name of the property to store the result of the aggregation.
141
+ #
142
+ # If not provided, Datastore will pick a default name following the format
143
+ # `property_<incremental_id++>`. For example:
144
+ #
145
+ # ```
146
+ # AGGREGATE
147
+ # COUNT_UP_TO(1) AS count_up_to_1,
148
+ # COUNT_UP_TO(2),
149
+ # COUNT_UP_TO(3) AS count_up_to_3,
150
+ # COUNT_UP_TO(4)
151
+ # OVER (
152
+ # ...
153
+ # );
154
+ # ```
155
+ #
156
+ # becomes:
157
+ #
158
+ # ```
159
+ # AGGREGATE
160
+ # COUNT_UP_TO(1) AS count_up_to_1,
161
+ # COUNT_UP_TO(2) AS property_1,
162
+ # COUNT_UP_TO(3) AS count_up_to_3,
163
+ # COUNT_UP_TO(4) AS property_2
164
+ # OVER (
165
+ # ...
166
+ # );
167
+ # ```
168
+ #
169
+ # Requires:
170
+ #
171
+ # * Must be unique across all aggregation aliases.
172
+ # * Conform to {::Google::Cloud::Datastore::V1::Entity#properties entity property name} limitations.
173
+ class Aggregation
174
+ include ::Google::Protobuf::MessageExts
175
+ extend ::Google::Protobuf::MessageExts::ClassMethods
176
+
177
+ # Count of entities that match the query.
178
+ #
179
+ # The `COUNT(*)` aggregation function operates on the entire entity
180
+ # so it does not require a field reference.
181
+ # @!attribute [rw] up_to
182
+ # @return [::Google::Protobuf::Int64Value]
183
+ # Optional. Optional constraint on the maximum number of entities to count.
184
+ #
185
+ # This provides a way to set an upper bound on the number of entities
186
+ # to scan, limiting latency and cost.
187
+ #
188
+ # Unspecified is interpreted as no bound.
189
+ #
190
+ # If a zero value is provided, a count result of zero should always be
191
+ # expected.
192
+ #
193
+ # High-Level Example:
194
+ #
195
+ # ```
196
+ # AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
197
+ # ```
198
+ #
199
+ # Requires:
200
+ #
201
+ # * Must be non-negative when present.
202
+ class Count
203
+ include ::Google::Protobuf::MessageExts
204
+ extend ::Google::Protobuf::MessageExts::ClassMethods
205
+ end
206
+ end
207
+ end
208
+
119
209
  # A representation of a kind.
120
210
  # @!attribute [rw] name
121
211
  # @return [::String]
@@ -187,7 +277,10 @@ module Google
187
277
  # @!attribute [rw] filters
188
278
  # @return [::Array<::Google::Cloud::Datastore::V1::Filter>]
189
279
  # The list of filters to combine.
190
- # Must contain at least one filter.
280
+ #
281
+ # Requires:
282
+ #
283
+ # * At least one filter is present.
191
284
  class CompositeFilter
192
285
  include ::Google::Protobuf::MessageExts
193
286
  extend ::Google::Protobuf::MessageExts::ClassMethods
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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-02 00:00:00.000000000 Z
11
+ date: 2022-10-03 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.10'
19
+ version: '0.12'
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.10'
29
+ version: '0.12'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -175,6 +175,7 @@ files:
175
175
  - lib/google/cloud/datastore/v1/datastore/client.rb
176
176
  - lib/google/cloud/datastore/v1/datastore/credentials.rb
177
177
  - lib/google/cloud/datastore/v1/version.rb
178
+ - lib/google/datastore/v1/aggregation_result_pb.rb
178
179
  - lib/google/datastore/v1/datastore_pb.rb
179
180
  - lib/google/datastore/v1/datastore_services_pb.rb
180
181
  - lib/google/datastore/v1/entity_pb.rb
@@ -182,6 +183,7 @@ files:
182
183
  - proto_docs/README.md
183
184
  - proto_docs/google/api/field_behavior.rb
184
185
  - proto_docs/google/api/resource.rb
186
+ - proto_docs/google/datastore/v1/aggregation_result.rb
185
187
  - proto_docs/google/datastore/v1/datastore.rb
186
188
  - proto_docs/google/datastore/v1/entity.rb
187
189
  - proto_docs/google/datastore/v1/query.rb