google-cloud-firestore 1.4.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/CHANGELOG.md +47 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-firestore.rb +14 -21
- data/lib/google/cloud/firestore.rb +12 -23
- data/lib/google/cloud/firestore/client.rb +12 -14
- data/lib/google/cloud/firestore/collection_reference.rb +1 -0
- data/lib/google/cloud/firestore/collection_reference_list.rb +137 -0
- data/lib/google/cloud/firestore/convert.rb +39 -39
- data/lib/google/cloud/firestore/credentials.rb +2 -2
- data/lib/google/cloud/firestore/document_reference.rb +8 -8
- data/lib/google/cloud/firestore/document_reference/list.rb +2 -2
- data/lib/google/cloud/firestore/document_snapshot.rb +4 -4
- data/lib/google/cloud/firestore/query.rb +114 -22
- data/lib/google/cloud/firestore/service.rb +63 -104
- data/lib/google/cloud/firestore/transaction.rb +2 -2
- data/lib/google/cloud/firestore/version.rb +1 -1
- data/lib/google/cloud/firestore/watch/inventory.rb +2 -0
- data/lib/google/cloud/firestore/watch/listener.rb +9 -9
- data/lib/google/cloud/firestore/watch/order.rb +1 -1
- metadata +11 -109
- data/lib/google/cloud/firestore/admin.rb +0 -144
- data/lib/google/cloud/firestore/admin/v1.rb +0 -151
- data/lib/google/cloud/firestore/admin/v1/credentials.rb +0 -44
- data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/field.rb +0 -86
- data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/firestore_admin.rb +0 -161
- data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/index.rb +0 -142
- data/lib/google/cloud/firestore/admin/v1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/firestore/admin/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/firestore/admin/v1/firestore_admin_client.rb +0 -902
- data/lib/google/cloud/firestore/admin/v1/firestore_admin_client_config.json +0 -71
- data/lib/google/cloud/firestore/v1.rb +0 -152
- data/lib/google/cloud/firestore/v1/credentials.rb +0 -42
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb +0 -64
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb +0 -136
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb +0 -566
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb +0 -227
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb +0 -241
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb +0 -26
- data/lib/google/cloud/firestore/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/firestore/v1/firestore_client.rb +0 -1011
- data/lib/google/cloud/firestore/v1/firestore_client_config.json +0 -100
- data/lib/google/cloud/firestore/v1beta1.rb +0 -160
- data/lib/google/cloud/firestore/v1beta1/credentials.rb +0 -42
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +0 -64
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +0 -136
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +0 -564
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +0 -227
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +0 -237
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +0 -26
- data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +0 -1019
- data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +0 -100
- data/lib/google/firestore/admin/v1/field_pb.rb +0 -32
- data/lib/google/firestore/admin/v1/firestore_admin_pb.rb +0 -84
- data/lib/google/firestore/admin/v1/firestore_admin_services_pb.rb +0 -94
- data/lib/google/firestore/admin/v1/index_pb.rb +0 -58
- data/lib/google/firestore/admin/v1/location_pb.rb +0 -22
- data/lib/google/firestore/admin/v1/operation_pb.rb +0 -90
- data/lib/google/firestore/v1/common_pb.rb +0 -45
- data/lib/google/firestore/v1/document_pb.rb +0 -50
- data/lib/google/firestore/v1/firestore_pb.rb +0 -222
- data/lib/google/firestore/v1/firestore_services_pb.rb +0 -80
- data/lib/google/firestore/v1/query_pb.rb +0 -107
- data/lib/google/firestore/v1/write_pb.rb +0 -80
- data/lib/google/firestore/v1beta1/common_pb.rb +0 -45
- data/lib/google/firestore/v1beta1/document_pb.rb +0 -50
- data/lib/google/firestore/v1beta1/firestore_pb.rb +0 -222
- data/lib/google/firestore/v1beta1/firestore_services_pb.rb +0 -89
- data/lib/google/firestore/v1beta1/query_pb.rb +0 -107
- data/lib/google/firestore/v1beta1/write_pb.rb +0 -79
@@ -1,144 +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
|
-
require "google/gax"
|
17
|
-
require "pathname"
|
18
|
-
|
19
|
-
module Google
|
20
|
-
module Cloud
|
21
|
-
module Firestore
|
22
|
-
# rubocop:disable LineLength
|
23
|
-
|
24
|
-
##
|
25
|
-
# # Ruby Client for Google Cloud Firestore Admin API
|
26
|
-
#
|
27
|
-
# [Google Cloud Firestore Admin API][Product Documentation]:
|
28
|
-
# Accesses the NoSQL document database built for automatic scaling, high
|
29
|
-
# performance, and ease of application development.
|
30
|
-
# - [Product Documentation][]
|
31
|
-
#
|
32
|
-
# ## Quick Start
|
33
|
-
# In order to use this library, you first need to go through the following
|
34
|
-
# steps:
|
35
|
-
#
|
36
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
37
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
38
|
-
# 3. [Enable the Google Cloud Firestore Admin API.](https://console.cloud.google.com/apis/library/firestore-admin.googleapis.com)
|
39
|
-
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-firestore/latest/file.AUTHENTICATION.html)
|
40
|
-
#
|
41
|
-
# ### Installation
|
42
|
-
# ```
|
43
|
-
# $ gem install google-cloud-firestore-admin
|
44
|
-
# ```
|
45
|
-
#
|
46
|
-
# ### Next Steps
|
47
|
-
# - Read the [Google Cloud Firestore Admin API Product documentation][Product Documentation]
|
48
|
-
# to learn more about the product and see How-to Guides.
|
49
|
-
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
50
|
-
# to see the full list of Cloud APIs that we cover.
|
51
|
-
#
|
52
|
-
# [Product Documentation]: https://cloud.google.com/firestore-admin
|
53
|
-
#
|
54
|
-
# ## Enabling Logging
|
55
|
-
#
|
56
|
-
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
57
|
-
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
58
|
-
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
59
|
-
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
60
|
-
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
61
|
-
#
|
62
|
-
# Configuring a Ruby stdlib logger:
|
63
|
-
#
|
64
|
-
# ```ruby
|
65
|
-
# require "logger"
|
66
|
-
#
|
67
|
-
# module MyLogger
|
68
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
69
|
-
# def logger
|
70
|
-
# LOGGER
|
71
|
-
# end
|
72
|
-
# end
|
73
|
-
#
|
74
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
75
|
-
# module GRPC
|
76
|
-
# extend MyLogger
|
77
|
-
# end
|
78
|
-
# ```
|
79
|
-
#
|
80
|
-
module Admin
|
81
|
-
# rubocop:enable LineLength
|
82
|
-
|
83
|
-
FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("admin"))
|
84
|
-
|
85
|
-
AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
|
86
|
-
.select { |file| File.directory?(file) }
|
87
|
-
.select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
|
88
|
-
.select { |dir| File.exist?(dir + ".rb") }
|
89
|
-
.map { |dir| File.basename(dir) }
|
90
|
-
|
91
|
-
##
|
92
|
-
# Operations are created by service `FirestoreAdmin`, but are accessed via
|
93
|
-
# service `google.longrunning.Operations`.
|
94
|
-
#
|
95
|
-
# @param version [Symbol, String]
|
96
|
-
# The major version of the service to be used. By default :v1
|
97
|
-
# is used.
|
98
|
-
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
99
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
100
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
101
|
-
# be many types.
|
102
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
103
|
-
# authenticating requests made by this client.
|
104
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
105
|
-
# credentials for this client.
|
106
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
107
|
-
# credentials for this client.
|
108
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
109
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
110
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
111
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
112
|
-
# metadata for requests, generally, to give OAuth credentials.
|
113
|
-
# @param scopes [Array<String>]
|
114
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
115
|
-
# an updater_proc is supplied.
|
116
|
-
# @param client_config [Hash]
|
117
|
-
# A Hash for call options for each method. See
|
118
|
-
# Google::Gax#construct_settings for the structure of
|
119
|
-
# this data. Falls back to the default config if not specified
|
120
|
-
# or the specified config is missing data points.
|
121
|
-
# @param timeout [Numeric]
|
122
|
-
# The default timeout, in seconds, for calls made through this client.
|
123
|
-
# @param metadata [Hash]
|
124
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
125
|
-
# @param exception_transformer [Proc]
|
126
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
127
|
-
# custom error handling.
|
128
|
-
def self.new(*args, version: :v1, **kwargs)
|
129
|
-
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
130
|
-
raise "The version: #{version} is not available. The available versions " \
|
131
|
-
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
|
132
|
-
end
|
133
|
-
|
134
|
-
require "#{FILE_DIR}/#{version.to_s.downcase}"
|
135
|
-
version_module = Google::Cloud::Firestore::Admin
|
136
|
-
.constants
|
137
|
-
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
|
138
|
-
.first
|
139
|
-
Google::Cloud::Firestore::Admin.const_get(version_module).new(*args, **kwargs)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
@@ -1,151 +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
|
-
require "google/cloud/firestore/admin/v1/firestore_admin_client"
|
17
|
-
require "google/firestore/admin/v1/operation_pb"
|
18
|
-
require "google/firestore/admin/v1/location_pb"
|
19
|
-
|
20
|
-
module Google
|
21
|
-
module Cloud
|
22
|
-
module Firestore
|
23
|
-
module Admin
|
24
|
-
# rubocop:disable LineLength
|
25
|
-
|
26
|
-
##
|
27
|
-
# # Ruby Client for Google Cloud Firestore Admin API
|
28
|
-
#
|
29
|
-
# [Google Cloud Firestore Admin API][Product Documentation]:
|
30
|
-
# Accesses the NoSQL document database built for automatic scaling, high
|
31
|
-
# performance, and ease of application development.
|
32
|
-
# - [Product Documentation][]
|
33
|
-
#
|
34
|
-
# ## Quick Start
|
35
|
-
# In order to use this library, you first need to go through the following
|
36
|
-
# steps:
|
37
|
-
#
|
38
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
39
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
40
|
-
# 3. [Enable the Google Cloud Firestore Admin API.](https://console.cloud.google.com/apis/library/firestore-admin.googleapis.com)
|
41
|
-
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-firestore/latest/file.AUTHENTICATION.html)
|
42
|
-
#
|
43
|
-
# ### Installation
|
44
|
-
# ```
|
45
|
-
# $ gem install google-cloud-firestore-admin
|
46
|
-
# ```
|
47
|
-
#
|
48
|
-
# ### Next Steps
|
49
|
-
# - Read the [Google Cloud Firestore Admin API Product documentation][Product Documentation]
|
50
|
-
# to learn more about the product and see How-to Guides.
|
51
|
-
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
52
|
-
# to see the full list of Cloud APIs that we cover.
|
53
|
-
#
|
54
|
-
# [Product Documentation]: https://cloud.google.com/firestore-admin
|
55
|
-
#
|
56
|
-
# ## Enabling Logging
|
57
|
-
#
|
58
|
-
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
59
|
-
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
60
|
-
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
61
|
-
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
62
|
-
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
63
|
-
#
|
64
|
-
# Configuring a Ruby stdlib logger:
|
65
|
-
#
|
66
|
-
# ```ruby
|
67
|
-
# require "logger"
|
68
|
-
#
|
69
|
-
# module MyLogger
|
70
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
71
|
-
# def logger
|
72
|
-
# LOGGER
|
73
|
-
# end
|
74
|
-
# end
|
75
|
-
#
|
76
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
77
|
-
# module GRPC
|
78
|
-
# extend MyLogger
|
79
|
-
# end
|
80
|
-
# ```
|
81
|
-
#
|
82
|
-
module V1
|
83
|
-
# rubocop:enable LineLength
|
84
|
-
|
85
|
-
##
|
86
|
-
# Operations are created by service `FirestoreAdmin`, but are accessed via
|
87
|
-
# service `google.longrunning.Operations`.
|
88
|
-
#
|
89
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
90
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
91
|
-
# be many types.
|
92
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
93
|
-
# authenticating requests made by this client.
|
94
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
95
|
-
# credentials for this client.
|
96
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
97
|
-
# credentials for this client.
|
98
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
99
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
100
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
101
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
102
|
-
# metadata for requests, generally, to give OAuth credentials.
|
103
|
-
# @param scopes [Array<String>]
|
104
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
105
|
-
# an updater_proc is supplied.
|
106
|
-
# @param client_config [Hash]
|
107
|
-
# A Hash for call options for each method. See
|
108
|
-
# Google::Gax#construct_settings for the structure of
|
109
|
-
# this data. Falls back to the default config if not specified
|
110
|
-
# or the specified config is missing data points.
|
111
|
-
# @param timeout [Numeric]
|
112
|
-
# The default timeout, in seconds, for calls made through this client.
|
113
|
-
# @param metadata [Hash]
|
114
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
115
|
-
# @param service_address [String]
|
116
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
117
|
-
# @param service_port [Integer]
|
118
|
-
# Override for the service port, or `nil` to leave as the default.
|
119
|
-
# @param exception_transformer [Proc]
|
120
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
121
|
-
# custom error handling.
|
122
|
-
def self.new \
|
123
|
-
credentials: nil,
|
124
|
-
scopes: nil,
|
125
|
-
client_config: nil,
|
126
|
-
timeout: nil,
|
127
|
-
metadata: nil,
|
128
|
-
service_address: nil,
|
129
|
-
service_port: nil,
|
130
|
-
exception_transformer: nil,
|
131
|
-
lib_name: nil,
|
132
|
-
lib_version: nil
|
133
|
-
kwargs = {
|
134
|
-
credentials: credentials,
|
135
|
-
scopes: scopes,
|
136
|
-
client_config: client_config,
|
137
|
-
timeout: timeout,
|
138
|
-
metadata: metadata,
|
139
|
-
exception_transformer: exception_transformer,
|
140
|
-
lib_name: lib_name,
|
141
|
-
service_address: service_address,
|
142
|
-
service_port: service_port,
|
143
|
-
lib_version: lib_version
|
144
|
-
}.select { |_, v| v != nil }
|
145
|
-
Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.new(**kwargs)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
@@ -1,44 +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
|
-
require "googleauth"
|
17
|
-
|
18
|
-
module Google
|
19
|
-
module Cloud
|
20
|
-
module Firestore
|
21
|
-
module Admin
|
22
|
-
module V1
|
23
|
-
class Credentials < Google::Auth::Credentials
|
24
|
-
SCOPE = [
|
25
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
26
|
-
"https://www.googleapis.com/auth/datastore"
|
27
|
-
].freeze
|
28
|
-
PATH_ENV_VARS = %w(FIRESTORE_ADMIN_CREDENTIALS
|
29
|
-
FIRESTORE_ADMIN_KEYFILE
|
30
|
-
GOOGLE_CLOUD_CREDENTIALS
|
31
|
-
GOOGLE_CLOUD_KEYFILE
|
32
|
-
GCLOUD_KEYFILE)
|
33
|
-
JSON_ENV_VARS = %w(FIRESTORE_ADMIN_CREDENTIALS_JSON
|
34
|
-
FIRESTORE_ADMIN_KEYFILE_JSON
|
35
|
-
GOOGLE_CLOUD_CREDENTIALS_JSON
|
36
|
-
GOOGLE_CLOUD_KEYFILE_JSON
|
37
|
-
GCLOUD_KEYFILE_JSON)
|
38
|
-
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,86 +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 Firestore
|
18
|
-
module Admin
|
19
|
-
module V1
|
20
|
-
# Represents a single field in the database.
|
21
|
-
#
|
22
|
-
# Fields are grouped by their "Collection Group", which represent all
|
23
|
-
# collections in the database with the same id.
|
24
|
-
# @!attribute [rw] name
|
25
|
-
# @return [String]
|
26
|
-
# A field name of the form
|
27
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
|
28
|
-
#
|
29
|
-
# A field path may be a simple field name, e.g. `address` or a path to fields
|
30
|
-
# within map_value , e.g. `address.city`,
|
31
|
-
# or a special field path. The only valid special field is `*`, which
|
32
|
-
# represents any field.
|
33
|
-
#
|
34
|
-
# Field paths may be quoted using ` (backtick). The only character that needs
|
35
|
-
# to be escaped within a quoted field path is the backtick character itself,
|
36
|
-
# escaped using a backslash. Special characters in field paths that
|
37
|
-
# must be quoted include: `*`, `.`,
|
38
|
-
# ``` (backtick), `[`, `]`, as well as any ascii symbolic characters.
|
39
|
-
#
|
40
|
-
# Examples:
|
41
|
-
# (Note: Comments here are written in markdown syntax, so there is an
|
42
|
-
# additional layer of backticks to represent a code block)
|
43
|
-
# `\`address.city\`` represents a field named `address.city`, not the map key
|
44
|
-
# `city` in the field `address`.
|
45
|
-
# `\`*\`` represents a field named `*`, not any field.
|
46
|
-
#
|
47
|
-
# A special `Field` contains the default indexing settings for all fields.
|
48
|
-
# This field's resource name is:
|
49
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`
|
50
|
-
# Indexes defined on this `Field` will be applied to all fields which do not
|
51
|
-
# have their own `Field` index configuration.
|
52
|
-
# @!attribute [rw] index_config
|
53
|
-
# @return [Google::Firestore::Admin::V1::Field::IndexConfig]
|
54
|
-
# The index configuration for this field. If unset, field indexing will
|
55
|
-
# revert to the configuration defined by the `ancestor_field`. To
|
56
|
-
# explicitly remove all indexes for this field, specify an index config
|
57
|
-
# with an empty list of indexes.
|
58
|
-
class Field
|
59
|
-
# The index configuration for this field.
|
60
|
-
# @!attribute [rw] indexes
|
61
|
-
# @return [Array<Google::Firestore::Admin::V1::Index>]
|
62
|
-
# The indexes supported for this field.
|
63
|
-
# @!attribute [rw] uses_ancestor_config
|
64
|
-
# @return [true, false]
|
65
|
-
# Output only. When true, the `Field`'s index configuration is set from the
|
66
|
-
# configuration specified by the `ancestor_field`.
|
67
|
-
# When false, the `Field`'s index configuration is defined explicitly.
|
68
|
-
# @!attribute [rw] ancestor_field
|
69
|
-
# @return [String]
|
70
|
-
# Output only. Specifies the resource name of the `Field` from which this field's
|
71
|
-
# index configuration is set (when `uses_ancestor_config` is true),
|
72
|
-
# or from which it *would* be set if this field had no index configuration
|
73
|
-
# (when `uses_ancestor_config` is false).
|
74
|
-
# @!attribute [rw] reverting
|
75
|
-
# @return [true, false]
|
76
|
-
# Output only
|
77
|
-
# When true, the `Field`'s index configuration is in the process of being
|
78
|
-
# reverted. Once complete, the index config will transition to the same
|
79
|
-
# state as the field specified by `ancestor_field`, at which point
|
80
|
-
# `uses_ancestor_config` will be `true` and `reverting` will be `false`.
|
81
|
-
class IndexConfig; end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,161 +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 Firestore
|
18
|
-
module Admin
|
19
|
-
module V1
|
20
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::CreateIndex FirestoreAdmin::CreateIndex}.
|
21
|
-
# @!attribute [rw] parent
|
22
|
-
# @return [String]
|
23
|
-
# Required. A parent name of the form
|
24
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
|
25
|
-
# @!attribute [rw] index
|
26
|
-
# @return [Google::Firestore::Admin::V1::Index]
|
27
|
-
# Required. The composite index to create.
|
28
|
-
class CreateIndexRequest; end
|
29
|
-
|
30
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::ListIndexes FirestoreAdmin::ListIndexes}.
|
31
|
-
# @!attribute [rw] parent
|
32
|
-
# @return [String]
|
33
|
-
# Required. A parent name of the form
|
34
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
|
35
|
-
# @!attribute [rw] filter
|
36
|
-
# @return [String]
|
37
|
-
# The filter to apply to list results.
|
38
|
-
# @!attribute [rw] page_size
|
39
|
-
# @return [Integer]
|
40
|
-
# The number of results to return.
|
41
|
-
# @!attribute [rw] page_token
|
42
|
-
# @return [String]
|
43
|
-
# A page token, returned from a previous call to
|
44
|
-
# {Google::Firestore::Admin::V1::FirestoreAdmin::ListIndexes FirestoreAdmin::ListIndexes}, that may be used to get the next
|
45
|
-
# page of results.
|
46
|
-
class ListIndexesRequest; end
|
47
|
-
|
48
|
-
# The response for {Google::Firestore::Admin::V1::FirestoreAdmin::ListIndexes FirestoreAdmin::ListIndexes}.
|
49
|
-
# @!attribute [rw] indexes
|
50
|
-
# @return [Array<Google::Firestore::Admin::V1::Index>]
|
51
|
-
# The requested indexes.
|
52
|
-
# @!attribute [rw] next_page_token
|
53
|
-
# @return [String]
|
54
|
-
# A page token that may be used to request another page of results. If blank,
|
55
|
-
# this is the last page.
|
56
|
-
class ListIndexesResponse; end
|
57
|
-
|
58
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::GetIndex FirestoreAdmin::GetIndex}.
|
59
|
-
# @!attribute [rw] name
|
60
|
-
# @return [String]
|
61
|
-
# Required. A name of the form
|
62
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
|
63
|
-
class GetIndexRequest; end
|
64
|
-
|
65
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::DeleteIndex FirestoreAdmin::DeleteIndex}.
|
66
|
-
# @!attribute [rw] name
|
67
|
-
# @return [String]
|
68
|
-
# Required. A name of the form
|
69
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
|
70
|
-
class DeleteIndexRequest; end
|
71
|
-
|
72
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::UpdateField FirestoreAdmin::UpdateField}.
|
73
|
-
# @!attribute [rw] field
|
74
|
-
# @return [Google::Firestore::Admin::V1::Field]
|
75
|
-
# Required. The field to be updated.
|
76
|
-
# @!attribute [rw] update_mask
|
77
|
-
# @return [Google::Protobuf::FieldMask]
|
78
|
-
# A mask, relative to the field. If specified, only configuration specified
|
79
|
-
# by this field_mask will be updated in the field.
|
80
|
-
class UpdateFieldRequest; end
|
81
|
-
|
82
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::GetField FirestoreAdmin::GetField}.
|
83
|
-
# @!attribute [rw] name
|
84
|
-
# @return [String]
|
85
|
-
# Required. A name of the form
|
86
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
|
87
|
-
class GetFieldRequest; end
|
88
|
-
|
89
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields}.
|
90
|
-
# @!attribute [rw] parent
|
91
|
-
# @return [String]
|
92
|
-
# Required. A parent name of the form
|
93
|
-
# `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
|
94
|
-
# @!attribute [rw] filter
|
95
|
-
# @return [String]
|
96
|
-
# The filter to apply to list results. Currently,
|
97
|
-
# {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields} only supports listing fields
|
98
|
-
# that have been explicitly overridden. To issue this query, call
|
99
|
-
# {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields} with the filter set to
|
100
|
-
# `indexConfig.usesAncestorConfig:false`.
|
101
|
-
# @!attribute [rw] page_size
|
102
|
-
# @return [Integer]
|
103
|
-
# The number of results to return.
|
104
|
-
# @!attribute [rw] page_token
|
105
|
-
# @return [String]
|
106
|
-
# A page token, returned from a previous call to
|
107
|
-
# {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields}, that may be used to get the next
|
108
|
-
# page of results.
|
109
|
-
class ListFieldsRequest; end
|
110
|
-
|
111
|
-
# The response for {Google::Firestore::Admin::V1::FirestoreAdmin::ListFields FirestoreAdmin::ListFields}.
|
112
|
-
# @!attribute [rw] fields
|
113
|
-
# @return [Array<Google::Firestore::Admin::V1::Field>]
|
114
|
-
# The requested fields.
|
115
|
-
# @!attribute [rw] next_page_token
|
116
|
-
# @return [String]
|
117
|
-
# A page token that may be used to request another page of results. If blank,
|
118
|
-
# this is the last page.
|
119
|
-
class ListFieldsResponse; end
|
120
|
-
|
121
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::ExportDocuments FirestoreAdmin::ExportDocuments}.
|
122
|
-
# @!attribute [rw] name
|
123
|
-
# @return [String]
|
124
|
-
# Required. Database to export. Should be of the form:
|
125
|
-
# `projects/{project_id}/databases/{database_id}`.
|
126
|
-
# @!attribute [rw] collection_ids
|
127
|
-
# @return [Array<String>]
|
128
|
-
# Which collection ids to export. Unspecified means all collections.
|
129
|
-
# @!attribute [rw] output_uri_prefix
|
130
|
-
# @return [String]
|
131
|
-
# The output URI. Currently only supports Google Cloud Storage URIs of the
|
132
|
-
# form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
|
133
|
-
# of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
|
134
|
-
# Google Cloud Storage namespace path. When
|
135
|
-
# choosing a name, be sure to consider Google Cloud Storage naming
|
136
|
-
# guidelines: https://cloud.google.com/storage/docs/naming.
|
137
|
-
# If the URI is a bucket (without a namespace path), a prefix will be
|
138
|
-
# generated based on the start time.
|
139
|
-
class ExportDocumentsRequest; end
|
140
|
-
|
141
|
-
# The request for {Google::Firestore::Admin::V1::FirestoreAdmin::ImportDocuments FirestoreAdmin::ImportDocuments}.
|
142
|
-
# @!attribute [rw] name
|
143
|
-
# @return [String]
|
144
|
-
# Required. Database to import into. Should be of the form:
|
145
|
-
# `projects/{project_id}/databases/{database_id}`.
|
146
|
-
# @!attribute [rw] collection_ids
|
147
|
-
# @return [Array<String>]
|
148
|
-
# Which collection ids to import. Unspecified means all collections included
|
149
|
-
# in the import.
|
150
|
-
# @!attribute [rw] input_uri_prefix
|
151
|
-
# @return [String]
|
152
|
-
# Location of the exported files.
|
153
|
-
# This must match the output_uri_prefix of an ExportDocumentsResponse from
|
154
|
-
# an export that has completed successfully.
|
155
|
-
# See:
|
156
|
-
# {Google::Firestore::Admin::V1::ExportDocumentsResponse#output_uri_prefix}.
|
157
|
-
class ImportDocumentsRequest; end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|