google-cloud-firestore-admin-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +75 -0
  6. data/lib/google-cloud-firestore-admin-v1.rb +21 -0
  7. data/lib/google/cloud/firestore/admin/v1.rb +37 -0
  8. data/lib/google/cloud/firestore/admin/v1/firestore_admin.rb +53 -0
  9. data/lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb +1105 -0
  10. data/lib/google/cloud/firestore/admin/v1/firestore_admin/credentials.rb +54 -0
  11. data/lib/google/cloud/firestore/admin/v1/firestore_admin/operations.rb +572 -0
  12. data/lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb +113 -0
  13. data/lib/google/cloud/firestore/admin/v1/version.rb +30 -0
  14. data/lib/google/firestore/admin/v1/field_pb.rb +35 -0
  15. data/lib/google/firestore/admin/v1/firestore_admin_pb.rb +87 -0
  16. data/lib/google/firestore/admin/v1/firestore_admin_services_pb.rb +95 -0
  17. data/lib/google/firestore/admin/v1/index_pb.rb +61 -0
  18. data/lib/google/firestore/admin/v1/location_pb.rb +25 -0
  19. data/lib/google/firestore/admin/v1/operation_pb.rb +93 -0
  20. data/proto_docs/README.md +4 -0
  21. data/proto_docs/google/api/field_behavior.rb +59 -0
  22. data/proto_docs/google/api/resource.rb +247 -0
  23. data/proto_docs/google/firestore/admin/v1/field.rb +98 -0
  24. data/proto_docs/google/firestore/admin/v1/firestore_admin.rb +200 -0
  25. data/proto_docs/google/firestore/admin/v1/index.rb +154 -0
  26. data/proto_docs/google/firestore/admin/v1/location.rb +34 -0
  27. data/proto_docs/google/firestore/admin/v1/operation.rb +222 -0
  28. data/proto_docs/google/longrunning/operations.rb +150 -0
  29. data/proto_docs/google/protobuf/any.rb +138 -0
  30. data/proto_docs/google/protobuf/empty.rb +36 -0
  31. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  32. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  33. data/proto_docs/google/rpc/status.rb +46 -0
  34. data/proto_docs/google/type/latlng.rb +38 -0
  35. metadata +216 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/firestore/admin/v1"
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ require "google/cloud/firestore/admin/v1/firestore_admin"
20
+ require "google/cloud/firestore/admin/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Firestore
25
+ module Admin
26
+ ##
27
+ # To load this package, including all its services, and instantiate a client:
28
+ #
29
+ # require "google/cloud/firestore/admin/v1"
30
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
31
+ #
32
+ module V1
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/firestore/admin/v1/version"
24
+
25
+ require "google/cloud/firestore/admin/v1/firestore_admin/credentials"
26
+ require "google/cloud/firestore/admin/v1/firestore_admin/paths"
27
+ require "google/cloud/firestore/admin/v1/firestore_admin/operations"
28
+ require "google/cloud/firestore/admin/v1/firestore_admin/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Firestore
33
+ module Admin
34
+ module V1
35
+ ##
36
+ # Operations are created by service `FirestoreAdmin`, but are accessed via
37
+ # service `google.longrunning.Operations`.
38
+ #
39
+ # To load this service and instantiate a client:
40
+ #
41
+ # require "google/cloud/firestore/admin/v1/firestore_admin"
42
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
43
+ #
44
+ module FirestoreAdmin
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "firestore_admin", "helpers.rb"
53
+ require "google/cloud/firestore/admin/v1/firestore_admin/helpers" if ::File.file? helper_path
@@ -0,0 +1,1105 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ require "google/cloud/errors"
20
+ require "google/firestore/admin/v1/firestore_admin_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Firestore
25
+ module Admin
26
+ module V1
27
+ module FirestoreAdmin
28
+ ##
29
+ # Client for the FirestoreAdmin service.
30
+ #
31
+ # Operations are created by service `FirestoreAdmin`, but are accessed via
32
+ # service `google.longrunning.Operations`.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :firestore_admin_stub
39
+
40
+ ##
41
+ # Configure the FirestoreAdmin Client class.
42
+ #
43
+ # See {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # ## Example
47
+ #
48
+ # To modify the configuration for all FirestoreAdmin clients:
49
+ #
50
+ # ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Firestore", "Admin", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const&.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.rpcs.create_index.timeout = 60.0
71
+
72
+ default_config.rpcs.list_indexes.timeout = 60.0
73
+ default_config.rpcs.list_indexes.retry_policy = {
74
+ initial_delay: 0.1,
75
+ max_delay: 60.0,
76
+ multiplier: 1.3,
77
+ retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
78
+ }
79
+
80
+ default_config.rpcs.get_index.timeout = 60.0
81
+ default_config.rpcs.get_index.retry_policy = {
82
+ initial_delay: 0.1,
83
+ max_delay: 60.0,
84
+ multiplier: 1.3,
85
+ retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
86
+ }
87
+
88
+ default_config.rpcs.delete_index.timeout = 60.0
89
+ default_config.rpcs.delete_index.retry_policy = {
90
+ initial_delay: 0.1,
91
+ max_delay: 60.0,
92
+ multiplier: 1.3,
93
+ retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
94
+ }
95
+
96
+ default_config.rpcs.get_field.timeout = 60.0
97
+ default_config.rpcs.get_field.retry_policy = {
98
+ initial_delay: 0.1,
99
+ max_delay: 60.0,
100
+ multiplier: 1.3,
101
+ retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
102
+ }
103
+
104
+ default_config.rpcs.update_field.timeout = 60.0
105
+
106
+ default_config.rpcs.list_fields.timeout = 60.0
107
+ default_config.rpcs.list_fields.retry_policy = {
108
+ initial_delay: 0.1,
109
+ max_delay: 60.0,
110
+ multiplier: 1.3,
111
+ retry_codes: ["UNAVAILABLE", "INTERNAL", "DEADLINE_EXCEEDED"]
112
+ }
113
+
114
+ default_config.rpcs.export_documents.timeout = 60.0
115
+
116
+ default_config.rpcs.import_documents.timeout = 60.0
117
+
118
+ default_config
119
+ end
120
+ yield @configure if block_given?
121
+ @configure
122
+ end
123
+
124
+ ##
125
+ # Configure the FirestoreAdmin Client instance.
126
+ #
127
+ # The configuration is set to the derived mode, meaning that values can be changed,
128
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
129
+ # should be made on {Client.configure}.
130
+ #
131
+ # See {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client::Configuration}
132
+ # for a description of the configuration fields.
133
+ #
134
+ # @yield [config] Configure the Client client.
135
+ # @yieldparam config [Client::Configuration]
136
+ #
137
+ # @return [Client::Configuration]
138
+ #
139
+ def configure
140
+ yield @config if block_given?
141
+ @config
142
+ end
143
+
144
+ ##
145
+ # Create a new FirestoreAdmin client object.
146
+ #
147
+ # ## Examples
148
+ #
149
+ # To create a new FirestoreAdmin client with the default
150
+ # configuration:
151
+ #
152
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
153
+ #
154
+ # To create a new FirestoreAdmin client with a custom
155
+ # configuration:
156
+ #
157
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new do |config|
158
+ # config.timeout = 10.0
159
+ # end
160
+ #
161
+ # @yield [config] Configure the FirestoreAdmin client.
162
+ # @yieldparam config [Client::Configuration]
163
+ #
164
+ def initialize
165
+ # These require statements are intentionally placed here to initialize
166
+ # the gRPC module only when it's required.
167
+ # See https://github.com/googleapis/toolkit/issues/446
168
+ require "gapic/grpc"
169
+ require "google/firestore/admin/v1/firestore_admin_services_pb"
170
+
171
+ # Create the configuration object
172
+ @config = Configuration.new Client.configure
173
+
174
+ # Yield the configuration if needed
175
+ yield @config if block_given?
176
+
177
+ # Create credentials
178
+ credentials = @config.credentials
179
+ credentials ||= Credentials.default scope: @config.scope
180
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
181
+ credentials = Credentials.new credentials, scope: @config.scope
182
+ end
183
+ @quota_project_id = @config.quota_project
184
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
185
+
186
+ @operations_client = Operations.new do |config|
187
+ config.credentials = credentials
188
+ config.endpoint = @config.endpoint
189
+ end
190
+
191
+ @firestore_admin_stub = ::Gapic::ServiceStub.new(
192
+ ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Stub,
193
+ credentials: credentials,
194
+ endpoint: @config.endpoint,
195
+ channel_args: @config.channel_args,
196
+ interceptors: @config.interceptors
197
+ )
198
+ end
199
+
200
+ ##
201
+ # Get the associated client for long-running operations.
202
+ #
203
+ # @return [::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Operations]
204
+ #
205
+ attr_reader :operations_client
206
+
207
+ # Service calls
208
+
209
+ ##
210
+ # Creates a composite index. This returns a {::Google::Longrunning::Operation google.longrunning.Operation}
211
+ # which may be used to track the status of the creation. The metadata for
212
+ # the operation will be the type {::Google::Cloud::Firestore::Admin::V1::IndexOperationMetadata IndexOperationMetadata}.
213
+ #
214
+ # @overload create_index(request, options = nil)
215
+ # Pass arguments to `create_index` via a request object, either of type
216
+ # {::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest} or an equivalent Hash.
217
+ #
218
+ # @param request [::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest, ::Hash]
219
+ # A request object representing the call parameters. Required. To specify no
220
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
221
+ # @param options [::Gapic::CallOptions, ::Hash]
222
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
223
+ #
224
+ # @overload create_index(parent: nil, index: nil)
225
+ # Pass arguments to `create_index` via keyword arguments. Note that at
226
+ # least one keyword argument is required. To specify no parameters, or to keep all
227
+ # the default parameter values, pass an empty Hash as a request object (see above).
228
+ #
229
+ # @param parent [::String]
230
+ # Required. A parent name of the form
231
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
232
+ # @param index [::Google::Cloud::Firestore::Admin::V1::Index, ::Hash]
233
+ # Required. The composite index to create.
234
+ #
235
+ # @yield [response, operation] Access the result along with the RPC operation
236
+ # @yieldparam response [::Gapic::Operation]
237
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
238
+ #
239
+ # @return [::Gapic::Operation]
240
+ #
241
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
242
+ #
243
+ def create_index request, options = nil
244
+ raise ::ArgumentError, "request must be provided" if request.nil?
245
+
246
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest
247
+
248
+ # Converts hash and nil to an options object
249
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
250
+
251
+ # Customize the options with defaults
252
+ metadata = @config.rpcs.create_index.metadata.to_h
253
+
254
+ # Set x-goog-api-client and x-goog-user-project headers
255
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
256
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
257
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
258
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
259
+
260
+ header_params = {
261
+ "parent" => request.parent
262
+ }
263
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
264
+ metadata[:"x-goog-request-params"] ||= request_params_header
265
+
266
+ options.apply_defaults timeout: @config.rpcs.create_index.timeout,
267
+ metadata: metadata,
268
+ retry_policy: @config.rpcs.create_index.retry_policy
269
+ options.apply_defaults metadata: @config.metadata,
270
+ retry_policy: @config.retry_policy
271
+
272
+ @firestore_admin_stub.call_rpc :create_index, request, options: options do |response, operation|
273
+ response = ::Gapic::Operation.new response, @operations_client, options: options
274
+ yield response, operation if block_given?
275
+ return response
276
+ end
277
+ rescue ::GRPC::BadStatus => e
278
+ raise ::Google::Cloud::Error.from_error(e)
279
+ end
280
+
281
+ ##
282
+ # Lists composite indexes.
283
+ #
284
+ # @overload list_indexes(request, options = nil)
285
+ # Pass arguments to `list_indexes` via a request object, either of type
286
+ # {::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest} or an equivalent Hash.
287
+ #
288
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest, ::Hash]
289
+ # A request object representing the call parameters. Required. To specify no
290
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
291
+ # @param options [::Gapic::CallOptions, ::Hash]
292
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
293
+ #
294
+ # @overload list_indexes(parent: nil, filter: nil, page_size: nil, page_token: nil)
295
+ # Pass arguments to `list_indexes` via keyword arguments. Note that at
296
+ # least one keyword argument is required. To specify no parameters, or to keep all
297
+ # the default parameter values, pass an empty Hash as a request object (see above).
298
+ #
299
+ # @param parent [::String]
300
+ # Required. A parent name of the form
301
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
302
+ # @param filter [::String]
303
+ # The filter to apply to list results.
304
+ # @param page_size [::Integer]
305
+ # The number of results to return.
306
+ # @param page_token [::String]
307
+ # A page token, returned from a previous call to
308
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_indexes FirestoreAdmin.ListIndexes}, that may be used to get the next
309
+ # page of results.
310
+ #
311
+ # @yield [response, operation] Access the result along with the RPC operation
312
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>]
313
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
314
+ #
315
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>]
316
+ #
317
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
318
+ #
319
+ def list_indexes request, options = nil
320
+ raise ::ArgumentError, "request must be provided" if request.nil?
321
+
322
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest
323
+
324
+ # Converts hash and nil to an options object
325
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
326
+
327
+ # Customize the options with defaults
328
+ metadata = @config.rpcs.list_indexes.metadata.to_h
329
+
330
+ # Set x-goog-api-client and x-goog-user-project headers
331
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
332
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
333
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
334
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
335
+
336
+ header_params = {
337
+ "parent" => request.parent
338
+ }
339
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
340
+ metadata[:"x-goog-request-params"] ||= request_params_header
341
+
342
+ options.apply_defaults timeout: @config.rpcs.list_indexes.timeout,
343
+ metadata: metadata,
344
+ retry_policy: @config.rpcs.list_indexes.retry_policy
345
+ options.apply_defaults metadata: @config.metadata,
346
+ retry_policy: @config.retry_policy
347
+
348
+ @firestore_admin_stub.call_rpc :list_indexes, request, options: options do |response, operation|
349
+ response = ::Gapic::PagedEnumerable.new @firestore_admin_stub, :list_indexes, request, response, operation, options
350
+ yield response, operation if block_given?
351
+ return response
352
+ end
353
+ rescue ::GRPC::BadStatus => e
354
+ raise ::Google::Cloud::Error.from_error(e)
355
+ end
356
+
357
+ ##
358
+ # Gets a composite index.
359
+ #
360
+ # @overload get_index(request, options = nil)
361
+ # Pass arguments to `get_index` via a request object, either of type
362
+ # {::Google::Cloud::Firestore::Admin::V1::GetIndexRequest} or an equivalent Hash.
363
+ #
364
+ # @param request [::Google::Cloud::Firestore::Admin::V1::GetIndexRequest, ::Hash]
365
+ # A request object representing the call parameters. Required. To specify no
366
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
367
+ # @param options [::Gapic::CallOptions, ::Hash]
368
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
369
+ #
370
+ # @overload get_index(name: nil)
371
+ # Pass arguments to `get_index` via keyword arguments. Note that at
372
+ # least one keyword argument is required. To specify no parameters, or to keep all
373
+ # the default parameter values, pass an empty Hash as a request object (see above).
374
+ #
375
+ # @param name [::String]
376
+ # Required. A name of the form
377
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
378
+ #
379
+ # @yield [response, operation] Access the result along with the RPC operation
380
+ # @yieldparam response [::Google::Cloud::Firestore::Admin::V1::Index]
381
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
382
+ #
383
+ # @return [::Google::Cloud::Firestore::Admin::V1::Index]
384
+ #
385
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
386
+ #
387
+ def get_index request, options = nil
388
+ raise ::ArgumentError, "request must be provided" if request.nil?
389
+
390
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetIndexRequest
391
+
392
+ # Converts hash and nil to an options object
393
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
394
+
395
+ # Customize the options with defaults
396
+ metadata = @config.rpcs.get_index.metadata.to_h
397
+
398
+ # Set x-goog-api-client and x-goog-user-project headers
399
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
400
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
401
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
402
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
403
+
404
+ header_params = {
405
+ "name" => request.name
406
+ }
407
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
408
+ metadata[:"x-goog-request-params"] ||= request_params_header
409
+
410
+ options.apply_defaults timeout: @config.rpcs.get_index.timeout,
411
+ metadata: metadata,
412
+ retry_policy: @config.rpcs.get_index.retry_policy
413
+ options.apply_defaults metadata: @config.metadata,
414
+ retry_policy: @config.retry_policy
415
+
416
+ @firestore_admin_stub.call_rpc :get_index, request, options: options do |response, operation|
417
+ yield response, operation if block_given?
418
+ return response
419
+ end
420
+ rescue ::GRPC::BadStatus => e
421
+ raise ::Google::Cloud::Error.from_error(e)
422
+ end
423
+
424
+ ##
425
+ # Deletes a composite index.
426
+ #
427
+ # @overload delete_index(request, options = nil)
428
+ # Pass arguments to `delete_index` via a request object, either of type
429
+ # {::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest} or an equivalent Hash.
430
+ #
431
+ # @param request [::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest, ::Hash]
432
+ # A request object representing the call parameters. Required. To specify no
433
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
434
+ # @param options [::Gapic::CallOptions, ::Hash]
435
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
436
+ #
437
+ # @overload delete_index(name: nil)
438
+ # Pass arguments to `delete_index` via keyword arguments. Note that at
439
+ # least one keyword argument is required. To specify no parameters, or to keep all
440
+ # the default parameter values, pass an empty Hash as a request object (see above).
441
+ #
442
+ # @param name [::String]
443
+ # Required. A name of the form
444
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
445
+ #
446
+ # @yield [response, operation] Access the result along with the RPC operation
447
+ # @yieldparam response [::Google::Protobuf::Empty]
448
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
449
+ #
450
+ # @return [::Google::Protobuf::Empty]
451
+ #
452
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
453
+ #
454
+ def delete_index request, options = nil
455
+ raise ::ArgumentError, "request must be provided" if request.nil?
456
+
457
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest
458
+
459
+ # Converts hash and nil to an options object
460
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
461
+
462
+ # Customize the options with defaults
463
+ metadata = @config.rpcs.delete_index.metadata.to_h
464
+
465
+ # Set x-goog-api-client and x-goog-user-project headers
466
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
467
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
468
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
469
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
470
+
471
+ header_params = {
472
+ "name" => request.name
473
+ }
474
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
475
+ metadata[:"x-goog-request-params"] ||= request_params_header
476
+
477
+ options.apply_defaults timeout: @config.rpcs.delete_index.timeout,
478
+ metadata: metadata,
479
+ retry_policy: @config.rpcs.delete_index.retry_policy
480
+ options.apply_defaults metadata: @config.metadata,
481
+ retry_policy: @config.retry_policy
482
+
483
+ @firestore_admin_stub.call_rpc :delete_index, request, options: options do |response, operation|
484
+ yield response, operation if block_given?
485
+ return response
486
+ end
487
+ rescue ::GRPC::BadStatus => e
488
+ raise ::Google::Cloud::Error.from_error(e)
489
+ end
490
+
491
+ ##
492
+ # Gets the metadata and configuration for a Field.
493
+ #
494
+ # @overload get_field(request, options = nil)
495
+ # Pass arguments to `get_field` via a request object, either of type
496
+ # {::Google::Cloud::Firestore::Admin::V1::GetFieldRequest} or an equivalent Hash.
497
+ #
498
+ # @param request [::Google::Cloud::Firestore::Admin::V1::GetFieldRequest, ::Hash]
499
+ # A request object representing the call parameters. Required. To specify no
500
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
501
+ # @param options [::Gapic::CallOptions, ::Hash]
502
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
503
+ #
504
+ # @overload get_field(name: nil)
505
+ # Pass arguments to `get_field` via keyword arguments. Note that at
506
+ # least one keyword argument is required. To specify no parameters, or to keep all
507
+ # the default parameter values, pass an empty Hash as a request object (see above).
508
+ #
509
+ # @param name [::String]
510
+ # Required. A name of the form
511
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
512
+ #
513
+ # @yield [response, operation] Access the result along with the RPC operation
514
+ # @yieldparam response [::Google::Cloud::Firestore::Admin::V1::Field]
515
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
516
+ #
517
+ # @return [::Google::Cloud::Firestore::Admin::V1::Field]
518
+ #
519
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
520
+ #
521
+ def get_field request, options = nil
522
+ raise ::ArgumentError, "request must be provided" if request.nil?
523
+
524
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetFieldRequest
525
+
526
+ # Converts hash and nil to an options object
527
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
528
+
529
+ # Customize the options with defaults
530
+ metadata = @config.rpcs.get_field.metadata.to_h
531
+
532
+ # Set x-goog-api-client and x-goog-user-project headers
533
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
534
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
535
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
536
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
537
+
538
+ header_params = {
539
+ "name" => request.name
540
+ }
541
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
542
+ metadata[:"x-goog-request-params"] ||= request_params_header
543
+
544
+ options.apply_defaults timeout: @config.rpcs.get_field.timeout,
545
+ metadata: metadata,
546
+ retry_policy: @config.rpcs.get_field.retry_policy
547
+ options.apply_defaults metadata: @config.metadata,
548
+ retry_policy: @config.retry_policy
549
+
550
+ @firestore_admin_stub.call_rpc :get_field, request, options: options do |response, operation|
551
+ yield response, operation if block_given?
552
+ return response
553
+ end
554
+ rescue ::GRPC::BadStatus => e
555
+ raise ::Google::Cloud::Error.from_error(e)
556
+ end
557
+
558
+ ##
559
+ # Updates a field configuration. Currently, field updates apply only to
560
+ # single field index configuration. However, calls to
561
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#update_field FirestoreAdmin.UpdateField} should provide a field mask to avoid
562
+ # changing any configuration that the caller isn't aware of. The field mask
563
+ # should be specified as: `{ paths: "index_config" }`.
564
+ #
565
+ # This call returns a {::Google::Longrunning::Operation google.longrunning.Operation} which may be used to
566
+ # track the status of the field update. The metadata for
567
+ # the operation will be the type {::Google::Cloud::Firestore::Admin::V1::FieldOperationMetadata FieldOperationMetadata}.
568
+ #
569
+ # To configure the default field settings for the database, use
570
+ # the special `Field` with resource name:
571
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
572
+ #
573
+ # @overload update_field(request, options = nil)
574
+ # Pass arguments to `update_field` via a request object, either of type
575
+ # {::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest} or an equivalent Hash.
576
+ #
577
+ # @param request [::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest, ::Hash]
578
+ # A request object representing the call parameters. Required. To specify no
579
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
580
+ # @param options [::Gapic::CallOptions, ::Hash]
581
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
582
+ #
583
+ # @overload update_field(field: nil, update_mask: nil)
584
+ # Pass arguments to `update_field` via keyword arguments. Note that at
585
+ # least one keyword argument is required. To specify no parameters, or to keep all
586
+ # the default parameter values, pass an empty Hash as a request object (see above).
587
+ #
588
+ # @param field [::Google::Cloud::Firestore::Admin::V1::Field, ::Hash]
589
+ # Required. The field to be updated.
590
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
591
+ # A mask, relative to the field. If specified, only configuration specified
592
+ # by this field_mask will be updated in the field.
593
+ #
594
+ # @yield [response, operation] Access the result along with the RPC operation
595
+ # @yieldparam response [::Gapic::Operation]
596
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
597
+ #
598
+ # @return [::Gapic::Operation]
599
+ #
600
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
601
+ #
602
+ def update_field request, options = nil
603
+ raise ::ArgumentError, "request must be provided" if request.nil?
604
+
605
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest
606
+
607
+ # Converts hash and nil to an options object
608
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
609
+
610
+ # Customize the options with defaults
611
+ metadata = @config.rpcs.update_field.metadata.to_h
612
+
613
+ # Set x-goog-api-client and x-goog-user-project headers
614
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
615
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
616
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
617
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
618
+
619
+ header_params = {
620
+ "field.name" => request.field.name
621
+ }
622
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
623
+ metadata[:"x-goog-request-params"] ||= request_params_header
624
+
625
+ options.apply_defaults timeout: @config.rpcs.update_field.timeout,
626
+ metadata: metadata,
627
+ retry_policy: @config.rpcs.update_field.retry_policy
628
+ options.apply_defaults metadata: @config.metadata,
629
+ retry_policy: @config.retry_policy
630
+
631
+ @firestore_admin_stub.call_rpc :update_field, request, options: options do |response, operation|
632
+ response = ::Gapic::Operation.new response, @operations_client, options: options
633
+ yield response, operation if block_given?
634
+ return response
635
+ end
636
+ rescue ::GRPC::BadStatus => e
637
+ raise ::Google::Cloud::Error.from_error(e)
638
+ end
639
+
640
+ ##
641
+ # Lists the field configuration and metadata for this database.
642
+ #
643
+ # Currently, {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
644
+ # that have been explicitly overridden. To issue this query, call
645
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with the filter set to
646
+ # `indexConfig.usesAncestorConfig:false`.
647
+ #
648
+ # @overload list_fields(request, options = nil)
649
+ # Pass arguments to `list_fields` via a request object, either of type
650
+ # {::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest} or an equivalent Hash.
651
+ #
652
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest, ::Hash]
653
+ # A request object representing the call parameters. Required. To specify no
654
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
655
+ # @param options [::Gapic::CallOptions, ::Hash]
656
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
657
+ #
658
+ # @overload list_fields(parent: nil, filter: nil, page_size: nil, page_token: nil)
659
+ # Pass arguments to `list_fields` via keyword arguments. Note that at
660
+ # least one keyword argument is required. To specify no parameters, or to keep all
661
+ # the default parameter values, pass an empty Hash as a request object (see above).
662
+ #
663
+ # @param parent [::String]
664
+ # Required. A parent name of the form
665
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
666
+ # @param filter [::String]
667
+ # The filter to apply to list results. Currently,
668
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
669
+ # that have been explicitly overridden. To issue this query, call
670
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with the filter set to
671
+ # `indexConfig.usesAncestorConfig:false`.
672
+ # @param page_size [::Integer]
673
+ # The number of results to return.
674
+ # @param page_token [::String]
675
+ # A page token, returned from a previous call to
676
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields}, that may be used to get the next
677
+ # page of results.
678
+ #
679
+ # @yield [response, operation] Access the result along with the RPC operation
680
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>]
681
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
682
+ #
683
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>]
684
+ #
685
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
686
+ #
687
+ def list_fields request, options = nil
688
+ raise ::ArgumentError, "request must be provided" if request.nil?
689
+
690
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest
691
+
692
+ # Converts hash and nil to an options object
693
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
694
+
695
+ # Customize the options with defaults
696
+ metadata = @config.rpcs.list_fields.metadata.to_h
697
+
698
+ # Set x-goog-api-client and x-goog-user-project headers
699
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
700
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
701
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
702
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
703
+
704
+ header_params = {
705
+ "parent" => request.parent
706
+ }
707
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
708
+ metadata[:"x-goog-request-params"] ||= request_params_header
709
+
710
+ options.apply_defaults timeout: @config.rpcs.list_fields.timeout,
711
+ metadata: metadata,
712
+ retry_policy: @config.rpcs.list_fields.retry_policy
713
+ options.apply_defaults metadata: @config.metadata,
714
+ retry_policy: @config.retry_policy
715
+
716
+ @firestore_admin_stub.call_rpc :list_fields, request, options: options do |response, operation|
717
+ response = ::Gapic::PagedEnumerable.new @firestore_admin_stub, :list_fields, request, response, operation, options
718
+ yield response, operation if block_given?
719
+ return response
720
+ end
721
+ rescue ::GRPC::BadStatus => e
722
+ raise ::Google::Cloud::Error.from_error(e)
723
+ end
724
+
725
+ ##
726
+ # Exports a copy of all or a subset of documents from Google Cloud Firestore
727
+ # to another storage system, such as Google Cloud Storage. Recent updates to
728
+ # documents may not be reflected in the export. The export occurs in the
729
+ # background and its progress can be monitored and managed via the
730
+ # Operation resource that is created. The output of an export may only be
731
+ # used once the associated operation is done. If an export operation is
732
+ # cancelled before completion it may leave partial data behind in Google
733
+ # Cloud Storage.
734
+ #
735
+ # @overload export_documents(request, options = nil)
736
+ # Pass arguments to `export_documents` via a request object, either of type
737
+ # {::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest} or an equivalent Hash.
738
+ #
739
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest, ::Hash]
740
+ # A request object representing the call parameters. Required. To specify no
741
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
742
+ # @param options [::Gapic::CallOptions, ::Hash]
743
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
744
+ #
745
+ # @overload export_documents(name: nil, collection_ids: nil, output_uri_prefix: nil)
746
+ # Pass arguments to `export_documents` via keyword arguments. Note that at
747
+ # least one keyword argument is required. To specify no parameters, or to keep all
748
+ # the default parameter values, pass an empty Hash as a request object (see above).
749
+ #
750
+ # @param name [::String]
751
+ # Required. Database to export. Should be of the form:
752
+ # `projects/{project_id}/databases/{database_id}`.
753
+ # @param collection_ids [::Array<::String>]
754
+ # Which collection ids to export. Unspecified means all collections.
755
+ # @param output_uri_prefix [::String]
756
+ # The output URI. Currently only supports Google Cloud Storage URIs of the
757
+ # form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
758
+ # of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
759
+ # Google Cloud Storage namespace path. When
760
+ # choosing a name, be sure to consider Google Cloud Storage naming
761
+ # guidelines: https://cloud.google.com/storage/docs/naming.
762
+ # If the URI is a bucket (without a namespace path), a prefix will be
763
+ # generated based on the start time.
764
+ #
765
+ # @yield [response, operation] Access the result along with the RPC operation
766
+ # @yieldparam response [::Gapic::Operation]
767
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
768
+ #
769
+ # @return [::Gapic::Operation]
770
+ #
771
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
772
+ #
773
+ def export_documents request, options = nil
774
+ raise ::ArgumentError, "request must be provided" if request.nil?
775
+
776
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest
777
+
778
+ # Converts hash and nil to an options object
779
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
780
+
781
+ # Customize the options with defaults
782
+ metadata = @config.rpcs.export_documents.metadata.to_h
783
+
784
+ # Set x-goog-api-client and x-goog-user-project headers
785
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
786
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
787
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
788
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
789
+
790
+ header_params = {
791
+ "name" => request.name
792
+ }
793
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
794
+ metadata[:"x-goog-request-params"] ||= request_params_header
795
+
796
+ options.apply_defaults timeout: @config.rpcs.export_documents.timeout,
797
+ metadata: metadata,
798
+ retry_policy: @config.rpcs.export_documents.retry_policy
799
+ options.apply_defaults metadata: @config.metadata,
800
+ retry_policy: @config.retry_policy
801
+
802
+ @firestore_admin_stub.call_rpc :export_documents, request, options: options do |response, operation|
803
+ response = ::Gapic::Operation.new response, @operations_client, options: options
804
+ yield response, operation if block_given?
805
+ return response
806
+ end
807
+ rescue ::GRPC::BadStatus => e
808
+ raise ::Google::Cloud::Error.from_error(e)
809
+ end
810
+
811
+ ##
812
+ # Imports documents into Google Cloud Firestore. Existing documents with the
813
+ # same name are overwritten. The import occurs in the background and its
814
+ # progress can be monitored and managed via the Operation resource that is
815
+ # created. If an ImportDocuments operation is cancelled, it is possible
816
+ # that a subset of the data has already been imported to Cloud Firestore.
817
+ #
818
+ # @overload import_documents(request, options = nil)
819
+ # Pass arguments to `import_documents` via a request object, either of type
820
+ # {::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest} or an equivalent Hash.
821
+ #
822
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest, ::Hash]
823
+ # A request object representing the call parameters. Required. To specify no
824
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
825
+ # @param options [::Gapic::CallOptions, ::Hash]
826
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
827
+ #
828
+ # @overload import_documents(name: nil, collection_ids: nil, input_uri_prefix: nil)
829
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
830
+ # least one keyword argument is required. To specify no parameters, or to keep all
831
+ # the default parameter values, pass an empty Hash as a request object (see above).
832
+ #
833
+ # @param name [::String]
834
+ # Required. Database to import into. Should be of the form:
835
+ # `projects/{project_id}/databases/{database_id}`.
836
+ # @param collection_ids [::Array<::String>]
837
+ # Which collection ids to import. Unspecified means all collections included
838
+ # in the import.
839
+ # @param input_uri_prefix [::String]
840
+ # Location of the exported files.
841
+ # This must match the output_uri_prefix of an ExportDocumentsResponse from
842
+ # an export that has completed successfully.
843
+ # See:
844
+ # {::Google::Cloud::Firestore::Admin::V1::ExportDocumentsResponse#output_uri_prefix google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix}.
845
+ #
846
+ # @yield [response, operation] Access the result along with the RPC operation
847
+ # @yieldparam response [::Gapic::Operation]
848
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
849
+ #
850
+ # @return [::Gapic::Operation]
851
+ #
852
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
853
+ #
854
+ def import_documents request, options = nil
855
+ raise ::ArgumentError, "request must be provided" if request.nil?
856
+
857
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest
858
+
859
+ # Converts hash and nil to an options object
860
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
861
+
862
+ # Customize the options with defaults
863
+ metadata = @config.rpcs.import_documents.metadata.to_h
864
+
865
+ # Set x-goog-api-client and x-goog-user-project headers
866
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
867
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
868
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
869
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
870
+
871
+ header_params = {
872
+ "name" => request.name
873
+ }
874
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
875
+ metadata[:"x-goog-request-params"] ||= request_params_header
876
+
877
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
878
+ metadata: metadata,
879
+ retry_policy: @config.rpcs.import_documents.retry_policy
880
+ options.apply_defaults metadata: @config.metadata,
881
+ retry_policy: @config.retry_policy
882
+
883
+ @firestore_admin_stub.call_rpc :import_documents, request, options: options do |response, operation|
884
+ response = ::Gapic::Operation.new response, @operations_client, options: options
885
+ yield response, operation if block_given?
886
+ return response
887
+ end
888
+ rescue ::GRPC::BadStatus => e
889
+ raise ::Google::Cloud::Error.from_error(e)
890
+ end
891
+
892
+ ##
893
+ # Configuration class for the FirestoreAdmin API.
894
+ #
895
+ # This class represents the configuration for FirestoreAdmin,
896
+ # providing control over timeouts, retry behavior, logging, transport
897
+ # parameters, and other low-level controls. Certain parameters can also be
898
+ # applied individually to specific RPCs. See
899
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client::Configuration::Rpcs}
900
+ # for a list of RPCs that can be configured independently.
901
+ #
902
+ # Configuration can be applied globally to all clients, or to a single client
903
+ # on construction.
904
+ #
905
+ # # Examples
906
+ #
907
+ # To modify the global config, setting the timeout for create_index
908
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
909
+ #
910
+ # ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.configure do |config|
911
+ # config.timeout = 10.0
912
+ # config.rpcs.create_index.timeout = 20.0
913
+ # end
914
+ #
915
+ # To apply the above configuration only to a new client:
916
+ #
917
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new do |config|
918
+ # config.timeout = 10.0
919
+ # config.rpcs.create_index.timeout = 20.0
920
+ # end
921
+ #
922
+ # @!attribute [rw] endpoint
923
+ # The hostname or hostname:port of the service endpoint.
924
+ # Defaults to `"firestore.googleapis.com"`.
925
+ # @return [::String]
926
+ # @!attribute [rw] credentials
927
+ # Credentials to send with calls. You may provide any of the following types:
928
+ # * (`String`) The path to a service account key file in JSON format
929
+ # * (`Hash`) A service account key as a Hash
930
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
931
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
932
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
933
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
934
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
935
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
936
+ # * (`nil`) indicating no credentials
937
+ # @return [::Object]
938
+ # @!attribute [rw] scope
939
+ # The OAuth scopes
940
+ # @return [::Array<::String>]
941
+ # @!attribute [rw] lib_name
942
+ # The library name as recorded in instrumentation and logging
943
+ # @return [::String]
944
+ # @!attribute [rw] lib_version
945
+ # The library version as recorded in instrumentation and logging
946
+ # @return [::String]
947
+ # @!attribute [rw] channel_args
948
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
949
+ # `GRPC::Core::Channel` object is provided as the credential.
950
+ # @return [::Hash]
951
+ # @!attribute [rw] interceptors
952
+ # An array of interceptors that are run before calls are executed.
953
+ # @return [::Array<::GRPC::ClientInterceptor>]
954
+ # @!attribute [rw] timeout
955
+ # The call timeout in seconds.
956
+ # @return [::Numeric]
957
+ # @!attribute [rw] metadata
958
+ # Additional gRPC headers to be sent with the call.
959
+ # @return [::Hash{::Symbol=>::String}]
960
+ # @!attribute [rw] retry_policy
961
+ # The retry policy. The value is a hash with the following keys:
962
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
963
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
964
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
965
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
966
+ # trigger a retry.
967
+ # @return [::Hash]
968
+ # @!attribute [rw] quota_project
969
+ # A separate project against which to charge quota.
970
+ # @return [::String]
971
+ #
972
+ class Configuration
973
+ extend ::Gapic::Config
974
+
975
+ config_attr :endpoint, "firestore.googleapis.com", ::String
976
+ config_attr :credentials, nil do |value|
977
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
978
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
979
+ allowed.any? { |klass| klass === value }
980
+ end
981
+ config_attr :scope, nil, ::String, ::Array, nil
982
+ config_attr :lib_name, nil, ::String, nil
983
+ config_attr :lib_version, nil, ::String, nil
984
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
985
+ config_attr :interceptors, nil, ::Array, nil
986
+ config_attr :timeout, nil, ::Numeric, nil
987
+ config_attr :metadata, nil, ::Hash, nil
988
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
989
+ config_attr :quota_project, nil, ::String, nil
990
+
991
+ # @private
992
+ def initialize parent_config = nil
993
+ @parent_config = parent_config unless parent_config.nil?
994
+
995
+ yield self if block_given?
996
+ end
997
+
998
+ ##
999
+ # Configurations for individual RPCs
1000
+ # @return [Rpcs]
1001
+ #
1002
+ def rpcs
1003
+ @rpcs ||= begin
1004
+ parent_rpcs = nil
1005
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1006
+ Rpcs.new parent_rpcs
1007
+ end
1008
+ end
1009
+
1010
+ ##
1011
+ # Configuration RPC class for the FirestoreAdmin API.
1012
+ #
1013
+ # Includes fields providing the configuration for each RPC in this service.
1014
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1015
+ # the following configuration fields:
1016
+ #
1017
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1018
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1019
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1020
+ # include the following keys:
1021
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1022
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1023
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1024
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1025
+ # trigger a retry.
1026
+ #
1027
+ class Rpcs
1028
+ ##
1029
+ # RPC-specific configuration for `create_index`
1030
+ # @return [::Gapic::Config::Method]
1031
+ #
1032
+ attr_reader :create_index
1033
+ ##
1034
+ # RPC-specific configuration for `list_indexes`
1035
+ # @return [::Gapic::Config::Method]
1036
+ #
1037
+ attr_reader :list_indexes
1038
+ ##
1039
+ # RPC-specific configuration for `get_index`
1040
+ # @return [::Gapic::Config::Method]
1041
+ #
1042
+ attr_reader :get_index
1043
+ ##
1044
+ # RPC-specific configuration for `delete_index`
1045
+ # @return [::Gapic::Config::Method]
1046
+ #
1047
+ attr_reader :delete_index
1048
+ ##
1049
+ # RPC-specific configuration for `get_field`
1050
+ # @return [::Gapic::Config::Method]
1051
+ #
1052
+ attr_reader :get_field
1053
+ ##
1054
+ # RPC-specific configuration for `update_field`
1055
+ # @return [::Gapic::Config::Method]
1056
+ #
1057
+ attr_reader :update_field
1058
+ ##
1059
+ # RPC-specific configuration for `list_fields`
1060
+ # @return [::Gapic::Config::Method]
1061
+ #
1062
+ attr_reader :list_fields
1063
+ ##
1064
+ # RPC-specific configuration for `export_documents`
1065
+ # @return [::Gapic::Config::Method]
1066
+ #
1067
+ attr_reader :export_documents
1068
+ ##
1069
+ # RPC-specific configuration for `import_documents`
1070
+ # @return [::Gapic::Config::Method]
1071
+ #
1072
+ attr_reader :import_documents
1073
+
1074
+ # @private
1075
+ def initialize parent_rpcs = nil
1076
+ create_index_config = parent_rpcs&.create_index if parent_rpcs&.respond_to? :create_index
1077
+ @create_index = ::Gapic::Config::Method.new create_index_config
1078
+ list_indexes_config = parent_rpcs&.list_indexes if parent_rpcs&.respond_to? :list_indexes
1079
+ @list_indexes = ::Gapic::Config::Method.new list_indexes_config
1080
+ get_index_config = parent_rpcs&.get_index if parent_rpcs&.respond_to? :get_index
1081
+ @get_index = ::Gapic::Config::Method.new get_index_config
1082
+ delete_index_config = parent_rpcs&.delete_index if parent_rpcs&.respond_to? :delete_index
1083
+ @delete_index = ::Gapic::Config::Method.new delete_index_config
1084
+ get_field_config = parent_rpcs&.get_field if parent_rpcs&.respond_to? :get_field
1085
+ @get_field = ::Gapic::Config::Method.new get_field_config
1086
+ update_field_config = parent_rpcs&.update_field if parent_rpcs&.respond_to? :update_field
1087
+ @update_field = ::Gapic::Config::Method.new update_field_config
1088
+ list_fields_config = parent_rpcs&.list_fields if parent_rpcs&.respond_to? :list_fields
1089
+ @list_fields = ::Gapic::Config::Method.new list_fields_config
1090
+ export_documents_config = parent_rpcs&.export_documents if parent_rpcs&.respond_to? :export_documents
1091
+ @export_documents = ::Gapic::Config::Method.new export_documents_config
1092
+ import_documents_config = parent_rpcs&.import_documents if parent_rpcs&.respond_to? :import_documents
1093
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
1094
+
1095
+ yield self if block_given?
1096
+ end
1097
+ end
1098
+ end
1099
+ end
1100
+ end
1101
+ end
1102
+ end
1103
+ end
1104
+ end
1105
+ end