google-cloud-firestore 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +47 -0
  4. data/TROUBLESHOOTING.md +2 -8
  5. data/lib/google-cloud-firestore.rb +14 -21
  6. data/lib/google/cloud/firestore.rb +12 -23
  7. data/lib/google/cloud/firestore/client.rb +12 -14
  8. data/lib/google/cloud/firestore/collection_reference.rb +1 -0
  9. data/lib/google/cloud/firestore/collection_reference_list.rb +137 -0
  10. data/lib/google/cloud/firestore/convert.rb +39 -39
  11. data/lib/google/cloud/firestore/credentials.rb +2 -2
  12. data/lib/google/cloud/firestore/document_reference.rb +8 -8
  13. data/lib/google/cloud/firestore/document_reference/list.rb +2 -2
  14. data/lib/google/cloud/firestore/document_snapshot.rb +4 -4
  15. data/lib/google/cloud/firestore/query.rb +4 -4
  16. data/lib/google/cloud/firestore/service.rb +71 -106
  17. data/lib/google/cloud/firestore/transaction.rb +2 -2
  18. data/lib/google/cloud/firestore/version.rb +1 -1
  19. data/lib/google/cloud/firestore/watch/listener.rb +9 -9
  20. data/lib/google/cloud/firestore/watch/order.rb +1 -1
  21. metadata +11 -109
  22. data/lib/google/cloud/firestore/admin.rb +0 -144
  23. data/lib/google/cloud/firestore/admin/v1.rb +0 -151
  24. data/lib/google/cloud/firestore/admin/v1/credentials.rb +0 -44
  25. data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/field.rb +0 -86
  26. data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/firestore_admin.rb +0 -161
  27. data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/index.rb +0 -142
  28. data/lib/google/cloud/firestore/admin/v1/doc/google/longrunning/operations.rb +0 -51
  29. data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/any.rb +0 -131
  30. data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/empty.rb +0 -29
  31. data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/field_mask.rb +0 -222
  32. data/lib/google/cloud/firestore/admin/v1/doc/google/rpc/status.rb +0 -39
  33. data/lib/google/cloud/firestore/admin/v1/firestore_admin_client.rb +0 -764
  34. data/lib/google/cloud/firestore/admin/v1/firestore_admin_client_config.json +0 -72
  35. data/lib/google/cloud/firestore/v1.rb +0 -152
  36. data/lib/google/cloud/firestore/v1/credentials.rb +0 -42
  37. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb +0 -64
  38. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb +0 -136
  39. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb +0 -566
  40. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb +0 -227
  41. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb +0 -241
  42. data/lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb +0 -131
  43. data/lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb +0 -29
  44. data/lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb +0 -113
  45. data/lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb +0 -26
  46. data/lib/google/cloud/firestore/v1/doc/google/rpc/status.rb +0 -39
  47. data/lib/google/cloud/firestore/v1/firestore_client.rb +0 -1073
  48. data/lib/google/cloud/firestore/v1/firestore_client_config.json +0 -101
  49. data/lib/google/cloud/firestore/v1beta1.rb +0 -160
  50. data/lib/google/cloud/firestore/v1beta1/credentials.rb +0 -42
  51. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +0 -64
  52. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +0 -136
  53. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +0 -564
  54. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +0 -227
  55. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +0 -237
  56. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +0 -131
  57. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb +0 -29
  58. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
  59. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +0 -26
  60. data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +0 -39
  61. data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +0 -1081
  62. data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +0 -100
  63. data/lib/google/firestore/admin/v1/field_pb.rb +0 -32
  64. data/lib/google/firestore/admin/v1/firestore_admin_pb.rb +0 -84
  65. data/lib/google/firestore/admin/v1/firestore_admin_services_pb.rb +0 -94
  66. data/lib/google/firestore/admin/v1/index_pb.rb +0 -58
  67. data/lib/google/firestore/admin/v1/location_pb.rb +0 -22
  68. data/lib/google/firestore/admin/v1/operation_pb.rb +0 -90
  69. data/lib/google/firestore/v1/common_pb.rb +0 -45
  70. data/lib/google/firestore/v1/document_pb.rb +0 -50
  71. data/lib/google/firestore/v1/firestore_pb.rb +0 -222
  72. data/lib/google/firestore/v1/firestore_services_pb.rb +0 -80
  73. data/lib/google/firestore/v1/query_pb.rb +0 -107
  74. data/lib/google/firestore/v1/write_pb.rb +0 -80
  75. data/lib/google/firestore/v1beta1/common_pb.rb +0 -45
  76. data/lib/google/firestore/v1beta1/document_pb.rb +0 -50
  77. data/lib/google/firestore/v1beta1/firestore_pb.rb +0 -222
  78. data/lib/google/firestore/v1beta1/firestore_services_pb.rb +0 -89
  79. data/lib/google/firestore/v1beta1/query_pb.rb +0 -107
  80. data/lib/google/firestore/v1beta1/write_pb.rb +0 -79
@@ -1,131 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # `Any` contains an arbitrary serialized protocol buffer message along with a
19
- # URL that describes the type of the serialized message.
20
- #
21
- # Protobuf library provides support to pack/unpack Any values in the form
22
- # of utility functions or additional generated methods of the Any type.
23
- #
24
- # Example 1: Pack and unpack a message in C++.
25
- #
26
- # Foo foo = ...;
27
- # Any any;
28
- # any.PackFrom(foo);
29
- # ...
30
- # if (any.UnpackTo(&foo)) {
31
- # ...
32
- # }
33
- #
34
- # Example 2: Pack and unpack a message in Java.
35
- #
36
- # Foo foo = ...;
37
- # Any any = Any.pack(foo);
38
- # ...
39
- # if (any.is(Foo.class)) {
40
- # foo = any.unpack(Foo.class);
41
- # }
42
- #
43
- # Example 3: Pack and unpack a message in Python.
44
- #
45
- # foo = Foo(...)
46
- # any = Any()
47
- # any.Pack(foo)
48
- # ...
49
- # if any.Is(Foo.DESCRIPTOR):
50
- # any.Unpack(foo)
51
- # ...
52
- #
53
- # Example 4: Pack and unpack a message in Go
54
- #
55
- # foo := &pb.Foo{...}
56
- # any, err := ptypes.MarshalAny(foo)
57
- # ...
58
- # foo := &pb.Foo{}
59
- # if err := ptypes.UnmarshalAny(any, foo); err != nil {
60
- # ...
61
- # }
62
- #
63
- # The pack methods provided by protobuf library will by default use
64
- # 'type.googleapis.com/full.type.name' as the type URL and the unpack
65
- # methods only use the fully qualified type name after the last '/'
66
- # in the type URL, for example "foo.bar.com/x/y.z" will yield type
67
- # name "y.z".
68
- #
69
- #
70
- # = JSON
71
- #
72
- # The JSON representation of an `Any` value uses the regular
73
- # representation of the deserialized, embedded message, with an
74
- # additional field `@type` which contains the type URL. Example:
75
- #
76
- # package google.profile;
77
- # message Person {
78
- # string first_name = 1;
79
- # string last_name = 2;
80
- # }
81
- #
82
- # {
83
- # "@type": "type.googleapis.com/google.profile.Person",
84
- # "firstName": <string>,
85
- # "lastName": <string>
86
- # }
87
- #
88
- # If the embedded message type is well-known and has a custom JSON
89
- # representation, that representation will be embedded adding a field
90
- # `value` which holds the custom JSON in addition to the `@type`
91
- # field. Example (for message {Google::Protobuf::Duration}):
92
- #
93
- # {
94
- # "@type": "type.googleapis.com/google.protobuf.Duration",
95
- # "value": "1.212s"
96
- # }
97
- # @!attribute [rw] type_url
98
- # @return [String]
99
- # A URL/resource name that uniquely identifies the type of the serialized
100
- # protocol buffer message. This string must contain at least
101
- # one "/" character. The last segment of the URL's path must represent
102
- # the fully qualified name of the type (as in
103
- # `path/google.protobuf.Duration`). The name should be in a canonical form
104
- # (e.g., leading "." is not accepted).
105
- #
106
- # In practice, teams usually precompile into the binary all types that they
107
- # expect it to use in the context of Any. However, for URLs which use the
108
- # scheme `http`, `https`, or no scheme, one can optionally set up a type
109
- # server that maps type URLs to message definitions as follows:
110
- #
111
- # * If no scheme is provided, `https` is assumed.
112
- # * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
113
- # value in binary format, or produce an error.
114
- # * Applications are allowed to cache lookup results based on the
115
- # URL, or have them precompiled into a binary to avoid any
116
- # lookup. Therefore, binary compatibility needs to be preserved
117
- # on changes to types. (Use versioned type names to manage
118
- # breaking changes.)
119
- #
120
- # Note: this functionality is not currently available in the official
121
- # protobuf release, and it is not used for type URLs beginning with
122
- # type.googleapis.com.
123
- #
124
- # Schemes other than `http`, `https` (or the empty scheme) might be
125
- # used with implementation specific semantics.
126
- # @!attribute [rw] value
127
- # @return [String]
128
- # Must be a valid serialized protocol buffer of the above specified type.
129
- class Any; end
130
- end
131
- end
@@ -1,29 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A generic empty message that you can re-use to avoid defining duplicated
19
- # empty messages in your APIs. A typical example is to use it as the request
20
- # or the response type of an API method. For instance:
21
- #
22
- # service Foo {
23
- # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
- # }
25
- #
26
- # The JSON representation for `Empty` is empty JSON object `{}`.
27
- class Empty; end
28
- end
29
- end
@@ -1,222 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # `FieldMask` represents a set of symbolic field paths, for example:
19
- #
20
- # paths: "f.a"
21
- # paths: "f.b.d"
22
- #
23
- # Here `f` represents a field in some root message, `a` and `b`
24
- # fields in the message found in `f`, and `d` a field found in the
25
- # message in `f.b`.
26
- #
27
- # Field masks are used to specify a subset of fields that should be
28
- # returned by a get operation or modified by an update operation.
29
- # Field masks also have a custom JSON encoding (see below).
30
- #
31
- # = Field Masks in Projections
32
- #
33
- # When used in the context of a projection, a response message or
34
- # sub-message is filtered by the API to only contain those fields as
35
- # specified in the mask. For example, if the mask in the previous
36
- # example is applied to a response message as follows:
37
- #
38
- # f {
39
- # a : 22
40
- # b {
41
- # d : 1
42
- # x : 2
43
- # }
44
- # y : 13
45
- # }
46
- # z: 8
47
- #
48
- # The result will not contain specific values for fields x,y and z
49
- # (their value will be set to the default, and omitted in proto text
50
- # output):
51
- #
52
- #
53
- # f {
54
- # a : 22
55
- # b {
56
- # d : 1
57
- # }
58
- # }
59
- #
60
- # A repeated field is not allowed except at the last position of a
61
- # paths string.
62
- #
63
- # If a FieldMask object is not present in a get operation, the
64
- # operation applies to all fields (as if a FieldMask of all fields
65
- # had been specified).
66
- #
67
- # Note that a field mask does not necessarily apply to the
68
- # top-level response message. In case of a REST get operation, the
69
- # field mask applies directly to the response, but in case of a REST
70
- # list operation, the mask instead applies to each individual message
71
- # in the returned resource list. In case of a REST custom method,
72
- # other definitions may be used. Where the mask applies will be
73
- # clearly documented together with its declaration in the API. In
74
- # any case, the effect on the returned resource/resources is required
75
- # behavior for APIs.
76
- #
77
- # = Field Masks in Update Operations
78
- #
79
- # A field mask in update operations specifies which fields of the
80
- # targeted resource are going to be updated. The API is required
81
- # to only change the values of the fields as specified in the mask
82
- # and leave the others untouched. If a resource is passed in to
83
- # describe the updated values, the API ignores the values of all
84
- # fields not covered by the mask.
85
- #
86
- # If a repeated field is specified for an update operation, new values will
87
- # be appended to the existing repeated field in the target resource. Note that
88
- # a repeated field is only allowed in the last position of a `paths` string.
89
- #
90
- # If a sub-message is specified in the last position of the field mask for an
91
- # update operation, then new value will be merged into the existing sub-message
92
- # in the target resource.
93
- #
94
- # For example, given the target message:
95
- #
96
- # f {
97
- # b {
98
- # d: 1
99
- # x: 2
100
- # }
101
- # c: [1]
102
- # }
103
- #
104
- # And an update message:
105
- #
106
- # f {
107
- # b {
108
- # d: 10
109
- # }
110
- # c: [2]
111
- # }
112
- #
113
- # then if the field mask is:
114
- #
115
- # paths: ["f.b", "f.c"]
116
- #
117
- # then the result will be:
118
- #
119
- # f {
120
- # b {
121
- # d: 10
122
- # x: 2
123
- # }
124
- # c: [1, 2]
125
- # }
126
- #
127
- # An implementation may provide options to override this default behavior for
128
- # repeated and message fields.
129
- #
130
- # In order to reset a field's value to the default, the field must
131
- # be in the mask and set to the default value in the provided resource.
132
- # Hence, in order to reset all fields of a resource, provide a default
133
- # instance of the resource and set all fields in the mask, or do
134
- # not provide a mask as described below.
135
- #
136
- # If a field mask is not present on update, the operation applies to
137
- # all fields (as if a field mask of all fields has been specified).
138
- # Note that in the presence of schema evolution, this may mean that
139
- # fields the client does not know and has therefore not filled into
140
- # the request will be reset to their default. If this is unwanted
141
- # behavior, a specific service may require a client to always specify
142
- # a field mask, producing an error if not.
143
- #
144
- # As with get operations, the location of the resource which
145
- # describes the updated values in the request message depends on the
146
- # operation kind. In any case, the effect of the field mask is
147
- # required to be honored by the API.
148
- #
149
- # == Considerations for HTTP REST
150
- #
151
- # The HTTP kind of an update operation which uses a field mask must
152
- # be set to PATCH instead of PUT in order to satisfy HTTP semantics
153
- # (PUT must only be used for full updates).
154
- #
155
- # = JSON Encoding of Field Masks
156
- #
157
- # In JSON, a field mask is encoded as a single string where paths are
158
- # separated by a comma. Fields name in each path are converted
159
- # to/from lower-camel naming conventions.
160
- #
161
- # As an example, consider the following message declarations:
162
- #
163
- # message Profile {
164
- # User user = 1;
165
- # Photo photo = 2;
166
- # }
167
- # message User {
168
- # string display_name = 1;
169
- # string address = 2;
170
- # }
171
- #
172
- # In proto a field mask for `Profile` may look as such:
173
- #
174
- # mask {
175
- # paths: "user.display_name"
176
- # paths: "photo"
177
- # }
178
- #
179
- # In JSON, the same mask is represented as below:
180
- #
181
- # {
182
- # mask: "user.displayName,photo"
183
- # }
184
- #
185
- # = Field Masks and Oneof Fields
186
- #
187
- # Field masks treat fields in oneofs just as regular fields. Consider the
188
- # following message:
189
- #
190
- # message SampleMessage {
191
- # oneof test_oneof {
192
- # string name = 4;
193
- # SubMessage sub_message = 9;
194
- # }
195
- # }
196
- #
197
- # The field mask can be:
198
- #
199
- # mask {
200
- # paths: "name"
201
- # }
202
- #
203
- # Or:
204
- #
205
- # mask {
206
- # paths: "sub_message"
207
- # }
208
- #
209
- # Note that oneof type names ("test_oneof" in this case) cannot be used in
210
- # paths.
211
- #
212
- # == Field Mask Verification
213
- #
214
- # The implementation of any API method which has a FieldMask type field in the
215
- # request should verify the included field paths, and return an
216
- # `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
217
- # @!attribute [rw] paths
218
- # @return [Array<String>]
219
- # The set of field mask paths.
220
- class FieldMask; end
221
- end
222
- end
@@ -1,39 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Rpc
18
- # The `Status` type defines a logical error model that is suitable for
19
- # different programming environments, including REST APIs and RPC APIs. It is
20
- # used by [gRPC](https://github.com/grpc). Each `Status` message contains
21
- # three pieces of data: error code, error message, and error details.
22
- #
23
- # You can find out more about this error model and how to work with it in the
24
- # [API Design Guide](https://cloud.google.com/apis/design/errors).
25
- # @!attribute [rw] code
26
- # @return [Integer]
27
- # The status code, which should be an enum value of {Google::Rpc::Code}.
28
- # @!attribute [rw] message
29
- # @return [String]
30
- # A developer-facing error message, which should be in English. Any
31
- # user-facing error message should be localized and sent in the
32
- # {Google::Rpc::Status#details} field, or localized by the client.
33
- # @!attribute [rw] details
34
- # @return [Array<Google::Protobuf::Any>]
35
- # A list of messages that carry the error details. There is a common set of
36
- # message types for APIs to use.
37
- class Status; end
38
- end
39
- end
@@ -1,764 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/firestore/admin/v1/firestore_admin.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/firestore/admin/v1/firestore_admin_pb"
29
- require "google/cloud/firestore/admin/v1/credentials"
30
- require "google/cloud/firestore/version"
31
-
32
- module Google
33
- module Cloud
34
- module Firestore
35
- module Admin
36
- module V1
37
- # Operations are created by service `FirestoreAdmin`, but are accessed via
38
- # service `google.longrunning.Operations`.
39
- #
40
- # @!attribute [r] firestore_admin_stub
41
- # @return [Google::Firestore::Admin::V1::FirestoreAdmin::Stub]
42
- class FirestoreAdminClient
43
- # @private
44
- attr_reader :firestore_admin_stub
45
-
46
- # The default address of the service.
47
- SERVICE_ADDRESS = "firestore.googleapis.com".freeze
48
-
49
- # The default port of the service.
50
- DEFAULT_SERVICE_PORT = 443
51
-
52
- # The default set of gRPC interceptors.
53
- GRPC_INTERCEPTORS = []
54
-
55
- DEFAULT_TIMEOUT = 30
56
-
57
- PAGE_DESCRIPTORS = {
58
- "list_indexes" => Google::Gax::PageDescriptor.new(
59
- "page_token",
60
- "next_page_token",
61
- "indexes"),
62
- "list_fields" => Google::Gax::PageDescriptor.new(
63
- "page_token",
64
- "next_page_token",
65
- "fields")
66
- }.freeze
67
-
68
- private_constant :PAGE_DESCRIPTORS
69
-
70
- # The scopes needed to make gRPC calls to all of the methods defined in
71
- # this service.
72
- ALL_SCOPES = [
73
- "https://www.googleapis.com/auth/cloud-platform",
74
- "https://www.googleapis.com/auth/datastore"
75
- ].freeze
76
-
77
-
78
- DATABASE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
79
- "projects/{project}/databases/{database}"
80
- )
81
-
82
- private_constant :DATABASE_PATH_TEMPLATE
83
-
84
- FIELD_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
85
- "projects/{project}/databases/{database}/collectionGroups/{collection_id}/fields/{field_id}"
86
- )
87
-
88
- private_constant :FIELD_PATH_TEMPLATE
89
-
90
- INDEX_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
91
- "projects/{project}/databases/{database}/collectionGroups/{collection_id}/indexes/{index_id}"
92
- )
93
-
94
- private_constant :INDEX_PATH_TEMPLATE
95
-
96
- PARENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
97
- "projects/{project}/databases/{database}/collectionGroups/{collection_id}"
98
- )
99
-
100
- private_constant :PARENT_PATH_TEMPLATE
101
-
102
- # Returns a fully-qualified database resource name string.
103
- # @param project [String]
104
- # @param database [String]
105
- # @return [String]
106
- def self.database_path project, database
107
- DATABASE_PATH_TEMPLATE.render(
108
- :"project" => project,
109
- :"database" => database
110
- )
111
- end
112
-
113
- # Returns a fully-qualified field resource name string.
114
- # @param project [String]
115
- # @param database [String]
116
- # @param collection_id [String]
117
- # @param field_id [String]
118
- # @return [String]
119
- def self.field_path project, database, collection_id, field_id
120
- FIELD_PATH_TEMPLATE.render(
121
- :"project" => project,
122
- :"database" => database,
123
- :"collection_id" => collection_id,
124
- :"field_id" => field_id
125
- )
126
- end
127
-
128
- # Returns a fully-qualified index resource name string.
129
- # @param project [String]
130
- # @param database [String]
131
- # @param collection_id [String]
132
- # @param index_id [String]
133
- # @return [String]
134
- def self.index_path project, database, collection_id, index_id
135
- INDEX_PATH_TEMPLATE.render(
136
- :"project" => project,
137
- :"database" => database,
138
- :"collection_id" => collection_id,
139
- :"index_id" => index_id
140
- )
141
- end
142
-
143
- # Returns a fully-qualified parent resource name string.
144
- # @param project [String]
145
- # @param database [String]
146
- # @param collection_id [String]
147
- # @return [String]
148
- def self.parent_path project, database, collection_id
149
- PARENT_PATH_TEMPLATE.render(
150
- :"project" => project,
151
- :"database" => database,
152
- :"collection_id" => collection_id
153
- )
154
- end
155
-
156
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
157
- # Provides the means for authenticating requests made by the client. This parameter can
158
- # be many types.
159
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
160
- # authenticating requests made by this client.
161
- # A `String` will be treated as the path to the keyfile to be used for the construction of
162
- # credentials for this client.
163
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
164
- # credentials for this client.
165
- # A `GRPC::Core::Channel` will be used to make calls through.
166
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
167
- # should already be composed with a `GRPC::Core::CallCredentials` object.
168
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
169
- # metadata for requests, generally, to give OAuth credentials.
170
- # @param scopes [Array<String>]
171
- # The OAuth scopes for this service. This parameter is ignored if
172
- # an updater_proc is supplied.
173
- # @param client_config [Hash]
174
- # A Hash for call options for each method. See
175
- # Google::Gax#construct_settings for the structure of
176
- # this data. Falls back to the default config if not specified
177
- # or the specified config is missing data points.
178
- # @param timeout [Numeric]
179
- # The default timeout, in seconds, for calls made through this client.
180
- # @param metadata [Hash]
181
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
182
- # @param service_address [String]
183
- # Override for the service hostname, or `nil` to leave as the default.
184
- # @param service_port [Integer]
185
- # Override for the service port, or `nil` to leave as the default.
186
- # @param exception_transformer [Proc]
187
- # An optional proc that intercepts any exceptions raised during an API call to inject
188
- # custom error handling.
189
- def initialize \
190
- credentials: nil,
191
- scopes: ALL_SCOPES,
192
- client_config: {},
193
- timeout: DEFAULT_TIMEOUT,
194
- metadata: nil,
195
- service_address: nil,
196
- service_port: nil,
197
- exception_transformer: nil,
198
- lib_name: nil,
199
- lib_version: ""
200
- # These require statements are intentionally placed here to initialize
201
- # the gRPC module only when it's required.
202
- # See https://github.com/googleapis/toolkit/issues/446
203
- require "google/gax/grpc"
204
- require "google/firestore/admin/v1/firestore_admin_services_pb"
205
-
206
- credentials ||= Google::Cloud::Firestore::Admin::V1::Credentials.default
207
-
208
- if credentials.is_a?(String) || credentials.is_a?(Hash)
209
- updater_proc = Google::Cloud::Firestore::Admin::V1::Credentials.new(credentials).updater_proc
210
- end
211
- if credentials.is_a?(GRPC::Core::Channel)
212
- channel = credentials
213
- end
214
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
215
- chan_creds = credentials
216
- end
217
- if credentials.is_a?(Proc)
218
- updater_proc = credentials
219
- end
220
- if credentials.is_a?(Google::Auth::Credentials)
221
- updater_proc = credentials.updater_proc
222
- end
223
-
224
- package_version = Google::Cloud::Firestore::VERSION
225
-
226
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
227
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
228
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
229
- google_api_client << " grpc/#{GRPC::VERSION}"
230
- google_api_client.freeze
231
-
232
- headers = { :"x-goog-api-client" => google_api_client }
233
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
234
- headers[:"x-goog-user-project"] = credentials.quota_project_id
235
- end
236
- headers.merge!(metadata) unless metadata.nil?
237
- client_config_file = Pathname.new(__dir__).join(
238
- "firestore_admin_client_config.json"
239
- )
240
- defaults = client_config_file.open do |f|
241
- Google::Gax.construct_settings(
242
- "google.firestore.admin.v1.FirestoreAdmin",
243
- JSON.parse(f.read),
244
- client_config,
245
- Google::Gax::Grpc::STATUS_CODE_NAMES,
246
- timeout,
247
- page_descriptors: PAGE_DESCRIPTORS,
248
- errors: Google::Gax::Grpc::API_ERRORS,
249
- metadata: headers
250
- )
251
- end
252
-
253
- # Allow overriding the service path/port in subclasses.
254
- service_path = service_address || self.class::SERVICE_ADDRESS
255
- port = service_port || self.class::DEFAULT_SERVICE_PORT
256
- interceptors = self.class::GRPC_INTERCEPTORS
257
- @firestore_admin_stub = Google::Gax::Grpc.create_stub(
258
- service_path,
259
- port,
260
- chan_creds: chan_creds,
261
- channel: channel,
262
- updater_proc: updater_proc,
263
- scopes: scopes,
264
- interceptors: interceptors,
265
- &Google::Firestore::Admin::V1::FirestoreAdmin::Stub.method(:new)
266
- )
267
-
268
- @create_index = Google::Gax.create_api_call(
269
- @firestore_admin_stub.method(:create_index),
270
- defaults["create_index"],
271
- exception_transformer: exception_transformer,
272
- params_extractor: proc do |request|
273
- {'parent' => request.parent}
274
- end
275
- )
276
- @list_indexes = Google::Gax.create_api_call(
277
- @firestore_admin_stub.method(:list_indexes),
278
- defaults["list_indexes"],
279
- exception_transformer: exception_transformer,
280
- params_extractor: proc do |request|
281
- {'parent' => request.parent}
282
- end
283
- )
284
- @get_index = Google::Gax.create_api_call(
285
- @firestore_admin_stub.method(:get_index),
286
- defaults["get_index"],
287
- exception_transformer: exception_transformer,
288
- params_extractor: proc do |request|
289
- {'name' => request.name}
290
- end
291
- )
292
- @delete_index = Google::Gax.create_api_call(
293
- @firestore_admin_stub.method(:delete_index),
294
- defaults["delete_index"],
295
- exception_transformer: exception_transformer,
296
- params_extractor: proc do |request|
297
- {'name' => request.name}
298
- end
299
- )
300
- @import_documents = Google::Gax.create_api_call(
301
- @firestore_admin_stub.method(:import_documents),
302
- defaults["import_documents"],
303
- exception_transformer: exception_transformer,
304
- params_extractor: proc do |request|
305
- {'name' => request.name}
306
- end
307
- )
308
- @export_documents = Google::Gax.create_api_call(
309
- @firestore_admin_stub.method(:export_documents),
310
- defaults["export_documents"],
311
- exception_transformer: exception_transformer,
312
- params_extractor: proc do |request|
313
- {'name' => request.name}
314
- end
315
- )
316
- @get_field = Google::Gax.create_api_call(
317
- @firestore_admin_stub.method(:get_field),
318
- defaults["get_field"],
319
- exception_transformer: exception_transformer,
320
- params_extractor: proc do |request|
321
- {'name' => request.name}
322
- end
323
- )
324
- @list_fields = Google::Gax.create_api_call(
325
- @firestore_admin_stub.method(:list_fields),
326
- defaults["list_fields"],
327
- exception_transformer: exception_transformer,
328
- params_extractor: proc do |request|
329
- {'parent' => request.parent}
330
- end
331
- )
332
- @update_field = Google::Gax.create_api_call(
333
- @firestore_admin_stub.method(:update_field),
334
- defaults["update_field"],
335
- exception_transformer: exception_transformer,
336
- params_extractor: proc do |request|
337
- {'field.name' => request.field.name}
338
- end
339
- )
340
- end
341
-
342
- # Service calls
343
-
344
- # Creates a composite index. This returns a {Google::Longrunning::Operation}
345
- # which may be used to track the status of the creation. The metadata for
346
- # the operation will be the type {Google::Firestore::Admin::V1::IndexOperationMetadata IndexOperationMetadata}.
347
- #
348
- # @param parent [String]
349
- # Required. A parent name of the form
350
- # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
351
- # @param index [Google::Firestore::Admin::V1::Index | Hash]
352
- # Required. The composite index to create.
353
- # A hash of the same form as `Google::Firestore::Admin::V1::Index`
354
- # can also be provided.
355
- # @param options [Google::Gax::CallOptions]
356
- # Overrides the default settings for this call, e.g, timeout,
357
- # retries, etc.
358
- # @yield [result, operation] Access the result along with the RPC operation
359
- # @yieldparam result [Google::Longrunning::Operation]
360
- # @yieldparam operation [GRPC::ActiveCall::Operation]
361
- # @return [Google::Longrunning::Operation]
362
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
363
- # @example
364
- # require "google/cloud/firestore/admin"
365
- #
366
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
367
- # formatted_parent = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]")
368
- #
369
- # # TODO: Initialize `index`:
370
- # index = {}
371
- # response = firestore_admin_client.create_index(formatted_parent, index)
372
-
373
- def create_index \
374
- parent,
375
- index,
376
- options: nil,
377
- &block
378
- req = {
379
- parent: parent,
380
- index: index
381
- }.delete_if { |_, v| v.nil? }
382
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::CreateIndexRequest)
383
- @create_index.call(req, options, &block)
384
- end
385
-
386
- # Lists composite indexes.
387
- #
388
- # @param parent [String]
389
- # Required. A parent name of the form
390
- # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
391
- # @param filter [String]
392
- # The filter to apply to list results.
393
- # @param page_size [Integer]
394
- # The maximum number of resources contained in the underlying API
395
- # response. If page streaming is performed per-resource, this
396
- # parameter does not affect the return value. If page streaming is
397
- # performed per-page, this determines the maximum number of
398
- # resources in a page.
399
- # @param options [Google::Gax::CallOptions]
400
- # Overrides the default settings for this call, e.g, timeout,
401
- # retries, etc.
402
- # @yield [result, operation] Access the result along with the RPC operation
403
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Firestore::Admin::V1::Index>]
404
- # @yieldparam operation [GRPC::ActiveCall::Operation]
405
- # @return [Google::Gax::PagedEnumerable<Google::Firestore::Admin::V1::Index>]
406
- # An enumerable of Google::Firestore::Admin::V1::Index instances.
407
- # See Google::Gax::PagedEnumerable documentation for other
408
- # operations such as per-page iteration or access to the response
409
- # object.
410
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
411
- # @example
412
- # require "google/cloud/firestore/admin"
413
- #
414
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
415
- # formatted_parent = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]")
416
- #
417
- # # Iterate over all results.
418
- # firestore_admin_client.list_indexes(formatted_parent).each do |element|
419
- # # Process element.
420
- # end
421
- #
422
- # # Or iterate over results one page at a time.
423
- # firestore_admin_client.list_indexes(formatted_parent).each_page do |page|
424
- # # Process each page at a time.
425
- # page.each do |element|
426
- # # Process element.
427
- # end
428
- # end
429
-
430
- def list_indexes \
431
- parent,
432
- filter: nil,
433
- page_size: nil,
434
- options: nil,
435
- &block
436
- req = {
437
- parent: parent,
438
- filter: filter,
439
- page_size: page_size
440
- }.delete_if { |_, v| v.nil? }
441
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::ListIndexesRequest)
442
- @list_indexes.call(req, options, &block)
443
- end
444
-
445
- # Gets a composite index.
446
- #
447
- # @param name [String]
448
- # Required. A name of the form
449
- # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
450
- # @param options [Google::Gax::CallOptions]
451
- # Overrides the default settings for this call, e.g, timeout,
452
- # retries, etc.
453
- # @yield [result, operation] Access the result along with the RPC operation
454
- # @yieldparam result [Google::Firestore::Admin::V1::Index]
455
- # @yieldparam operation [GRPC::ActiveCall::Operation]
456
- # @return [Google::Firestore::Admin::V1::Index]
457
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
458
- # @example
459
- # require "google/cloud/firestore/admin"
460
- #
461
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
462
- # formatted_name = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.index_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]")
463
- # response = firestore_admin_client.get_index(formatted_name)
464
-
465
- def get_index \
466
- name,
467
- options: nil,
468
- &block
469
- req = {
470
- name: name
471
- }.delete_if { |_, v| v.nil? }
472
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::GetIndexRequest)
473
- @get_index.call(req, options, &block)
474
- end
475
-
476
- # Deletes a composite index.
477
- #
478
- # @param name [String]
479
- # Required. A name of the form
480
- # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
481
- # @param options [Google::Gax::CallOptions]
482
- # Overrides the default settings for this call, e.g, timeout,
483
- # retries, etc.
484
- # @yield [result, operation] Access the result along with the RPC operation
485
- # @yieldparam result []
486
- # @yieldparam operation [GRPC::ActiveCall::Operation]
487
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
488
- # @example
489
- # require "google/cloud/firestore/admin"
490
- #
491
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
492
- # formatted_name = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.index_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]")
493
- # firestore_admin_client.delete_index(formatted_name)
494
-
495
- def delete_index \
496
- name,
497
- options: nil,
498
- &block
499
- req = {
500
- name: name
501
- }.delete_if { |_, v| v.nil? }
502
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::DeleteIndexRequest)
503
- @delete_index.call(req, options, &block)
504
- nil
505
- end
506
-
507
- # Imports documents into Google Cloud Firestore. Existing documents with the
508
- # same name are overwritten. The import occurs in the background and its
509
- # progress can be monitored and managed via the Operation resource that is
510
- # created. If an ImportDocuments operation is cancelled, it is possible
511
- # that a subset of the data has already been imported to Cloud Firestore.
512
- #
513
- # @param name [String]
514
- # Required. Database to import into. Should be of the form:
515
- # `projects/{project_id}/databases/{database_id}`.
516
- # @param collection_ids [Array<String>]
517
- # Which collection ids to import. Unspecified means all collections included
518
- # in the import.
519
- # @param input_uri_prefix [String]
520
- # Location of the exported files.
521
- # This must match the output_uri_prefix of an ExportDocumentsResponse from
522
- # an export that has completed successfully.
523
- # See:
524
- # {Google::Firestore::Admin::V1::ExportDocumentsResponse#output_uri_prefix}.
525
- # @param options [Google::Gax::CallOptions]
526
- # Overrides the default settings for this call, e.g, timeout,
527
- # retries, etc.
528
- # @yield [result, operation] Access the result along with the RPC operation
529
- # @yieldparam result [Google::Longrunning::Operation]
530
- # @yieldparam operation [GRPC::ActiveCall::Operation]
531
- # @return [Google::Longrunning::Operation]
532
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
533
- # @example
534
- # require "google/cloud/firestore/admin"
535
- #
536
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
537
- # formatted_name = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.database_path("[PROJECT]", "[DATABASE]")
538
- # response = firestore_admin_client.import_documents(formatted_name)
539
-
540
- def import_documents \
541
- name,
542
- collection_ids: nil,
543
- input_uri_prefix: nil,
544
- options: nil,
545
- &block
546
- req = {
547
- name: name,
548
- collection_ids: collection_ids,
549
- input_uri_prefix: input_uri_prefix
550
- }.delete_if { |_, v| v.nil? }
551
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::ImportDocumentsRequest)
552
- @import_documents.call(req, options, &block)
553
- end
554
-
555
- # Exports a copy of all or a subset of documents from Google Cloud Firestore
556
- # to another storage system, such as Google Cloud Storage. Recent updates to
557
- # documents may not be reflected in the export. The export occurs in the
558
- # background and its progress can be monitored and managed via the
559
- # Operation resource that is created. The output of an export may only be
560
- # used once the associated operation is done. If an export operation is
561
- # cancelled before completion it may leave partial data behind in Google
562
- # Cloud Storage.
563
- #
564
- # @param name [String]
565
- # Required. Database to export. Should be of the form:
566
- # `projects/{project_id}/databases/{database_id}`.
567
- # @param collection_ids [Array<String>]
568
- # Which collection ids to export. Unspecified means all collections.
569
- # @param output_uri_prefix [String]
570
- # The output URI. Currently only supports Google Cloud Storage URIs of the
571
- # form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
572
- # of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
573
- # Google Cloud Storage namespace path. When
574
- # choosing a name, be sure to consider Google Cloud Storage naming
575
- # guidelines: https://cloud.google.com/storage/docs/naming.
576
- # If the URI is a bucket (without a namespace path), a prefix will be
577
- # generated based on the start time.
578
- # @param options [Google::Gax::CallOptions]
579
- # Overrides the default settings for this call, e.g, timeout,
580
- # retries, etc.
581
- # @yield [result, operation] Access the result along with the RPC operation
582
- # @yieldparam result [Google::Longrunning::Operation]
583
- # @yieldparam operation [GRPC::ActiveCall::Operation]
584
- # @return [Google::Longrunning::Operation]
585
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
586
- # @example
587
- # require "google/cloud/firestore/admin"
588
- #
589
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
590
- # formatted_name = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.database_path("[PROJECT]", "[DATABASE]")
591
- # response = firestore_admin_client.export_documents(formatted_name)
592
-
593
- def export_documents \
594
- name,
595
- collection_ids: nil,
596
- output_uri_prefix: nil,
597
- options: nil,
598
- &block
599
- req = {
600
- name: name,
601
- collection_ids: collection_ids,
602
- output_uri_prefix: output_uri_prefix
603
- }.delete_if { |_, v| v.nil? }
604
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::ExportDocumentsRequest)
605
- @export_documents.call(req, options, &block)
606
- end
607
-
608
- # Gets the metadata and configuration for a Field.
609
- #
610
- # @param name [String]
611
- # Required. A name of the form
612
- # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
613
- # @param options [Google::Gax::CallOptions]
614
- # Overrides the default settings for this call, e.g, timeout,
615
- # retries, etc.
616
- # @yield [result, operation] Access the result along with the RPC operation
617
- # @yieldparam result [Google::Firestore::Admin::V1::Field]
618
- # @yieldparam operation [GRPC::ActiveCall::Operation]
619
- # @return [Google::Firestore::Admin::V1::Field]
620
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
621
- # @example
622
- # require "google/cloud/firestore/admin"
623
- #
624
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
625
- # formatted_name = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.field_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]")
626
- # response = firestore_admin_client.get_field(formatted_name)
627
-
628
- def get_field \
629
- name,
630
- options: nil,
631
- &block
632
- req = {
633
- name: name
634
- }.delete_if { |_, v| v.nil? }
635
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::GetFieldRequest)
636
- @get_field.call(req, options, &block)
637
- end
638
-
639
- # Lists the field configuration and metadata for this database.
640
- #
641
- # Currently, {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields} only supports listing fields
642
- # that have been explicitly overridden. To issue this query, call
643
- # {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields} with the filter set to
644
- # `indexConfig.usesAncestorConfig:false`.
645
- #
646
- # @param parent [String]
647
- # Required. A parent name of the form
648
- # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
649
- # @param filter [String]
650
- # The filter to apply to list results. Currently,
651
- # {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields} only supports listing fields
652
- # that have been explicitly overridden. To issue this query, call
653
- # {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields} with the filter set to
654
- # `indexConfig.usesAncestorConfig:false`.
655
- # @param page_size [Integer]
656
- # The maximum number of resources contained in the underlying API
657
- # response. If page streaming is performed per-resource, this
658
- # parameter does not affect the return value. If page streaming is
659
- # performed per-page, this determines the maximum number of
660
- # resources in a page.
661
- # @param options [Google::Gax::CallOptions]
662
- # Overrides the default settings for this call, e.g, timeout,
663
- # retries, etc.
664
- # @yield [result, operation] Access the result along with the RPC operation
665
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Firestore::Admin::V1::Field>]
666
- # @yieldparam operation [GRPC::ActiveCall::Operation]
667
- # @return [Google::Gax::PagedEnumerable<Google::Firestore::Admin::V1::Field>]
668
- # An enumerable of Google::Firestore::Admin::V1::Field instances.
669
- # See Google::Gax::PagedEnumerable documentation for other
670
- # operations such as per-page iteration or access to the response
671
- # object.
672
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
673
- # @example
674
- # require "google/cloud/firestore/admin"
675
- #
676
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
677
- # formatted_parent = Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]")
678
- #
679
- # # Iterate over all results.
680
- # firestore_admin_client.list_fields(formatted_parent).each do |element|
681
- # # Process element.
682
- # end
683
- #
684
- # # Or iterate over results one page at a time.
685
- # firestore_admin_client.list_fields(formatted_parent).each_page do |page|
686
- # # Process each page at a time.
687
- # page.each do |element|
688
- # # Process element.
689
- # end
690
- # end
691
-
692
- def list_fields \
693
- parent,
694
- filter: nil,
695
- page_size: nil,
696
- options: nil,
697
- &block
698
- req = {
699
- parent: parent,
700
- filter: filter,
701
- page_size: page_size
702
- }.delete_if { |_, v| v.nil? }
703
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::ListFieldsRequest)
704
- @list_fields.call(req, options, &block)
705
- end
706
-
707
- # Updates a field configuration. Currently, field updates apply only to
708
- # single field index configuration. However, calls to
709
- # {Google::Firestore::Admin::V1::FirestoreAdmin::UpdateField FirestoreAdmin::UpdateField} should provide a field mask to avoid
710
- # changing any configuration that the caller isn't aware of. The field mask
711
- # should be specified as: `{ paths: "index_config" }`.
712
- #
713
- # This call returns a {Google::Longrunning::Operation} which may be used to
714
- # track the status of the field update. The metadata for
715
- # the operation will be the type {Google::Firestore::Admin::V1::FieldOperationMetadata FieldOperationMetadata}.
716
- #
717
- # To configure the default field settings for the database, use
718
- # the special `Field` with resource name:
719
- # `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
720
- #
721
- # @param field [Google::Firestore::Admin::V1::Field | Hash]
722
- # Required. The field to be updated.
723
- # A hash of the same form as `Google::Firestore::Admin::V1::Field`
724
- # can also be provided.
725
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
726
- # A mask, relative to the field. If specified, only configuration specified
727
- # by this field_mask will be updated in the field.
728
- # A hash of the same form as `Google::Protobuf::FieldMask`
729
- # can also be provided.
730
- # @param options [Google::Gax::CallOptions]
731
- # Overrides the default settings for this call, e.g, timeout,
732
- # retries, etc.
733
- # @yield [result, operation] Access the result along with the RPC operation
734
- # @yieldparam result [Google::Longrunning::Operation]
735
- # @yieldparam operation [GRPC::ActiveCall::Operation]
736
- # @return [Google::Longrunning::Operation]
737
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
738
- # @example
739
- # require "google/cloud/firestore/admin"
740
- #
741
- # firestore_admin_client = Google::Cloud::Firestore::Admin.new(version: :v1)
742
- #
743
- # # TODO: Initialize `field`:
744
- # field = {}
745
- # response = firestore_admin_client.update_field(field)
746
-
747
- def update_field \
748
- field,
749
- update_mask: nil,
750
- options: nil,
751
- &block
752
- req = {
753
- field: field,
754
- update_mask: update_mask
755
- }.delete_if { |_, v| v.nil? }
756
- req = Google::Gax::to_proto(req, Google::Firestore::Admin::V1::UpdateFieldRequest)
757
- @update_field.call(req, options, &block)
758
- end
759
- end
760
- end
761
- end
762
- end
763
- end
764
- end