google-cloud-firestore-admin-v1 0.3.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +7 -25
- data/README.md +11 -6
- data/lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb +321 -3
- data/lib/google/cloud/firestore/admin/v1/firestore_admin/operations.rb +3 -0
- data/lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb +14 -0
- data/lib/google/cloud/firestore/admin/v1/firestore_admin.rb +26 -0
- data/lib/google/cloud/firestore/admin/v1/version.rb +1 -1
- data/lib/google/cloud/firestore/admin/v1.rb +2 -0
- data/lib/google/firestore/admin/v1/database_pb.rb +52 -0
- data/lib/google/firestore/admin/v1/field_pb.rb +15 -2
- data/lib/google/firestore/admin/v1/firestore_admin_pb.rb +23 -1
- data/lib/google/firestore/admin/v1/firestore_admin_services_pb.rb +37 -3
- data/lib/google/firestore/admin/v1/index_pb.rb +2 -2
- data/lib/google/firestore/admin/v1/location_pb.rb +0 -2
- data/lib/google/firestore/admin/v1/operation_pb.rb +13 -2
- data/proto_docs/google/api/resource.rb +10 -71
- data/proto_docs/google/firestore/admin/v1/database.rb +125 -0
- data/proto_docs/google/firestore/admin/v1/field.rb +41 -1
- data/proto_docs/google/firestore/admin/v1/firestore_admin.rb +49 -2
- data/proto_docs/google/firestore/admin/v1/index.rb +1 -1
- data/proto_docs/google/firestore/admin/v1/operation.rb +24 -0
- data/proto_docs/google/protobuf/any.rb +3 -3
- metadata +14 -13
- data/proto_docs/google/type/latlng.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36413f6222cea9830784c764a48eca461c997392cd8cfeab165bb9d7501cefdd
|
4
|
+
data.tar.gz: a2993e4c497dbdffa0be2489f087b62ce6a949eb3cc69976ff3a76412cabe419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d82b0dc00415030ebba03f31d4c95b5162478f06f9699306e7deb51043f2fa1d5b85ffefe30eda8c72b6070cc25ab8d0bf2a40b729363f385a7ca685cbb3540e
|
7
|
+
data.tar.gz: 9d600a0c2ea9728e6e4c348fd35d4aee7630dc96b238ead3ccf1c629dcf0f7ae89f37f3dd1400e5530a4071c6ef4671b6b8ea6f553703fa27a0fb6326103526c
|
data/.yardopts
CHANGED
data/AUTHENTICATION.md
CHANGED
@@ -120,15 +120,6 @@ To configure your system for this, simply:
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
121
121
|
*should* only be used during development.
|
122
122
|
|
123
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
124
|
-
[dev-console]: https://console.cloud.google.com/project
|
125
|
-
|
126
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
127
|
-
|
128
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
129
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
130
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
131
|
-
|
132
123
|
## Creating a Service Account
|
133
124
|
|
134
125
|
Google Cloud requires **Service Account Credentials** to
|
@@ -139,31 +130,22 @@ If you are not running this client within
|
|
139
130
|
[Google Cloud Platform environments](#google-cloud-platform-environments), you
|
140
131
|
need a Google Developers service account.
|
141
132
|
|
142
|
-
1. Visit the [Google
|
133
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
143
134
|
2. Create a new project or click on an existing project.
|
144
|
-
3. Activate the
|
135
|
+
3. Activate the menu in the upper left and select **APIs & Services**. From
|
145
136
|
here, you will enable the APIs that your application requires.
|
146
137
|
|
147
|
-
![Enable the APIs that your application requires][enable-apis]
|
148
|
-
|
149
138
|
*Note: You may need to enable billing in order to use these services.*
|
150
139
|
|
151
140
|
4. Select **Credentials** from the side navigation.
|
152
141
|
|
153
|
-
|
154
|
-
|
155
|
-
![Create a new service account][create-new-service-account]
|
156
|
-
|
157
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
158
|
-
|
159
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
160
|
-
guided through downloading a new JSON key file.
|
142
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
143
|
+
"Service account" to be guided through downloading a new JSON key file.
|
161
144
|
|
162
145
|
If you want to re-use an existing service account, you can easily generate a
|
163
|
-
new key file. Just select the account you wish to re-use,
|
164
|
-
|
165
|
-
|
166
|
-
![Re-use an existing service account][reuse-service-account]
|
146
|
+
new key file. Just select the account you wish to re-use, click the pencil
|
147
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
148
|
+
and then select **Add Key**.
|
167
149
|
|
168
150
|
The key file you download will be used by this library to authenticate API
|
169
151
|
requests and should be stored in a secure location.
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ request = ::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest.new # (reque
|
|
37
37
|
response = client.create_index request
|
38
38
|
```
|
39
39
|
|
40
|
-
View the [Client Library Documentation](https://
|
40
|
+
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-firestore-admin-v1/latest)
|
41
41
|
for class and method documentation.
|
42
42
|
|
43
43
|
See also the [Product Documentation](https://cloud.google.com/firestore)
|
@@ -69,16 +69,21 @@ module GRPC
|
|
69
69
|
end
|
70
70
|
```
|
71
71
|
|
72
|
+
|
73
|
+
## Google Cloud Samples
|
74
|
+
|
75
|
+
To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
|
76
|
+
|
72
77
|
## Supported Ruby Versions
|
73
78
|
|
74
|
-
This library is supported on Ruby 2.
|
79
|
+
This library is supported on Ruby 2.6+.
|
75
80
|
|
76
81
|
Google provides official support for Ruby versions that are actively supported
|
77
82
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
78
|
-
in security maintenance, and not end of life.
|
79
|
-
|
80
|
-
|
81
|
-
|
83
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
84
|
+
still work, but are unsupported and not recommended. See
|
85
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
86
|
+
support schedule.
|
82
87
|
|
83
88
|
## Which client should I use?
|
84
89
|
|
@@ -28,6 +28,32 @@ module Google
|
|
28
28
|
##
|
29
29
|
# Client for the FirestoreAdmin service.
|
30
30
|
#
|
31
|
+
# The Cloud Firestore Admin API.
|
32
|
+
#
|
33
|
+
# This API provides several administrative services for Cloud Firestore.
|
34
|
+
#
|
35
|
+
# Project, Database, Namespace, Collection, Collection Group, and Document are
|
36
|
+
# used as defined in the Google Cloud Firestore API.
|
37
|
+
#
|
38
|
+
# Operation: An Operation represents work being performed in the background.
|
39
|
+
#
|
40
|
+
# The index service manages Cloud Firestore indexes.
|
41
|
+
#
|
42
|
+
# Index creation is performed asynchronously.
|
43
|
+
# An Operation resource is created for each such asynchronous operation.
|
44
|
+
# The state of the operation (including any errors encountered)
|
45
|
+
# may be queried via the Operation resource.
|
46
|
+
#
|
47
|
+
# The Operations collection provides a record of actions performed for the
|
48
|
+
# specified Project (including any Operations in progress). Operations are not
|
49
|
+
# created directly but through calls on other collections or resources.
|
50
|
+
#
|
51
|
+
# An Operation that is done may be deleted so that it is no longer listed as
|
52
|
+
# part of the Operation collection. Operations are garbage collected after
|
53
|
+
# 30 days. By default, ListOperations will only return in progress and failed
|
54
|
+
# operations. To list completed operation, issue a ListOperations request with
|
55
|
+
# the filter `done: true`.
|
56
|
+
#
|
31
57
|
# Operations are created by service `FirestoreAdmin`, but are accessed via
|
32
58
|
# service `google.longrunning.Operations`.
|
33
59
|
#
|
@@ -170,6 +196,7 @@ module Google
|
|
170
196
|
|
171
197
|
@operations_client = Operations.new do |config|
|
172
198
|
config.credentials = credentials
|
199
|
+
config.quota_project = @quota_project_id
|
173
200
|
config.endpoint = @config.endpoint
|
174
201
|
end
|
175
202
|
|
@@ -762,7 +789,7 @@ module Google
|
|
762
789
|
# Currently, {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
|
763
790
|
# that have been explicitly overridden. To issue this query, call
|
764
791
|
# {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with the filter set to
|
765
|
-
# `indexConfig.usesAncestorConfig:false
|
792
|
+
# `indexConfig.usesAncestorConfig:false` .
|
766
793
|
#
|
767
794
|
# @overload list_fields(request, options = nil)
|
768
795
|
# Pass arguments to `list_fields` via a request object, either of type
|
@@ -786,8 +813,8 @@ module Google
|
|
786
813
|
# The filter to apply to list results. Currently,
|
787
814
|
# {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
|
788
815
|
# that have been explicitly overridden. To issue this query, call
|
789
|
-
# {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with
|
790
|
-
# `indexConfig.usesAncestorConfig:false
|
816
|
+
# {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with a filter that includes
|
817
|
+
# `indexConfig.usesAncestorConfig:false` .
|
791
818
|
# @param page_size [::Integer]
|
792
819
|
# The number of results to return.
|
793
820
|
# @param page_token [::String]
|
@@ -876,6 +903,9 @@ module Google
|
|
876
903
|
# cancelled before completion it may leave partial data behind in Google
|
877
904
|
# Cloud Storage.
|
878
905
|
#
|
906
|
+
# For more details on export behavior and output format, refer to:
|
907
|
+
# https://cloud.google.com/firestore/docs/manage-data/export-import
|
908
|
+
#
|
879
909
|
# @overload export_documents(request, options = nil)
|
880
910
|
# Pass arguments to `export_documents` via a request object, either of type
|
881
911
|
# {::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest} or an equivalent Hash.
|
@@ -1085,6 +1115,273 @@ module Google
|
|
1085
1115
|
raise ::Google::Cloud::Error.from_error(e)
|
1086
1116
|
end
|
1087
1117
|
|
1118
|
+
##
|
1119
|
+
# Gets information about a database.
|
1120
|
+
#
|
1121
|
+
# @overload get_database(request, options = nil)
|
1122
|
+
# Pass arguments to `get_database` via a request object, either of type
|
1123
|
+
# {::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest} or an equivalent Hash.
|
1124
|
+
#
|
1125
|
+
# @param request [::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest, ::Hash]
|
1126
|
+
# A request object representing the call parameters. Required. To specify no
|
1127
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1128
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1129
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1130
|
+
#
|
1131
|
+
# @overload get_database(name: nil)
|
1132
|
+
# Pass arguments to `get_database` via keyword arguments. Note that at
|
1133
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1134
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1135
|
+
#
|
1136
|
+
# @param name [::String]
|
1137
|
+
# Required. A name of the form
|
1138
|
+
# `projects/{project_id}/databases/{database_id}`
|
1139
|
+
#
|
1140
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1141
|
+
# @yieldparam response [::Google::Cloud::Firestore::Admin::V1::Database]
|
1142
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1143
|
+
#
|
1144
|
+
# @return [::Google::Cloud::Firestore::Admin::V1::Database]
|
1145
|
+
#
|
1146
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1147
|
+
#
|
1148
|
+
# @example Basic example
|
1149
|
+
# require "google/cloud/firestore/admin/v1"
|
1150
|
+
#
|
1151
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1152
|
+
# client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
|
1153
|
+
#
|
1154
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1155
|
+
# request = Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest.new
|
1156
|
+
#
|
1157
|
+
# # Call the get_database method.
|
1158
|
+
# result = client.get_database request
|
1159
|
+
#
|
1160
|
+
# # The returned object is of type Google::Cloud::Firestore::Admin::V1::Database.
|
1161
|
+
# p result
|
1162
|
+
#
|
1163
|
+
def get_database request, options = nil
|
1164
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1165
|
+
|
1166
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest
|
1167
|
+
|
1168
|
+
# Converts hash and nil to an options object
|
1169
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1170
|
+
|
1171
|
+
# Customize the options with defaults
|
1172
|
+
metadata = @config.rpcs.get_database.metadata.to_h
|
1173
|
+
|
1174
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1175
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1176
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1177
|
+
gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
|
1178
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1179
|
+
|
1180
|
+
header_params = {}
|
1181
|
+
if request.name
|
1182
|
+
header_params["name"] = request.name
|
1183
|
+
end
|
1184
|
+
|
1185
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1186
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1187
|
+
|
1188
|
+
options.apply_defaults timeout: @config.rpcs.get_database.timeout,
|
1189
|
+
metadata: metadata,
|
1190
|
+
retry_policy: @config.rpcs.get_database.retry_policy
|
1191
|
+
|
1192
|
+
options.apply_defaults timeout: @config.timeout,
|
1193
|
+
metadata: @config.metadata,
|
1194
|
+
retry_policy: @config.retry_policy
|
1195
|
+
|
1196
|
+
@firestore_admin_stub.call_rpc :get_database, request, options: options do |response, operation|
|
1197
|
+
yield response, operation if block_given?
|
1198
|
+
return response
|
1199
|
+
end
|
1200
|
+
rescue ::GRPC::BadStatus => e
|
1201
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1202
|
+
end
|
1203
|
+
|
1204
|
+
##
|
1205
|
+
# List all the databases in the project.
|
1206
|
+
#
|
1207
|
+
# @overload list_databases(request, options = nil)
|
1208
|
+
# Pass arguments to `list_databases` via a request object, either of type
|
1209
|
+
# {::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest} or an equivalent Hash.
|
1210
|
+
#
|
1211
|
+
# @param request [::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest, ::Hash]
|
1212
|
+
# A request object representing the call parameters. Required. To specify no
|
1213
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1214
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1215
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1216
|
+
#
|
1217
|
+
# @overload list_databases(parent: nil)
|
1218
|
+
# Pass arguments to `list_databases` via keyword arguments. Note that at
|
1219
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1220
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1221
|
+
#
|
1222
|
+
# @param parent [::String]
|
1223
|
+
# Required. A parent name of the form
|
1224
|
+
# `projects/{project_id}`
|
1225
|
+
#
|
1226
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1227
|
+
# @yieldparam response [::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse]
|
1228
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1229
|
+
#
|
1230
|
+
# @return [::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse]
|
1231
|
+
#
|
1232
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1233
|
+
#
|
1234
|
+
# @example Basic example
|
1235
|
+
# require "google/cloud/firestore/admin/v1"
|
1236
|
+
#
|
1237
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1238
|
+
# client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
|
1239
|
+
#
|
1240
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1241
|
+
# request = Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest.new
|
1242
|
+
#
|
1243
|
+
# # Call the list_databases method.
|
1244
|
+
# result = client.list_databases request
|
1245
|
+
#
|
1246
|
+
# # The returned object is of type Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse.
|
1247
|
+
# p result
|
1248
|
+
#
|
1249
|
+
def list_databases request, options = nil
|
1250
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1251
|
+
|
1252
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest
|
1253
|
+
|
1254
|
+
# Converts hash and nil to an options object
|
1255
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1256
|
+
|
1257
|
+
# Customize the options with defaults
|
1258
|
+
metadata = @config.rpcs.list_databases.metadata.to_h
|
1259
|
+
|
1260
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1261
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1262
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1263
|
+
gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
|
1264
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1265
|
+
|
1266
|
+
header_params = {}
|
1267
|
+
if request.parent
|
1268
|
+
header_params["parent"] = request.parent
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1272
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1273
|
+
|
1274
|
+
options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
|
1275
|
+
metadata: metadata,
|
1276
|
+
retry_policy: @config.rpcs.list_databases.retry_policy
|
1277
|
+
|
1278
|
+
options.apply_defaults timeout: @config.timeout,
|
1279
|
+
metadata: @config.metadata,
|
1280
|
+
retry_policy: @config.retry_policy
|
1281
|
+
|
1282
|
+
@firestore_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
|
1283
|
+
yield response, operation if block_given?
|
1284
|
+
return response
|
1285
|
+
end
|
1286
|
+
rescue ::GRPC::BadStatus => e
|
1287
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
##
|
1291
|
+
# Updates a database.
|
1292
|
+
#
|
1293
|
+
# @overload update_database(request, options = nil)
|
1294
|
+
# Pass arguments to `update_database` via a request object, either of type
|
1295
|
+
# {::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest} or an equivalent Hash.
|
1296
|
+
#
|
1297
|
+
# @param request [::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest, ::Hash]
|
1298
|
+
# A request object representing the call parameters. Required. To specify no
|
1299
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1300
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1301
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1302
|
+
#
|
1303
|
+
# @overload update_database(database: nil, update_mask: nil)
|
1304
|
+
# Pass arguments to `update_database` via keyword arguments. Note that at
|
1305
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1306
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1307
|
+
#
|
1308
|
+
# @param database [::Google::Cloud::Firestore::Admin::V1::Database, ::Hash]
|
1309
|
+
# Required. The database to update.
|
1310
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1311
|
+
# The list of fields to be updated.
|
1312
|
+
#
|
1313
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1314
|
+
# @yieldparam response [::Gapic::Operation]
|
1315
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1316
|
+
#
|
1317
|
+
# @return [::Gapic::Operation]
|
1318
|
+
#
|
1319
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1320
|
+
#
|
1321
|
+
# @example Basic example
|
1322
|
+
# require "google/cloud/firestore/admin/v1"
|
1323
|
+
#
|
1324
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1325
|
+
# client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
|
1326
|
+
#
|
1327
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1328
|
+
# request = Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest.new
|
1329
|
+
#
|
1330
|
+
# # Call the update_database method.
|
1331
|
+
# result = client.update_database request
|
1332
|
+
#
|
1333
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1334
|
+
# # object to check the status of an operation, cancel it, or wait
|
1335
|
+
# # for results. Here is how to block until completion:
|
1336
|
+
# result.wait_until_done! timeout: 60
|
1337
|
+
# if result.response?
|
1338
|
+
# p result.response
|
1339
|
+
# else
|
1340
|
+
# puts "Error!"
|
1341
|
+
# end
|
1342
|
+
#
|
1343
|
+
def update_database request, options = nil
|
1344
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1345
|
+
|
1346
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest
|
1347
|
+
|
1348
|
+
# Converts hash and nil to an options object
|
1349
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1350
|
+
|
1351
|
+
# Customize the options with defaults
|
1352
|
+
metadata = @config.rpcs.update_database.metadata.to_h
|
1353
|
+
|
1354
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1355
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1356
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1357
|
+
gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
|
1358
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1359
|
+
|
1360
|
+
header_params = {}
|
1361
|
+
if request.database&.name
|
1362
|
+
header_params["database.name"] = request.database.name
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1366
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1367
|
+
|
1368
|
+
options.apply_defaults timeout: @config.rpcs.update_database.timeout,
|
1369
|
+
metadata: metadata,
|
1370
|
+
retry_policy: @config.rpcs.update_database.retry_policy
|
1371
|
+
|
1372
|
+
options.apply_defaults timeout: @config.timeout,
|
1373
|
+
metadata: @config.metadata,
|
1374
|
+
retry_policy: @config.retry_policy
|
1375
|
+
|
1376
|
+
@firestore_admin_stub.call_rpc :update_database, request, options: options do |response, operation|
|
1377
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1378
|
+
yield response, operation if block_given?
|
1379
|
+
return response
|
1380
|
+
end
|
1381
|
+
rescue ::GRPC::BadStatus => e
|
1382
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1383
|
+
end
|
1384
|
+
|
1088
1385
|
##
|
1089
1386
|
# Configuration class for the FirestoreAdmin API.
|
1090
1387
|
#
|
@@ -1265,6 +1562,21 @@ module Google
|
|
1265
1562
|
# @return [::Gapic::Config::Method]
|
1266
1563
|
#
|
1267
1564
|
attr_reader :import_documents
|
1565
|
+
##
|
1566
|
+
# RPC-specific configuration for `get_database`
|
1567
|
+
# @return [::Gapic::Config::Method]
|
1568
|
+
#
|
1569
|
+
attr_reader :get_database
|
1570
|
+
##
|
1571
|
+
# RPC-specific configuration for `list_databases`
|
1572
|
+
# @return [::Gapic::Config::Method]
|
1573
|
+
#
|
1574
|
+
attr_reader :list_databases
|
1575
|
+
##
|
1576
|
+
# RPC-specific configuration for `update_database`
|
1577
|
+
# @return [::Gapic::Config::Method]
|
1578
|
+
#
|
1579
|
+
attr_reader :update_database
|
1268
1580
|
|
1269
1581
|
# @private
|
1270
1582
|
def initialize parent_rpcs = nil
|
@@ -1286,6 +1598,12 @@ module Google
|
|
1286
1598
|
@export_documents = ::Gapic::Config::Method.new export_documents_config
|
1287
1599
|
import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
|
1288
1600
|
@import_documents = ::Gapic::Config::Method.new import_documents_config
|
1601
|
+
get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
|
1602
|
+
@get_database = ::Gapic::Config::Method.new get_database_config
|
1603
|
+
list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
|
1604
|
+
@list_databases = ::Gapic::Config::Method.new list_databases_config
|
1605
|
+
update_database_config = parent_rpcs.update_database if parent_rpcs.respond_to? :update_database
|
1606
|
+
@update_database = ::Gapic::Config::Method.new update_database_config
|
1289
1607
|
|
1290
1608
|
yield self if block_given?
|
1291
1609
|
end
|
@@ -103,6 +103,20 @@ module Google
|
|
103
103
|
"projects/#{project}/databases/#{database}/collectionGroups/#{collection}/indexes/#{index}"
|
104
104
|
end
|
105
105
|
|
106
|
+
##
|
107
|
+
# Create a fully-qualified Project resource string.
|
108
|
+
#
|
109
|
+
# The resource will be in the following format:
|
110
|
+
#
|
111
|
+
# `projects/{project}`
|
112
|
+
#
|
113
|
+
# @param project [String]
|
114
|
+
#
|
115
|
+
# @return [::String]
|
116
|
+
def project_path project:
|
117
|
+
"projects/#{project}"
|
118
|
+
end
|
119
|
+
|
106
120
|
extend self
|
107
121
|
end
|
108
122
|
end
|
@@ -33,6 +33,32 @@ module Google
|
|
33
33
|
module Admin
|
34
34
|
module V1
|
35
35
|
##
|
36
|
+
# The Cloud Firestore Admin API.
|
37
|
+
#
|
38
|
+
# This API provides several administrative services for Cloud Firestore.
|
39
|
+
#
|
40
|
+
# Project, Database, Namespace, Collection, Collection Group, and Document are
|
41
|
+
# used as defined in the Google Cloud Firestore API.
|
42
|
+
#
|
43
|
+
# Operation: An Operation represents work being performed in the background.
|
44
|
+
#
|
45
|
+
# The index service manages Cloud Firestore indexes.
|
46
|
+
#
|
47
|
+
# Index creation is performed asynchronously.
|
48
|
+
# An Operation resource is created for each such asynchronous operation.
|
49
|
+
# The state of the operation (including any errors encountered)
|
50
|
+
# may be queried via the Operation resource.
|
51
|
+
#
|
52
|
+
# The Operations collection provides a record of actions performed for the
|
53
|
+
# specified Project (including any Operations in progress). Operations are not
|
54
|
+
# created directly but through calls on other collections or resources.
|
55
|
+
#
|
56
|
+
# An Operation that is done may be deleted so that it is no longer listed as
|
57
|
+
# part of the Operation collection. Operations are garbage collected after
|
58
|
+
# 30 days. By default, ListOperations will only return in progress and failed
|
59
|
+
# operations. To list completed operation, issue a ListOperations request with
|
60
|
+
# the filter `done: true`.
|
61
|
+
#
|
36
62
|
# Operations are created by service `FirestoreAdmin`, but are accessed via
|
37
63
|
# service `google.longrunning.Operations`.
|
38
64
|
#
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/firestore/admin/v1/database.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/field_behavior_pb'
|
7
|
+
require 'google/api/resource_pb'
|
8
|
+
|
9
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
+
add_file("google/firestore/admin/v1/database.proto", :syntax => :proto3) do
|
11
|
+
add_message "google.firestore.admin.v1.Database" do
|
12
|
+
optional :name, :string, 1
|
13
|
+
optional :location_id, :string, 9
|
14
|
+
optional :type, :enum, 10, "google.firestore.admin.v1.Database.DatabaseType"
|
15
|
+
optional :concurrency_mode, :enum, 15, "google.firestore.admin.v1.Database.ConcurrencyMode"
|
16
|
+
optional :app_engine_integration_mode, :enum, 19, "google.firestore.admin.v1.Database.AppEngineIntegrationMode"
|
17
|
+
optional :key_prefix, :string, 20
|
18
|
+
optional :etag, :string, 99
|
19
|
+
end
|
20
|
+
add_enum "google.firestore.admin.v1.Database.DatabaseType" do
|
21
|
+
value :DATABASE_TYPE_UNSPECIFIED, 0
|
22
|
+
value :FIRESTORE_NATIVE, 1
|
23
|
+
value :DATASTORE_MODE, 2
|
24
|
+
end
|
25
|
+
add_enum "google.firestore.admin.v1.Database.ConcurrencyMode" do
|
26
|
+
value :CONCURRENCY_MODE_UNSPECIFIED, 0
|
27
|
+
value :OPTIMISTIC, 1
|
28
|
+
value :PESSIMISTIC, 2
|
29
|
+
value :OPTIMISTIC_WITH_ENTITY_GROUPS, 3
|
30
|
+
end
|
31
|
+
add_enum "google.firestore.admin.v1.Database.AppEngineIntegrationMode" do
|
32
|
+
value :APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED, 0
|
33
|
+
value :ENABLED, 1
|
34
|
+
value :DISABLED, 2
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module Google
|
40
|
+
module Cloud
|
41
|
+
module Firestore
|
42
|
+
module Admin
|
43
|
+
module V1
|
44
|
+
Database = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.admin.v1.Database").msgclass
|
45
|
+
Database::DatabaseType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.admin.v1.Database.DatabaseType").enummodule
|
46
|
+
Database::ConcurrencyMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.admin.v1.Database.ConcurrencyMode").enummodule
|
47
|
+
Database::AppEngineIntegrationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.admin.v1.Database.AppEngineIntegrationMode").enummodule
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|