google-cloud-firestore 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/LOGGING.md +1 -1
- data/lib/google-cloud-firestore.rb +1 -0
- data/lib/google/cloud/firestore.rb +9 -4
- data/lib/google/cloud/firestore/admin.rb +144 -0
- data/lib/google/cloud/firestore/admin/v1.rb +151 -0
- data/lib/google/cloud/firestore/admin/v1/credentials.rb +44 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/field.rb +88 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/firestore_admin.rb +161 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/index.rb +139 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/longrunning/operations.rb +51 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/any.rb +131 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/field_mask.rb +222 -0
- data/lib/google/cloud/firestore/admin/v1/doc/google/rpc/status.rb +87 -0
- data/lib/google/cloud/firestore/admin/v1/firestore_admin_client.rb +761 -0
- data/lib/google/cloud/firestore/admin/v1/firestore_admin_client_config.json +71 -0
- data/lib/google/cloud/firestore/v1.rb +2 -2
- data/lib/google/cloud/firestore/v1beta1.rb +2 -2
- data/lib/google/cloud/firestore/version.rb +1 -1
- data/lib/google/firestore/admin/v1/field_pb.rb +31 -0
- data/lib/google/firestore/admin/v1/firestore_admin_pb.rb +81 -0
- data/lib/google/firestore/admin/v1/firestore_admin_services_pb.rb +94 -0
- data/lib/google/firestore/admin/v1/index_pb.rb +56 -0
- data/lib/google/firestore/admin/v1/location_pb.rb +22 -0
- data/lib/google/firestore/admin/v1/operation_pb.rb +90 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51be2bb301f8eb7d271a28efa81767e4cf296b6111665df4f0857ed495f4bc4e
|
4
|
+
data.tar.gz: b859f290260bdc0448f7407c4f0c7f481bfdc98ef808750c56633817b46417c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72a920965f28b179256c47f474668cf1c7d35b202356184a2a3c934768dab747aaddce43d3bb821c82785da73560b03baf130bb534886315fcbdedb1b1032b56
|
7
|
+
data.tar.gz: 46bde522096b25cd0cd0951a92d598378c6d8536e4a505215110272b2dca08ea585ded8591c79e461ac3dd31f8539450f7a29c07ae68f60beccf77b739c7e217
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.1.0 / 2019-08-23
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Support overriding of service endpoint
|
8
|
+
* Add low-level client for the admin API
|
9
|
+
|
10
|
+
#### Documentation
|
11
|
+
|
12
|
+
* Update documentation
|
13
|
+
|
3
14
|
### 1.0.0 / 2019-07-15
|
4
15
|
|
5
16
|
* Bump release level to GA.
|
data/LOGGING.md
CHANGED
@@ -5,7 +5,7 @@ To enable logging for this library, set the logger for the underlying
|
|
5
5
|
that you set may be a Ruby stdlib
|
6
6
|
[`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as
|
7
7
|
shown below, or a
|
8
|
-
[`Google::Cloud::Logging::Logger`](https://googleapis.
|
8
|
+
[`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
9
9
|
that will write logs to [Stackdriver
|
10
10
|
Logging](https://cloud.google.com/logging/). See
|
11
11
|
[grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
@@ -134,4 +134,5 @@ Google::Cloud.configure.add_config! :firestore do |config|
|
|
134
134
|
config.add_field! :client_config, nil, match: Hash
|
135
135
|
config.add_field! :emulator_host, default_emulator,
|
136
136
|
match: String, allow_nil: true
|
137
|
+
config.add_field! :endpoint, nil, match: String
|
137
138
|
end
|
@@ -58,6 +58,8 @@ module Google
|
|
58
58
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
59
59
|
# @param [Hash] client_config A hash of values to override the default
|
60
60
|
# behavior of the API client. Optional.
|
61
|
+
# @param [String] endpoint Override of the endpoint host name. Optional.
|
62
|
+
# If the param is nil, uses the default endpoint.
|
61
63
|
# @param [String] emulator_host Firestore emulator host. Optional.
|
62
64
|
# If the param is nil, uses the value of the `emulator_host` config.
|
63
65
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
@@ -72,12 +74,13 @@ module Google
|
|
72
74
|
# firestore = Google::Cloud::Firestore.new
|
73
75
|
#
|
74
76
|
def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
|
75
|
-
client_config: nil,
|
76
|
-
keyfile: nil
|
77
|
+
client_config: nil, endpoint: nil, emulator_host: nil,
|
78
|
+
project: nil, keyfile: nil
|
77
79
|
project_id ||= (project || default_project_id)
|
78
80
|
scope ||= configure.scope
|
79
81
|
timeout ||= configure.timeout
|
80
82
|
client_config ||= configure.client_config
|
83
|
+
endpoint ||= configure.endpoint
|
81
84
|
emulator_host ||= configure.emulator_host
|
82
85
|
|
83
86
|
if emulator_host
|
@@ -106,8 +109,8 @@ module Google
|
|
106
109
|
|
107
110
|
Firestore::Client.new(
|
108
111
|
Firestore::Service.new(
|
109
|
-
project_id, credentials,
|
110
|
-
|
112
|
+
project_id, credentials,
|
113
|
+
host: endpoint, timeout: timeout, client_config: client_config
|
111
114
|
)
|
112
115
|
)
|
113
116
|
end
|
@@ -131,6 +134,8 @@ module Google
|
|
131
134
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
132
135
|
# * `client_config` - (Hash) A hash of values to override the default
|
133
136
|
# behavior of the API client.
|
137
|
+
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
138
|
+
# to use the default endpoint.
|
134
139
|
# * `emulator_host` - (String) Host name of the emulator. Defaults to
|
135
140
|
# `ENV["FIRESTORE_EMULATOR_HOST"]`
|
136
141
|
#
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# Copyright 2019 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 ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
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
|
@@ -0,0 +1,151 @@
|
|
1
|
+
# Copyright 2019 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 ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
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
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright 2019 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
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Copyright 2019 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.
|
66
|
+
# When true, the `Field`'s index configuration is set from the
|
67
|
+
# configuration specified by the `ancestor_field`.
|
68
|
+
# When false, the `Field`'s index configuration is defined explicitly.
|
69
|
+
# @!attribute [rw] ancestor_field
|
70
|
+
# @return [String]
|
71
|
+
# Output only.
|
72
|
+
# Specifies the resource name of the `Field` from which this field's
|
73
|
+
# index configuration is set (when `uses_ancestor_config` is true),
|
74
|
+
# or from which it *would* be set if this field had no index configuration
|
75
|
+
# (when `uses_ancestor_config` is false).
|
76
|
+
# @!attribute [rw] reverting
|
77
|
+
# @return [true, false]
|
78
|
+
# Output only
|
79
|
+
# When true, the `Field`'s index configuration is in the process of being
|
80
|
+
# reverted. Once complete, the index config will transition to the same
|
81
|
+
# state as the field specified by `ancestor_field`, at which point
|
82
|
+
# `uses_ancestor_config` will be `true` and `reverting` will be `false`.
|
83
|
+
class IndexConfig; end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|