google-cloud-universal_ledger-v1 0.a → 0.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/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +151 -8
- data/lib/google/cloud/universal_ledger/v1/rest.rb +37 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger/client.rb +1163 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger/credentials.rb +47 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger/paths.rb +69 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger/rest/client.rb +1067 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger/rest/service_stub.rb +511 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger/rest.rb +59 -0
- data/lib/google/cloud/universal_ledger/v1/universal_ledger.rb +62 -0
- data/lib/google/cloud/universal_ledger/v1/version.rb +7 -2
- data/lib/google/cloud/universal_ledger/v1.rb +45 -0
- data/lib/google/cloud/universalledger/v1/accounts_pb.rb +23 -0
- data/lib/google/cloud/universalledger/v1/common_pb.rb +36 -0
- data/lib/google/cloud/universalledger/v1/query_pb.rb +39 -0
- data/lib/google/cloud/universalledger/v1/status_event_pb.rb +27 -0
- data/lib/google/cloud/universalledger/v1/transactions_pb.rb +52 -0
- data/lib/google/cloud/universalledger/v1/types_pb.rb +47 -0
- data/lib/google/cloud/universalledger/v1/universalledger_pb.rb +41 -0
- data/lib/google/cloud/universalledger/v1/universalledger_services_pb.rb +89 -0
- data/lib/google-cloud-universal_ledger-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +593 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/universalledger/v1/accounts.rb +75 -0
- data/proto_docs/google/cloud/universalledger/v1/common.rb +272 -0
- data/proto_docs/google/cloud/universalledger/v1/query.rb +314 -0
- data/proto_docs/google/cloud/universalledger/v1/status_event.rb +88 -0
- data/proto_docs/google/cloud/universalledger/v1/transactions.rb +716 -0
- data/proto_docs/google/cloud/universalledger/v1/types.rb +618 -0
- data/proto_docs/google/cloud/universalledger/v1/universalledger.rb +237 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +128 -0
- data/proto_docs/google/rpc/code.rb +185 -0
- metadata +86 -9
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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/cloud/universalledger/v1/universalledger_pb"
|
|
21
|
+
require "google/cloud/universal_ledger/v1/universal_ledger/rest/service_stub"
|
|
22
|
+
require "google/cloud/location/rest"
|
|
23
|
+
|
|
24
|
+
module Google
|
|
25
|
+
module Cloud
|
|
26
|
+
module UniversalLedger
|
|
27
|
+
module V1
|
|
28
|
+
module UniversalLedger
|
|
29
|
+
module Rest
|
|
30
|
+
##
|
|
31
|
+
# REST client for the UniversalLedger service.
|
|
32
|
+
#
|
|
33
|
+
# A service for interacting with the Google Cloud Universal Ledger.
|
|
34
|
+
# Endpoints are pre-created and managed by Google and cannot
|
|
35
|
+
# be modified by users.
|
|
36
|
+
# The names of available endpoints will be provided in the public
|
|
37
|
+
# documentation.
|
|
38
|
+
# An endpoint is a regional resource within a Universal Ledger network.
|
|
39
|
+
# Requests sent to an endpoint may be routed to different validators in the
|
|
40
|
+
# given network within the given region.
|
|
41
|
+
#
|
|
42
|
+
class Client
|
|
43
|
+
# @private
|
|
44
|
+
API_VERSION = ""
|
|
45
|
+
|
|
46
|
+
# @private
|
|
47
|
+
DEFAULT_ENDPOINT_TEMPLATE = "universalledger.$UNIVERSE_DOMAIN$"
|
|
48
|
+
|
|
49
|
+
include Paths
|
|
50
|
+
|
|
51
|
+
# @private
|
|
52
|
+
attr_reader :universal_ledger_stub
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Configure the UniversalLedger Client class.
|
|
56
|
+
#
|
|
57
|
+
# See {::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client::Configuration}
|
|
58
|
+
# for a description of the configuration fields.
|
|
59
|
+
#
|
|
60
|
+
# @example
|
|
61
|
+
#
|
|
62
|
+
# # Modify the configuration for all UniversalLedger clients
|
|
63
|
+
# ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.configure do |config|
|
|
64
|
+
# config.timeout = 10.0
|
|
65
|
+
# end
|
|
66
|
+
#
|
|
67
|
+
# @yield [config] Configure the Client client.
|
|
68
|
+
# @yieldparam config [Client::Configuration]
|
|
69
|
+
#
|
|
70
|
+
# @return [Client::Configuration]
|
|
71
|
+
#
|
|
72
|
+
def self.configure
|
|
73
|
+
@configure ||= begin
|
|
74
|
+
namespace = ["Google", "Cloud", "UniversalLedger", "V1"]
|
|
75
|
+
parent_config = while namespace.any?
|
|
76
|
+
parent_name = namespace.join "::"
|
|
77
|
+
parent_const = const_get parent_name
|
|
78
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
79
|
+
namespace.pop
|
|
80
|
+
end
|
|
81
|
+
default_config = Client::Configuration.new parent_config
|
|
82
|
+
|
|
83
|
+
default_config.rpcs.submit_transaction.timeout = 60.0
|
|
84
|
+
|
|
85
|
+
default_config.rpcs.list_endpoints.timeout = 60.0
|
|
86
|
+
default_config.rpcs.list_endpoints.retry_policy = {
|
|
87
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
default_config.rpcs.get_endpoint.timeout = 60.0
|
|
91
|
+
default_config.rpcs.get_endpoint.retry_policy = {
|
|
92
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
default_config.rpcs.submit_operational_transaction.timeout = 60.0
|
|
96
|
+
|
|
97
|
+
default_config.rpcs.query_transaction_state.timeout = 60.0
|
|
98
|
+
default_config.rpcs.query_transaction_state.retry_policy = {
|
|
99
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
default_config.rpcs.query_account.timeout = 60.0
|
|
103
|
+
default_config.rpcs.query_account.retry_policy = {
|
|
104
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
default_config.rpcs.query_data.timeout = 60.0
|
|
108
|
+
default_config.rpcs.query_data.retry_policy = {
|
|
109
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
default_config
|
|
113
|
+
end
|
|
114
|
+
yield @configure if block_given?
|
|
115
|
+
@configure
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
##
|
|
119
|
+
# Configure the UniversalLedger Client instance.
|
|
120
|
+
#
|
|
121
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
122
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
123
|
+
# should be made on {Client.configure}.
|
|
124
|
+
#
|
|
125
|
+
# See {::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client::Configuration}
|
|
126
|
+
# for a description of the configuration fields.
|
|
127
|
+
#
|
|
128
|
+
# @yield [config] Configure the Client client.
|
|
129
|
+
# @yieldparam config [Client::Configuration]
|
|
130
|
+
#
|
|
131
|
+
# @return [Client::Configuration]
|
|
132
|
+
#
|
|
133
|
+
def configure
|
|
134
|
+
yield @config if block_given?
|
|
135
|
+
@config
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
##
|
|
139
|
+
# The effective universe domain
|
|
140
|
+
#
|
|
141
|
+
# @return [String]
|
|
142
|
+
#
|
|
143
|
+
def universe_domain
|
|
144
|
+
@universal_ledger_stub.universe_domain
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
##
|
|
148
|
+
# Create a new UniversalLedger REST client object.
|
|
149
|
+
#
|
|
150
|
+
# @example
|
|
151
|
+
#
|
|
152
|
+
# # Create a client using the default configuration
|
|
153
|
+
# client = ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
154
|
+
#
|
|
155
|
+
# # Create a client using a custom configuration
|
|
156
|
+
# client = ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new do |config|
|
|
157
|
+
# config.timeout = 10.0
|
|
158
|
+
# end
|
|
159
|
+
#
|
|
160
|
+
# @yield [config] Configure the UniversalLedger client.
|
|
161
|
+
# @yieldparam config [Client::Configuration]
|
|
162
|
+
#
|
|
163
|
+
def initialize
|
|
164
|
+
# Create the configuration object
|
|
165
|
+
@config = Configuration.new Client.configure
|
|
166
|
+
|
|
167
|
+
# Yield the configuration if needed
|
|
168
|
+
yield @config if block_given?
|
|
169
|
+
|
|
170
|
+
# Create credentials
|
|
171
|
+
credentials = @config.credentials
|
|
172
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
173
|
+
# but only if the default endpoint does not have a region prefix.
|
|
174
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
175
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
176
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
177
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
178
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
179
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
180
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
@quota_project_id = @config.quota_project
|
|
184
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
185
|
+
|
|
186
|
+
@universal_ledger_stub = ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::ServiceStub.new(
|
|
187
|
+
endpoint: @config.endpoint,
|
|
188
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
189
|
+
universe_domain: @config.universe_domain,
|
|
190
|
+
credentials: credentials,
|
|
191
|
+
logger: @config.logger
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
@universal_ledger_stub.logger(stub: true)&.info do |entry|
|
|
195
|
+
entry.set_system_name
|
|
196
|
+
entry.set_service
|
|
197
|
+
entry.message = "Created client for #{entry.service}"
|
|
198
|
+
entry.set_credentials_fields credentials
|
|
199
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
200
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
201
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
|
205
|
+
config.credentials = credentials
|
|
206
|
+
config.quota_project = @quota_project_id
|
|
207
|
+
config.endpoint = @universal_ledger_stub.endpoint
|
|
208
|
+
config.universe_domain = @universal_ledger_stub.universe_domain
|
|
209
|
+
config.logger = @universal_ledger_stub.logger if config.respond_to? :logger=
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
##
|
|
214
|
+
# Get the associated client for mix-in of the Locations.
|
|
215
|
+
#
|
|
216
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
|
217
|
+
#
|
|
218
|
+
attr_reader :location_client
|
|
219
|
+
|
|
220
|
+
##
|
|
221
|
+
# The logger used for request/response debug logging.
|
|
222
|
+
#
|
|
223
|
+
# @return [Logger]
|
|
224
|
+
#
|
|
225
|
+
def logger
|
|
226
|
+
@universal_ledger_stub.logger
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Service calls
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
# Submits a transaction to the network.
|
|
233
|
+
# The request is first validated for basic correctness. If validation fails,
|
|
234
|
+
# the request will fail immediately.
|
|
235
|
+
# If validation succeeds, this method returns only after the transaction has
|
|
236
|
+
# been replicated across a majority of validators in the network, or until
|
|
237
|
+
# the request fails.
|
|
238
|
+
#
|
|
239
|
+
# @overload submit_transaction(request, options = nil)
|
|
240
|
+
# Pass arguments to `submit_transaction` via a request object, either of type
|
|
241
|
+
# {::Google::Cloud::UniversalLedger::V1::SubmitTransactionRequest} or an equivalent Hash.
|
|
242
|
+
#
|
|
243
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::SubmitTransactionRequest, ::Hash]
|
|
244
|
+
# A request object representing the call parameters. Required. To specify no
|
|
245
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
246
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
247
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
248
|
+
#
|
|
249
|
+
# @overload submit_transaction(endpoint: nil, serialized_signed_transaction: nil)
|
|
250
|
+
# Pass arguments to `submit_transaction` via keyword arguments. Note that at
|
|
251
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
252
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
253
|
+
#
|
|
254
|
+
# @param endpoint [::String]
|
|
255
|
+
# Required. The endpoint to submit the transaction to.
|
|
256
|
+
# Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
|
257
|
+
# The location is a region.
|
|
258
|
+
# @param serialized_signed_transaction [::String]
|
|
259
|
+
# Required. A protobuf serialized
|
|
260
|
+
# {::Google::Cloud::UniversalLedger::V1::SignedTransaction SignedTransaction} to
|
|
261
|
+
# submit to the ledger. Using a serialized format ensures that all validators
|
|
262
|
+
# compute the same transaction ID as the SHA-256 digest of the serialized
|
|
263
|
+
# bytes.
|
|
264
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
265
|
+
# @yieldparam result [::Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse]
|
|
266
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
267
|
+
#
|
|
268
|
+
# @return [::Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse]
|
|
269
|
+
#
|
|
270
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
271
|
+
#
|
|
272
|
+
# @example Basic example
|
|
273
|
+
# require "google/cloud/universal_ledger/v1"
|
|
274
|
+
#
|
|
275
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
276
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
277
|
+
#
|
|
278
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
279
|
+
# request = Google::Cloud::UniversalLedger::V1::SubmitTransactionRequest.new
|
|
280
|
+
#
|
|
281
|
+
# # Call the submit_transaction method.
|
|
282
|
+
# result = client.submit_transaction request
|
|
283
|
+
#
|
|
284
|
+
# # The returned object is of type Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse.
|
|
285
|
+
# p result
|
|
286
|
+
#
|
|
287
|
+
def submit_transaction request, options = nil
|
|
288
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
289
|
+
|
|
290
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::SubmitTransactionRequest
|
|
291
|
+
|
|
292
|
+
# Converts hash and nil to an options object
|
|
293
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
294
|
+
|
|
295
|
+
# Customize the options with defaults
|
|
296
|
+
call_metadata = @config.rpcs.submit_transaction.metadata.to_h
|
|
297
|
+
|
|
298
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
299
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
300
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
301
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
302
|
+
transports_version_send: [:rest]
|
|
303
|
+
|
|
304
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
305
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
306
|
+
|
|
307
|
+
options.apply_defaults timeout: @config.rpcs.submit_transaction.timeout,
|
|
308
|
+
metadata: call_metadata,
|
|
309
|
+
retry_policy: @config.rpcs.submit_transaction.retry_policy
|
|
310
|
+
|
|
311
|
+
options.apply_defaults timeout: @config.timeout,
|
|
312
|
+
metadata: @config.metadata,
|
|
313
|
+
retry_policy: @config.retry_policy
|
|
314
|
+
|
|
315
|
+
@universal_ledger_stub.submit_transaction request, options do |result, operation|
|
|
316
|
+
yield result, operation if block_given?
|
|
317
|
+
end
|
|
318
|
+
rescue ::Gapic::Rest::Error => e
|
|
319
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
##
|
|
323
|
+
# Lists all endpoints for a given project and location.
|
|
324
|
+
#
|
|
325
|
+
# @overload list_endpoints(request, options = nil)
|
|
326
|
+
# Pass arguments to `list_endpoints` via a request object, either of type
|
|
327
|
+
# {::Google::Cloud::UniversalLedger::V1::ListEndpointsRequest} or an equivalent Hash.
|
|
328
|
+
#
|
|
329
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::ListEndpointsRequest, ::Hash]
|
|
330
|
+
# A request object representing the call parameters. Required. To specify no
|
|
331
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
332
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
333
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
334
|
+
#
|
|
335
|
+
# @overload list_endpoints(parent: nil, page_size: nil, page_token: nil)
|
|
336
|
+
# Pass arguments to `list_endpoints` via keyword arguments. Note that at
|
|
337
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
338
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
339
|
+
#
|
|
340
|
+
# @param parent [::String]
|
|
341
|
+
# Required. The parent, which owns this collection of endpoints.
|
|
342
|
+
# Format: `projects/{project}/locations/{location}`
|
|
343
|
+
# @param page_size [::Integer]
|
|
344
|
+
# Optional. The maximum number of endpoints to return. The service may return
|
|
345
|
+
# fewer than this value. If unspecified, at most 50 endpoints will be
|
|
346
|
+
# returned. The maximum value is 1000; values above 1000 will be coerced to
|
|
347
|
+
# 1000.
|
|
348
|
+
# @param page_token [::String]
|
|
349
|
+
# Optional. A page token, received from a previous `ListEndpoints` call.
|
|
350
|
+
# Provide this to retrieve the subsequent page.
|
|
351
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
352
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::UniversalLedger::V1::Endpoint>]
|
|
353
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
354
|
+
#
|
|
355
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::UniversalLedger::V1::Endpoint>]
|
|
356
|
+
#
|
|
357
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
358
|
+
#
|
|
359
|
+
# @example Basic example
|
|
360
|
+
# require "google/cloud/universal_ledger/v1"
|
|
361
|
+
#
|
|
362
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
363
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
364
|
+
#
|
|
365
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
366
|
+
# request = Google::Cloud::UniversalLedger::V1::ListEndpointsRequest.new
|
|
367
|
+
#
|
|
368
|
+
# # Call the list_endpoints method.
|
|
369
|
+
# result = client.list_endpoints request
|
|
370
|
+
#
|
|
371
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
372
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
373
|
+
# result.each do |item|
|
|
374
|
+
# # Each element is of type ::Google::Cloud::UniversalLedger::V1::Endpoint.
|
|
375
|
+
# p item
|
|
376
|
+
# end
|
|
377
|
+
#
|
|
378
|
+
def list_endpoints request, options = nil
|
|
379
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
380
|
+
|
|
381
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::ListEndpointsRequest
|
|
382
|
+
|
|
383
|
+
# Converts hash and nil to an options object
|
|
384
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
385
|
+
|
|
386
|
+
# Customize the options with defaults
|
|
387
|
+
call_metadata = @config.rpcs.list_endpoints.metadata.to_h
|
|
388
|
+
|
|
389
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
390
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
391
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
392
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
393
|
+
transports_version_send: [:rest]
|
|
394
|
+
|
|
395
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
396
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
397
|
+
|
|
398
|
+
options.apply_defaults timeout: @config.rpcs.list_endpoints.timeout,
|
|
399
|
+
metadata: call_metadata,
|
|
400
|
+
retry_policy: @config.rpcs.list_endpoints.retry_policy
|
|
401
|
+
|
|
402
|
+
options.apply_defaults timeout: @config.timeout,
|
|
403
|
+
metadata: @config.metadata,
|
|
404
|
+
retry_policy: @config.retry_policy
|
|
405
|
+
|
|
406
|
+
@universal_ledger_stub.list_endpoints request, options do |result, operation|
|
|
407
|
+
result = ::Gapic::Rest::PagedEnumerable.new @universal_ledger_stub, :list_endpoints, "endpoints", request, result, options
|
|
408
|
+
yield result, operation if block_given?
|
|
409
|
+
throw :response, result
|
|
410
|
+
end
|
|
411
|
+
rescue ::Gapic::Rest::Error => e
|
|
412
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
##
|
|
416
|
+
# Gets the details of a specific endpoint.
|
|
417
|
+
#
|
|
418
|
+
# @overload get_endpoint(request, options = nil)
|
|
419
|
+
# Pass arguments to `get_endpoint` via a request object, either of type
|
|
420
|
+
# {::Google::Cloud::UniversalLedger::V1::GetEndpointRequest} or an equivalent Hash.
|
|
421
|
+
#
|
|
422
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::GetEndpointRequest, ::Hash]
|
|
423
|
+
# A request object representing the call parameters. Required. To specify no
|
|
424
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
425
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
426
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
427
|
+
#
|
|
428
|
+
# @overload get_endpoint(name: nil)
|
|
429
|
+
# Pass arguments to `get_endpoint` via keyword arguments. Note that at
|
|
430
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
431
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
432
|
+
#
|
|
433
|
+
# @param name [::String]
|
|
434
|
+
# Required. The name of the endpoint to retrieve.
|
|
435
|
+
# Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
|
436
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
437
|
+
# @yieldparam result [::Google::Cloud::UniversalLedger::V1::Endpoint]
|
|
438
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
439
|
+
#
|
|
440
|
+
# @return [::Google::Cloud::UniversalLedger::V1::Endpoint]
|
|
441
|
+
#
|
|
442
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
443
|
+
#
|
|
444
|
+
# @example Basic example
|
|
445
|
+
# require "google/cloud/universal_ledger/v1"
|
|
446
|
+
#
|
|
447
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
448
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
449
|
+
#
|
|
450
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
451
|
+
# request = Google::Cloud::UniversalLedger::V1::GetEndpointRequest.new
|
|
452
|
+
#
|
|
453
|
+
# # Call the get_endpoint method.
|
|
454
|
+
# result = client.get_endpoint request
|
|
455
|
+
#
|
|
456
|
+
# # The returned object is of type Google::Cloud::UniversalLedger::V1::Endpoint.
|
|
457
|
+
# p result
|
|
458
|
+
#
|
|
459
|
+
def get_endpoint request, options = nil
|
|
460
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
461
|
+
|
|
462
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::GetEndpointRequest
|
|
463
|
+
|
|
464
|
+
# Converts hash and nil to an options object
|
|
465
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
466
|
+
|
|
467
|
+
# Customize the options with defaults
|
|
468
|
+
call_metadata = @config.rpcs.get_endpoint.metadata.to_h
|
|
469
|
+
|
|
470
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
471
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
472
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
473
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
474
|
+
transports_version_send: [:rest]
|
|
475
|
+
|
|
476
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
477
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
478
|
+
|
|
479
|
+
options.apply_defaults timeout: @config.rpcs.get_endpoint.timeout,
|
|
480
|
+
metadata: call_metadata,
|
|
481
|
+
retry_policy: @config.rpcs.get_endpoint.retry_policy
|
|
482
|
+
|
|
483
|
+
options.apply_defaults timeout: @config.timeout,
|
|
484
|
+
metadata: @config.metadata,
|
|
485
|
+
retry_policy: @config.retry_policy
|
|
486
|
+
|
|
487
|
+
@universal_ledger_stub.get_endpoint request, options do |result, operation|
|
|
488
|
+
yield result, operation if block_given?
|
|
489
|
+
end
|
|
490
|
+
rescue ::Gapic::Rest::Error => e
|
|
491
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
##
|
|
495
|
+
# Submits an operational transaction to the network.
|
|
496
|
+
# This method returns only after the transaction has been replicated across a
|
|
497
|
+
# majority of validators in the network, or if the transaction fails.
|
|
498
|
+
#
|
|
499
|
+
# @overload submit_operational_transaction(request, options = nil)
|
|
500
|
+
# Pass arguments to `submit_operational_transaction` via a request object, either of type
|
|
501
|
+
# {::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionRequest} or an equivalent Hash.
|
|
502
|
+
#
|
|
503
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionRequest, ::Hash]
|
|
504
|
+
# A request object representing the call parameters. Required. To specify no
|
|
505
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
506
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
507
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
508
|
+
#
|
|
509
|
+
# @overload submit_operational_transaction(endpoint: nil, serialized_signed_operational_transaction: nil)
|
|
510
|
+
# Pass arguments to `submit_operational_transaction` via keyword arguments. Note that at
|
|
511
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
512
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
513
|
+
#
|
|
514
|
+
# @param endpoint [::String]
|
|
515
|
+
# Required. The endpoint to serve the request.
|
|
516
|
+
# Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
|
517
|
+
# The location is a region.
|
|
518
|
+
# @param serialized_signed_operational_transaction [::String]
|
|
519
|
+
# Required. A protobuf serialized
|
|
520
|
+
# {::Google::Cloud::UniversalLedger::V1::SignedTransaction SignedTransaction} to
|
|
521
|
+
# submit to the ledger. The enclosed client transaction must be an
|
|
522
|
+
# operational transaction, and the sender must be the platform operator.
|
|
523
|
+
# Using a serialized format ensures that all validators compute the same
|
|
524
|
+
# transaction ID as the SHA-256 digest of the serialized bytes.
|
|
525
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
526
|
+
# @yieldparam result [::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse]
|
|
527
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
528
|
+
#
|
|
529
|
+
# @return [::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse]
|
|
530
|
+
#
|
|
531
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
532
|
+
#
|
|
533
|
+
# @example Basic example
|
|
534
|
+
# require "google/cloud/universal_ledger/v1"
|
|
535
|
+
#
|
|
536
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
537
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
538
|
+
#
|
|
539
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
540
|
+
# request = Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionRequest.new
|
|
541
|
+
#
|
|
542
|
+
# # Call the submit_operational_transaction method.
|
|
543
|
+
# result = client.submit_operational_transaction request
|
|
544
|
+
#
|
|
545
|
+
# # The returned object is of type Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse.
|
|
546
|
+
# p result
|
|
547
|
+
#
|
|
548
|
+
def submit_operational_transaction request, options = nil
|
|
549
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
550
|
+
|
|
551
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionRequest
|
|
552
|
+
|
|
553
|
+
# Converts hash and nil to an options object
|
|
554
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
555
|
+
|
|
556
|
+
# Customize the options with defaults
|
|
557
|
+
call_metadata = @config.rpcs.submit_operational_transaction.metadata.to_h
|
|
558
|
+
|
|
559
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
560
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
561
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
562
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
563
|
+
transports_version_send: [:rest]
|
|
564
|
+
|
|
565
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
566
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
567
|
+
|
|
568
|
+
options.apply_defaults timeout: @config.rpcs.submit_operational_transaction.timeout,
|
|
569
|
+
metadata: call_metadata,
|
|
570
|
+
retry_policy: @config.rpcs.submit_operational_transaction.retry_policy
|
|
571
|
+
|
|
572
|
+
options.apply_defaults timeout: @config.timeout,
|
|
573
|
+
metadata: @config.metadata,
|
|
574
|
+
retry_policy: @config.retry_policy
|
|
575
|
+
|
|
576
|
+
@universal_ledger_stub.submit_operational_transaction request, options do |result, operation|
|
|
577
|
+
yield result, operation if block_given?
|
|
578
|
+
end
|
|
579
|
+
rescue ::Gapic::Rest::Error => e
|
|
580
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
581
|
+
end
|
|
582
|
+
|
|
583
|
+
##
|
|
584
|
+
# Deprecated: Use the
|
|
585
|
+
# {::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client#query_data QueryData}
|
|
586
|
+
# method instead. Queries the state of a transaction. This method can be
|
|
587
|
+
# called for any transaction submitted to the network. The returned
|
|
588
|
+
# transaction details may vary between calls, because an endpoint may route
|
|
589
|
+
# requests to different validators within the network and region, and the
|
|
590
|
+
# validators may not be at the same round ID at any given time.
|
|
591
|
+
#
|
|
592
|
+
# @overload query_transaction_state(request, options = nil)
|
|
593
|
+
# Pass arguments to `query_transaction_state` via a request object, either of type
|
|
594
|
+
# {::Google::Cloud::UniversalLedger::V1::QueryTransactionStateRequest} or an equivalent Hash.
|
|
595
|
+
#
|
|
596
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::QueryTransactionStateRequest, ::Hash]
|
|
597
|
+
# A request object representing the call parameters. Required. To specify no
|
|
598
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
599
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
600
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
601
|
+
#
|
|
602
|
+
# @overload query_transaction_state(endpoint: nil, transaction_digest_hex: nil)
|
|
603
|
+
# Pass arguments to `query_transaction_state` via keyword arguments. Note that at
|
|
604
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
605
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
606
|
+
#
|
|
607
|
+
# @param endpoint [::String]
|
|
608
|
+
# Required. The endpoint to serve the request.
|
|
609
|
+
# Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
|
610
|
+
# The location is a region.
|
|
611
|
+
# @param transaction_digest_hex [::String]
|
|
612
|
+
# Required. The transaction ID to get the state of.
|
|
613
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
614
|
+
# @yieldparam result [::Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse]
|
|
615
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
616
|
+
#
|
|
617
|
+
# @return [::Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse]
|
|
618
|
+
#
|
|
619
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
620
|
+
#
|
|
621
|
+
# @example Basic example
|
|
622
|
+
# require "google/cloud/universal_ledger/v1"
|
|
623
|
+
#
|
|
624
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
625
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
626
|
+
#
|
|
627
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
628
|
+
# request = Google::Cloud::UniversalLedger::V1::QueryTransactionStateRequest.new
|
|
629
|
+
#
|
|
630
|
+
# # Call the query_transaction_state method.
|
|
631
|
+
# result = client.query_transaction_state request
|
|
632
|
+
#
|
|
633
|
+
# # The returned object is of type Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse.
|
|
634
|
+
# p result
|
|
635
|
+
#
|
|
636
|
+
def query_transaction_state request, options = nil
|
|
637
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
638
|
+
|
|
639
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::QueryTransactionStateRequest
|
|
640
|
+
|
|
641
|
+
# Converts hash and nil to an options object
|
|
642
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
643
|
+
|
|
644
|
+
# Customize the options with defaults
|
|
645
|
+
call_metadata = @config.rpcs.query_transaction_state.metadata.to_h
|
|
646
|
+
|
|
647
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
648
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
649
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
650
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
651
|
+
transports_version_send: [:rest]
|
|
652
|
+
|
|
653
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
654
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
655
|
+
|
|
656
|
+
options.apply_defaults timeout: @config.rpcs.query_transaction_state.timeout,
|
|
657
|
+
metadata: call_metadata,
|
|
658
|
+
retry_policy: @config.rpcs.query_transaction_state.retry_policy
|
|
659
|
+
|
|
660
|
+
options.apply_defaults timeout: @config.timeout,
|
|
661
|
+
metadata: @config.metadata,
|
|
662
|
+
retry_policy: @config.retry_policy
|
|
663
|
+
|
|
664
|
+
@universal_ledger_stub.query_transaction_state request, options do |result, operation|
|
|
665
|
+
yield result, operation if block_given?
|
|
666
|
+
end
|
|
667
|
+
rescue ::Gapic::Rest::Error => e
|
|
668
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
##
|
|
672
|
+
# Deprecated: Use the
|
|
673
|
+
# {::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client#query_data QueryData}
|
|
674
|
+
# method instead. Queries all the information stored about an account in the
|
|
675
|
+
# network. The returned account details may vary between calls, because an
|
|
676
|
+
# endpoint may route requests to different validators within the network and
|
|
677
|
+
# region, and the validators may not be at the same round ID at any given
|
|
678
|
+
# time.
|
|
679
|
+
#
|
|
680
|
+
# @overload query_account(request, options = nil)
|
|
681
|
+
# Pass arguments to `query_account` via a request object, either of type
|
|
682
|
+
# {::Google::Cloud::UniversalLedger::V1::QueryAccountRequest} or an equivalent Hash.
|
|
683
|
+
#
|
|
684
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::QueryAccountRequest, ::Hash]
|
|
685
|
+
# A request object representing the call parameters. Required. To specify no
|
|
686
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
687
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
688
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
689
|
+
#
|
|
690
|
+
# @overload query_account(endpoint: nil, account_id: nil, round_id: nil)
|
|
691
|
+
# Pass arguments to `query_account` via keyword arguments. Note that at
|
|
692
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
693
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
694
|
+
#
|
|
695
|
+
# @param endpoint [::String]
|
|
696
|
+
# Required. The endpoint to serve the request.
|
|
697
|
+
# Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
|
698
|
+
# The location is a region.
|
|
699
|
+
# @param account_id [::String]
|
|
700
|
+
# Required. The account ID to get information about. The value is limited to
|
|
701
|
+
# 60 characters.
|
|
702
|
+
# @param round_id [::Integer]
|
|
703
|
+
# Optional. The ID of the execution round (similar to block "height") at
|
|
704
|
+
# which to request data. The returned account information will be accurate
|
|
705
|
+
# for the world state at this execution round. If unspecified, uses the
|
|
706
|
+
# latest finalized round as known by the serving validator. The state at a
|
|
707
|
+
# given round ID is always consistent and canonical.
|
|
708
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
709
|
+
# @yieldparam result [::Google::Cloud::UniversalLedger::V1::QueryAccountResponse]
|
|
710
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
711
|
+
#
|
|
712
|
+
# @return [::Google::Cloud::UniversalLedger::V1::QueryAccountResponse]
|
|
713
|
+
#
|
|
714
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
715
|
+
#
|
|
716
|
+
# @example Basic example
|
|
717
|
+
# require "google/cloud/universal_ledger/v1"
|
|
718
|
+
#
|
|
719
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
720
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
721
|
+
#
|
|
722
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
723
|
+
# request = Google::Cloud::UniversalLedger::V1::QueryAccountRequest.new
|
|
724
|
+
#
|
|
725
|
+
# # Call the query_account method.
|
|
726
|
+
# result = client.query_account request
|
|
727
|
+
#
|
|
728
|
+
# # The returned object is of type Google::Cloud::UniversalLedger::V1::QueryAccountResponse.
|
|
729
|
+
# p result
|
|
730
|
+
#
|
|
731
|
+
def query_account request, options = nil
|
|
732
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
733
|
+
|
|
734
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::QueryAccountRequest
|
|
735
|
+
|
|
736
|
+
# Converts hash and nil to an options object
|
|
737
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
738
|
+
|
|
739
|
+
# Customize the options with defaults
|
|
740
|
+
call_metadata = @config.rpcs.query_account.metadata.to_h
|
|
741
|
+
|
|
742
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
743
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
744
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
745
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
746
|
+
transports_version_send: [:rest]
|
|
747
|
+
|
|
748
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
749
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
750
|
+
|
|
751
|
+
options.apply_defaults timeout: @config.rpcs.query_account.timeout,
|
|
752
|
+
metadata: call_metadata,
|
|
753
|
+
retry_policy: @config.rpcs.query_account.retry_policy
|
|
754
|
+
|
|
755
|
+
options.apply_defaults timeout: @config.timeout,
|
|
756
|
+
metadata: @config.metadata,
|
|
757
|
+
retry_policy: @config.retry_policy
|
|
758
|
+
|
|
759
|
+
@universal_ledger_stub.query_account request, options do |result, operation|
|
|
760
|
+
yield result, operation if block_given?
|
|
761
|
+
end
|
|
762
|
+
rescue ::Gapic::Rest::Error => e
|
|
763
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
764
|
+
end
|
|
765
|
+
|
|
766
|
+
##
|
|
767
|
+
# Queries the network for information stored on the ledger,
|
|
768
|
+
# such as accounts and transactions.
|
|
769
|
+
#
|
|
770
|
+
# Access to certain sensitive fields, such as account balances, may be
|
|
771
|
+
# restricted based on the identity of the sender derived from the signature
|
|
772
|
+
# in the request. If the sender lacks permission, sensitive fields will be
|
|
773
|
+
# redacted from the response and reported in the `redacted_fields` field.
|
|
774
|
+
#
|
|
775
|
+
# @overload query_data(request, options = nil)
|
|
776
|
+
# Pass arguments to `query_data` via a request object, either of type
|
|
777
|
+
# {::Google::Cloud::UniversalLedger::V1::QueryDataRequest} or an equivalent Hash.
|
|
778
|
+
#
|
|
779
|
+
# @param request [::Google::Cloud::UniversalLedger::V1::QueryDataRequest, ::Hash]
|
|
780
|
+
# A request object representing the call parameters. Required. To specify no
|
|
781
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
782
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
783
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
784
|
+
#
|
|
785
|
+
# @overload query_data(endpoint: nil, serialized_signed_query_request: nil)
|
|
786
|
+
# Pass arguments to `query_data` via keyword arguments. Note that at
|
|
787
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
788
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
789
|
+
#
|
|
790
|
+
# @param endpoint [::String]
|
|
791
|
+
# Required. The endpoint to serve the request.
|
|
792
|
+
# Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
|
793
|
+
# The location is a region.
|
|
794
|
+
# @param serialized_signed_query_request [::String]
|
|
795
|
+
# Required. A protobuf serialized
|
|
796
|
+
# {::Google::Cloud::UniversalLedger::V1::SignedQueryRequest SignedQueryRequest} to
|
|
797
|
+
# query the Universal Ledger network.
|
|
798
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
799
|
+
# @yieldparam result [::Google::Cloud::UniversalLedger::V1::QueryDataResponse]
|
|
800
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
801
|
+
#
|
|
802
|
+
# @return [::Google::Cloud::UniversalLedger::V1::QueryDataResponse]
|
|
803
|
+
#
|
|
804
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
805
|
+
#
|
|
806
|
+
# @example Basic example
|
|
807
|
+
# require "google/cloud/universal_ledger/v1"
|
|
808
|
+
#
|
|
809
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
810
|
+
# client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new
|
|
811
|
+
#
|
|
812
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
813
|
+
# request = Google::Cloud::UniversalLedger::V1::QueryDataRequest.new
|
|
814
|
+
#
|
|
815
|
+
# # Call the query_data method.
|
|
816
|
+
# result = client.query_data request
|
|
817
|
+
#
|
|
818
|
+
# # The returned object is of type Google::Cloud::UniversalLedger::V1::QueryDataResponse.
|
|
819
|
+
# p result
|
|
820
|
+
#
|
|
821
|
+
def query_data request, options = nil
|
|
822
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
823
|
+
|
|
824
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::UniversalLedger::V1::QueryDataRequest
|
|
825
|
+
|
|
826
|
+
# Converts hash and nil to an options object
|
|
827
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
828
|
+
|
|
829
|
+
# Customize the options with defaults
|
|
830
|
+
call_metadata = @config.rpcs.query_data.metadata.to_h
|
|
831
|
+
|
|
832
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
833
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
834
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
835
|
+
gapic_version: ::Google::Cloud::UniversalLedger::V1::VERSION,
|
|
836
|
+
transports_version_send: [:rest]
|
|
837
|
+
|
|
838
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
839
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
840
|
+
|
|
841
|
+
options.apply_defaults timeout: @config.rpcs.query_data.timeout,
|
|
842
|
+
metadata: call_metadata,
|
|
843
|
+
retry_policy: @config.rpcs.query_data.retry_policy
|
|
844
|
+
|
|
845
|
+
options.apply_defaults timeout: @config.timeout,
|
|
846
|
+
metadata: @config.metadata,
|
|
847
|
+
retry_policy: @config.retry_policy
|
|
848
|
+
|
|
849
|
+
@universal_ledger_stub.query_data request, options do |result, operation|
|
|
850
|
+
yield result, operation if block_given?
|
|
851
|
+
end
|
|
852
|
+
rescue ::Gapic::Rest::Error => e
|
|
853
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
854
|
+
end
|
|
855
|
+
|
|
856
|
+
##
|
|
857
|
+
# Configuration class for the UniversalLedger REST API.
|
|
858
|
+
#
|
|
859
|
+
# This class represents the configuration for UniversalLedger REST,
|
|
860
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
861
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
862
|
+
# applied individually to specific RPCs. See
|
|
863
|
+
# {::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client::Configuration::Rpcs}
|
|
864
|
+
# for a list of RPCs that can be configured independently.
|
|
865
|
+
#
|
|
866
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
867
|
+
# on construction.
|
|
868
|
+
#
|
|
869
|
+
# @example
|
|
870
|
+
#
|
|
871
|
+
# # Modify the global config, setting the timeout for
|
|
872
|
+
# # submit_transaction to 20 seconds,
|
|
873
|
+
# # and all remaining timeouts to 10 seconds.
|
|
874
|
+
# ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.configure do |config|
|
|
875
|
+
# config.timeout = 10.0
|
|
876
|
+
# config.rpcs.submit_transaction.timeout = 20.0
|
|
877
|
+
# end
|
|
878
|
+
#
|
|
879
|
+
# # Apply the above configuration only to a new client.
|
|
880
|
+
# client = ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new do |config|
|
|
881
|
+
# config.timeout = 10.0
|
|
882
|
+
# config.rpcs.submit_transaction.timeout = 20.0
|
|
883
|
+
# end
|
|
884
|
+
#
|
|
885
|
+
# @!attribute [rw] endpoint
|
|
886
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
887
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
888
|
+
# @return [::String,nil]
|
|
889
|
+
# @!attribute [rw] credentials
|
|
890
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
891
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
892
|
+
# * (`Hash`) A service account key as a Hash
|
|
893
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
894
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
895
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
896
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
897
|
+
# * (`nil`) indicating no credentials
|
|
898
|
+
#
|
|
899
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
900
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
901
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
902
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
903
|
+
# For more information, refer to [Validate credential configurations from external
|
|
904
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
905
|
+
# @return [::Object]
|
|
906
|
+
# @!attribute [rw] scope
|
|
907
|
+
# The OAuth scopes
|
|
908
|
+
# @return [::Array<::String>]
|
|
909
|
+
# @!attribute [rw] lib_name
|
|
910
|
+
# The library name as recorded in instrumentation and logging
|
|
911
|
+
# @return [::String]
|
|
912
|
+
# @!attribute [rw] lib_version
|
|
913
|
+
# The library version as recorded in instrumentation and logging
|
|
914
|
+
# @return [::String]
|
|
915
|
+
# @!attribute [rw] timeout
|
|
916
|
+
# The call timeout in seconds.
|
|
917
|
+
# @return [::Numeric]
|
|
918
|
+
# @!attribute [rw] metadata
|
|
919
|
+
# Additional headers to be sent with the call.
|
|
920
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
921
|
+
# @!attribute [rw] retry_policy
|
|
922
|
+
# The retry policy. The value is a hash with the following keys:
|
|
923
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
924
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
925
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
926
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
927
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
928
|
+
# trigger a retry.
|
|
929
|
+
# @return [::Hash]
|
|
930
|
+
# @!attribute [rw] quota_project
|
|
931
|
+
# A separate project against which to charge quota.
|
|
932
|
+
# @return [::String]
|
|
933
|
+
# @!attribute [rw] universe_domain
|
|
934
|
+
# The universe domain within which to make requests. This determines the
|
|
935
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
936
|
+
# universe (usually the default "googleapis.com" universe).
|
|
937
|
+
# @return [::String,nil]
|
|
938
|
+
# @!attribute [rw] logger
|
|
939
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
940
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
941
|
+
# explicitly disable logging.
|
|
942
|
+
# @return [::Logger,:default,nil]
|
|
943
|
+
#
|
|
944
|
+
class Configuration
|
|
945
|
+
extend ::Gapic::Config
|
|
946
|
+
|
|
947
|
+
# @private
|
|
948
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
949
|
+
DEFAULT_ENDPOINT = "universalledger.googleapis.com"
|
|
950
|
+
|
|
951
|
+
config_attr :endpoint, nil, ::String, nil
|
|
952
|
+
config_attr :credentials, nil do |value|
|
|
953
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
954
|
+
allowed.any? { |klass| klass === value }
|
|
955
|
+
end
|
|
956
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
957
|
+
config_attr :lib_name, nil, ::String, nil
|
|
958
|
+
config_attr :lib_version, nil, ::String, nil
|
|
959
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
960
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
961
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
962
|
+
config_attr :quota_project, nil, ::String, nil
|
|
963
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
964
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
965
|
+
|
|
966
|
+
# @private
|
|
967
|
+
def initialize parent_config = nil
|
|
968
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
969
|
+
|
|
970
|
+
yield self if block_given?
|
|
971
|
+
end
|
|
972
|
+
|
|
973
|
+
##
|
|
974
|
+
# Configurations for individual RPCs
|
|
975
|
+
# @return [Rpcs]
|
|
976
|
+
#
|
|
977
|
+
def rpcs
|
|
978
|
+
@rpcs ||= begin
|
|
979
|
+
parent_rpcs = nil
|
|
980
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
981
|
+
Rpcs.new parent_rpcs
|
|
982
|
+
end
|
|
983
|
+
end
|
|
984
|
+
|
|
985
|
+
##
|
|
986
|
+
# Configuration RPC class for the UniversalLedger API.
|
|
987
|
+
#
|
|
988
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
989
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
990
|
+
# the following configuration fields:
|
|
991
|
+
#
|
|
992
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
993
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
994
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
995
|
+
# include the following keys:
|
|
996
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
997
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
998
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
999
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1000
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1001
|
+
# trigger a retry.
|
|
1002
|
+
#
|
|
1003
|
+
class Rpcs
|
|
1004
|
+
##
|
|
1005
|
+
# RPC-specific configuration for `submit_transaction`
|
|
1006
|
+
# @return [::Gapic::Config::Method]
|
|
1007
|
+
#
|
|
1008
|
+
attr_reader :submit_transaction
|
|
1009
|
+
##
|
|
1010
|
+
# RPC-specific configuration for `list_endpoints`
|
|
1011
|
+
# @return [::Gapic::Config::Method]
|
|
1012
|
+
#
|
|
1013
|
+
attr_reader :list_endpoints
|
|
1014
|
+
##
|
|
1015
|
+
# RPC-specific configuration for `get_endpoint`
|
|
1016
|
+
# @return [::Gapic::Config::Method]
|
|
1017
|
+
#
|
|
1018
|
+
attr_reader :get_endpoint
|
|
1019
|
+
##
|
|
1020
|
+
# RPC-specific configuration for `submit_operational_transaction`
|
|
1021
|
+
# @return [::Gapic::Config::Method]
|
|
1022
|
+
#
|
|
1023
|
+
attr_reader :submit_operational_transaction
|
|
1024
|
+
##
|
|
1025
|
+
# RPC-specific configuration for `query_transaction_state`
|
|
1026
|
+
# @return [::Gapic::Config::Method]
|
|
1027
|
+
#
|
|
1028
|
+
attr_reader :query_transaction_state
|
|
1029
|
+
##
|
|
1030
|
+
# RPC-specific configuration for `query_account`
|
|
1031
|
+
# @return [::Gapic::Config::Method]
|
|
1032
|
+
#
|
|
1033
|
+
attr_reader :query_account
|
|
1034
|
+
##
|
|
1035
|
+
# RPC-specific configuration for `query_data`
|
|
1036
|
+
# @return [::Gapic::Config::Method]
|
|
1037
|
+
#
|
|
1038
|
+
attr_reader :query_data
|
|
1039
|
+
|
|
1040
|
+
# @private
|
|
1041
|
+
def initialize parent_rpcs = nil
|
|
1042
|
+
submit_transaction_config = parent_rpcs.submit_transaction if parent_rpcs.respond_to? :submit_transaction
|
|
1043
|
+
@submit_transaction = ::Gapic::Config::Method.new submit_transaction_config
|
|
1044
|
+
list_endpoints_config = parent_rpcs.list_endpoints if parent_rpcs.respond_to? :list_endpoints
|
|
1045
|
+
@list_endpoints = ::Gapic::Config::Method.new list_endpoints_config
|
|
1046
|
+
get_endpoint_config = parent_rpcs.get_endpoint if parent_rpcs.respond_to? :get_endpoint
|
|
1047
|
+
@get_endpoint = ::Gapic::Config::Method.new get_endpoint_config
|
|
1048
|
+
submit_operational_transaction_config = parent_rpcs.submit_operational_transaction if parent_rpcs.respond_to? :submit_operational_transaction
|
|
1049
|
+
@submit_operational_transaction = ::Gapic::Config::Method.new submit_operational_transaction_config
|
|
1050
|
+
query_transaction_state_config = parent_rpcs.query_transaction_state if parent_rpcs.respond_to? :query_transaction_state
|
|
1051
|
+
@query_transaction_state = ::Gapic::Config::Method.new query_transaction_state_config
|
|
1052
|
+
query_account_config = parent_rpcs.query_account if parent_rpcs.respond_to? :query_account
|
|
1053
|
+
@query_account = ::Gapic::Config::Method.new query_account_config
|
|
1054
|
+
query_data_config = parent_rpcs.query_data if parent_rpcs.respond_to? :query_data
|
|
1055
|
+
@query_data = ::Gapic::Config::Method.new query_data_config
|
|
1056
|
+
|
|
1057
|
+
yield self if block_given?
|
|
1058
|
+
end
|
|
1059
|
+
end
|
|
1060
|
+
end
|
|
1061
|
+
end
|
|
1062
|
+
end
|
|
1063
|
+
end
|
|
1064
|
+
end
|
|
1065
|
+
end
|
|
1066
|
+
end
|
|
1067
|
+
end
|