google-cloud-service_control-v1 0.5.0 → 0.7.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/AUTHENTICATION.md +1 -1
- data/README.md +3 -3
- data/lib/google/api/servicecontrol/v1/check_error_pb.rb +25 -30
- data/lib/google/api/servicecontrol/v1/distribution_pb.rb +25 -28
- data/lib/google/api/servicecontrol/v1/http_request_pb.rb +25 -18
- data/lib/google/api/servicecontrol/v1/log_entry_pb.rb +28 -28
- data/lib/google/api/servicecontrol/v1/metric_value_pb.rb +26 -17
- data/lib/google/api/servicecontrol/v1/operation_pb.rb +28 -17
- data/lib/google/api/servicecontrol/v1/quota_controller_pb.rb +26 -42
- data/lib/google/api/servicecontrol/v1/service_controller_pb.rb +27 -44
- data/lib/google/cloud/service_control/v1/quota_controller/client.rb +2 -2
- data/lib/google/cloud/service_control/v1/quota_controller/rest/client.rb +364 -0
- data/lib/google/cloud/service_control/v1/quota_controller/rest/service_stub.rb +108 -0
- data/lib/google/cloud/service_control/v1/quota_controller/rest.rb +54 -0
- data/lib/google/cloud/service_control/v1/quota_controller.rb +7 -1
- data/lib/google/cloud/service_control/v1/rest.rb +38 -0
- data/lib/google/cloud/service_control/v1/service_controller/client.rb +2 -2
- data/lib/google/cloud/service_control/v1/service_controller/rest/client.rb +487 -0
- data/lib/google/cloud/service_control/v1/service_controller/rest/service_stub.rb +168 -0
- data/lib/google/cloud/service_control/v1/service_controller/rest.rb +54 -0
- data/lib/google/cloud/service_control/v1/service_controller.rb +7 -1
- data/lib/google/cloud/service_control/v1/version.rb +1 -1
- data/lib/google/cloud/service_control/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/distribution.rb +2 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/any.rb +7 -4
- data/proto_docs/google/protobuf/struct.rb +1 -1
- data/proto_docs/google/protobuf/timestamp.rb +1 -3
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +18 -8
@@ -287,9 +287,9 @@ module Google
|
|
287
287
|
# * (`String`) The path to a service account key file in JSON format
|
288
288
|
# * (`Hash`) A service account key as a Hash
|
289
289
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
290
|
-
# (see the [googleauth docs](https://
|
290
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
291
291
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
292
|
-
# (see the [signet docs](https://
|
292
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
293
293
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
294
294
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
295
295
|
# * (`nil`) indicating no credentials
|
@@ -0,0 +1,364 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/api/servicecontrol/v1/quota_controller_pb"
|
21
|
+
require "google/cloud/service_control/v1/quota_controller/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module ServiceControl
|
26
|
+
module V1
|
27
|
+
module QuotaController
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the QuotaController service.
|
31
|
+
#
|
32
|
+
# [Google Quota Control API](/service-control/overview)
|
33
|
+
#
|
34
|
+
# Allows clients to allocate and release quota against a [managed
|
35
|
+
# service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
|
36
|
+
#
|
37
|
+
class Client
|
38
|
+
# @private
|
39
|
+
attr_reader :quota_controller_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the QuotaController Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all QuotaController clients
|
50
|
+
# ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "ServiceControl", "V1"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config
|
71
|
+
end
|
72
|
+
yield @configure if block_given?
|
73
|
+
@configure
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Configure the QuotaController Client instance.
|
78
|
+
#
|
79
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
80
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
81
|
+
# should be made on {Client.configure}.
|
82
|
+
#
|
83
|
+
# See {::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client::Configuration}
|
84
|
+
# for a description of the configuration fields.
|
85
|
+
#
|
86
|
+
# @yield [config] Configure the Client client.
|
87
|
+
# @yieldparam config [Client::Configuration]
|
88
|
+
#
|
89
|
+
# @return [Client::Configuration]
|
90
|
+
#
|
91
|
+
def configure
|
92
|
+
yield @config if block_given?
|
93
|
+
@config
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Create a new QuotaController REST client object.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
#
|
101
|
+
# # Create a client using the default configuration
|
102
|
+
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new
|
103
|
+
#
|
104
|
+
# # Create a client using a custom configuration
|
105
|
+
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new do |config|
|
106
|
+
# config.timeout = 10.0
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the QuotaController client.
|
110
|
+
# @yieldparam config [Client::Configuration]
|
111
|
+
#
|
112
|
+
def initialize
|
113
|
+
# Create the configuration object
|
114
|
+
@config = Configuration.new Client.configure
|
115
|
+
|
116
|
+
# Yield the configuration if needed
|
117
|
+
yield @config if block_given?
|
118
|
+
|
119
|
+
# Create credentials
|
120
|
+
credentials = @config.credentials
|
121
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
122
|
+
# but only if the default endpoint does not have a region prefix.
|
123
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
124
|
+
!@config.endpoint.split(".").first.include?("-")
|
125
|
+
credentials ||= Credentials.default scope: @config.scope,
|
126
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
127
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
128
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
129
|
+
end
|
130
|
+
|
131
|
+
@quota_project_id = @config.quota_project
|
132
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
133
|
+
|
134
|
+
@quota_controller_stub = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
135
|
+
end
|
136
|
+
|
137
|
+
# Service calls
|
138
|
+
|
139
|
+
##
|
140
|
+
# Attempts to allocate quota for the specified consumer. It should be called
|
141
|
+
# before the operation is executed.
|
142
|
+
#
|
143
|
+
# This method requires the `servicemanagement.services.quota`
|
144
|
+
# permission on the specified service. For more information, see
|
145
|
+
# [Cloud IAM](https://cloud.google.com/iam).
|
146
|
+
#
|
147
|
+
# **NOTE:** The client **must** fail-open on server errors `INTERNAL`,
|
148
|
+
# `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system
|
149
|
+
# reliability, the server may inject these errors to prohibit any hard
|
150
|
+
# dependency on the quota functionality.
|
151
|
+
#
|
152
|
+
# @overload allocate_quota(request, options = nil)
|
153
|
+
# Pass arguments to `allocate_quota` via a request object, either of type
|
154
|
+
# {::Google::Cloud::ServiceControl::V1::AllocateQuotaRequest} or an equivalent Hash.
|
155
|
+
#
|
156
|
+
# @param request [::Google::Cloud::ServiceControl::V1::AllocateQuotaRequest, ::Hash]
|
157
|
+
# A request object representing the call parameters. Required. To specify no
|
158
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
159
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
160
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
161
|
+
#
|
162
|
+
# @overload allocate_quota(service_name: nil, allocate_operation: nil, service_config_id: nil)
|
163
|
+
# Pass arguments to `allocate_quota` via keyword arguments. Note that at
|
164
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
165
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
166
|
+
#
|
167
|
+
# @param service_name [::String]
|
168
|
+
# Name of the service as specified in the service configuration. For example,
|
169
|
+
# `"pubsub.googleapis.com"`.
|
170
|
+
#
|
171
|
+
# See [google.api.Service][google.api.Service] for the definition of a service name.
|
172
|
+
# @param allocate_operation [::Google::Cloud::ServiceControl::V1::QuotaOperation, ::Hash]
|
173
|
+
# Operation that describes the quota allocation.
|
174
|
+
# @param service_config_id [::String]
|
175
|
+
# Specifies which version of service configuration should be used to process
|
176
|
+
# the request. If unspecified or no matching version can be found, the latest
|
177
|
+
# one will be used.
|
178
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
179
|
+
# @yieldparam result [::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse]
|
180
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
181
|
+
#
|
182
|
+
# @return [::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse]
|
183
|
+
#
|
184
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
185
|
+
def allocate_quota request, options = nil
|
186
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
187
|
+
|
188
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceControl::V1::AllocateQuotaRequest
|
189
|
+
|
190
|
+
# Converts hash and nil to an options object
|
191
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
192
|
+
|
193
|
+
# Customize the options with defaults
|
194
|
+
call_metadata = @config.rpcs.allocate_quota.metadata.to_h
|
195
|
+
|
196
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
197
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
198
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
199
|
+
gapic_version: ::Google::Cloud::ServiceControl::V1::VERSION,
|
200
|
+
transports_version_send: [:rest]
|
201
|
+
|
202
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
203
|
+
|
204
|
+
options.apply_defaults timeout: @config.rpcs.allocate_quota.timeout,
|
205
|
+
metadata: call_metadata,
|
206
|
+
retry_policy: @config.rpcs.allocate_quota.retry_policy
|
207
|
+
|
208
|
+
options.apply_defaults timeout: @config.timeout,
|
209
|
+
metadata: @config.metadata,
|
210
|
+
retry_policy: @config.retry_policy
|
211
|
+
|
212
|
+
@quota_controller_stub.allocate_quota request, options do |result, operation|
|
213
|
+
yield result, operation if block_given?
|
214
|
+
return result
|
215
|
+
end
|
216
|
+
rescue ::Gapic::Rest::Error => e
|
217
|
+
raise ::Google::Cloud::Error.from_error(e)
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Configuration class for the QuotaController REST API.
|
222
|
+
#
|
223
|
+
# This class represents the configuration for QuotaController REST,
|
224
|
+
# providing control over timeouts, retry behavior, logging, transport
|
225
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
226
|
+
# applied individually to specific RPCs. See
|
227
|
+
# {::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client::Configuration::Rpcs}
|
228
|
+
# for a list of RPCs that can be configured independently.
|
229
|
+
#
|
230
|
+
# Configuration can be applied globally to all clients, or to a single client
|
231
|
+
# on construction.
|
232
|
+
#
|
233
|
+
# @example
|
234
|
+
#
|
235
|
+
# # Modify the global config, setting the timeout for
|
236
|
+
# # allocate_quota to 20 seconds,
|
237
|
+
# # and all remaining timeouts to 10 seconds.
|
238
|
+
# ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.configure do |config|
|
239
|
+
# config.timeout = 10.0
|
240
|
+
# config.rpcs.allocate_quota.timeout = 20.0
|
241
|
+
# end
|
242
|
+
#
|
243
|
+
# # Apply the above configuration only to a new client.
|
244
|
+
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new do |config|
|
245
|
+
# config.timeout = 10.0
|
246
|
+
# config.rpcs.allocate_quota.timeout = 20.0
|
247
|
+
# end
|
248
|
+
#
|
249
|
+
# @!attribute [rw] endpoint
|
250
|
+
# The hostname or hostname:port of the service endpoint.
|
251
|
+
# Defaults to `"servicecontrol.googleapis.com"`.
|
252
|
+
# @return [::String]
|
253
|
+
# @!attribute [rw] credentials
|
254
|
+
# Credentials to send with calls. You may provide any of the following types:
|
255
|
+
# * (`String`) The path to a service account key file in JSON format
|
256
|
+
# * (`Hash`) A service account key as a Hash
|
257
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
258
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
259
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
260
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
261
|
+
# * (`nil`) indicating no credentials
|
262
|
+
# @return [::Object]
|
263
|
+
# @!attribute [rw] scope
|
264
|
+
# The OAuth scopes
|
265
|
+
# @return [::Array<::String>]
|
266
|
+
# @!attribute [rw] lib_name
|
267
|
+
# The library name as recorded in instrumentation and logging
|
268
|
+
# @return [::String]
|
269
|
+
# @!attribute [rw] lib_version
|
270
|
+
# The library version as recorded in instrumentation and logging
|
271
|
+
# @return [::String]
|
272
|
+
# @!attribute [rw] timeout
|
273
|
+
# The call timeout in seconds.
|
274
|
+
# @return [::Numeric]
|
275
|
+
# @!attribute [rw] metadata
|
276
|
+
# Additional headers to be sent with the call.
|
277
|
+
# @return [::Hash{::Symbol=>::String}]
|
278
|
+
# @!attribute [rw] retry_policy
|
279
|
+
# The retry policy. The value is a hash with the following keys:
|
280
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
281
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
282
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
283
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
284
|
+
# trigger a retry.
|
285
|
+
# @return [::Hash]
|
286
|
+
# @!attribute [rw] quota_project
|
287
|
+
# A separate project against which to charge quota.
|
288
|
+
# @return [::String]
|
289
|
+
#
|
290
|
+
class Configuration
|
291
|
+
extend ::Gapic::Config
|
292
|
+
|
293
|
+
config_attr :endpoint, "servicecontrol.googleapis.com", ::String
|
294
|
+
config_attr :credentials, nil do |value|
|
295
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
296
|
+
allowed.any? { |klass| klass === value }
|
297
|
+
end
|
298
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
299
|
+
config_attr :lib_name, nil, ::String, nil
|
300
|
+
config_attr :lib_version, nil, ::String, nil
|
301
|
+
config_attr :timeout, nil, ::Numeric, nil
|
302
|
+
config_attr :metadata, nil, ::Hash, nil
|
303
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
304
|
+
config_attr :quota_project, nil, ::String, nil
|
305
|
+
|
306
|
+
# @private
|
307
|
+
def initialize parent_config = nil
|
308
|
+
@parent_config = parent_config unless parent_config.nil?
|
309
|
+
|
310
|
+
yield self if block_given?
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# Configurations for individual RPCs
|
315
|
+
# @return [Rpcs]
|
316
|
+
#
|
317
|
+
def rpcs
|
318
|
+
@rpcs ||= begin
|
319
|
+
parent_rpcs = nil
|
320
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
321
|
+
Rpcs.new parent_rpcs
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
##
|
326
|
+
# Configuration RPC class for the QuotaController API.
|
327
|
+
#
|
328
|
+
# Includes fields providing the configuration for each RPC in this service.
|
329
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
330
|
+
# the following configuration fields:
|
331
|
+
#
|
332
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
333
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
334
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
335
|
+
# include the following keys:
|
336
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
337
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
338
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
339
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
340
|
+
# trigger a retry.
|
341
|
+
#
|
342
|
+
class Rpcs
|
343
|
+
##
|
344
|
+
# RPC-specific configuration for `allocate_quota`
|
345
|
+
# @return [::Gapic::Config::Method]
|
346
|
+
#
|
347
|
+
attr_reader :allocate_quota
|
348
|
+
|
349
|
+
# @private
|
350
|
+
def initialize parent_rpcs = nil
|
351
|
+
allocate_quota_config = parent_rpcs.allocate_quota if parent_rpcs.respond_to? :allocate_quota
|
352
|
+
@allocate_quota = ::Gapic::Config::Method.new allocate_quota_config
|
353
|
+
|
354
|
+
yield self if block_given?
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/api/servicecontrol/v1/quota_controller_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module ServiceControl
|
24
|
+
module V1
|
25
|
+
module QuotaController
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the QuotaController service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
def initialize endpoint:, credentials:
|
34
|
+
# These require statements are intentionally placed here to initialize
|
35
|
+
# the REST modules only when it's required.
|
36
|
+
require "gapic/rest"
|
37
|
+
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
39
|
+
numeric_enums: true,
|
40
|
+
raise_faraday_errors: false
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Baseline implementation for the allocate_quota REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::ServiceControl::V1::AllocateQuotaRequest]
|
47
|
+
# A request object representing the call parameters. Required.
|
48
|
+
# @param options [::Gapic::CallOptions]
|
49
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
50
|
+
#
|
51
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
52
|
+
# @yieldparam result [::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def allocate_quota request_pb, options = nil
|
58
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
59
|
+
|
60
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_allocate_quota_request request_pb
|
61
|
+
query_string_params = if query_string_params.any?
|
62
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
response = @client_stub.make_http_request(
|
68
|
+
verb,
|
69
|
+
uri: uri,
|
70
|
+
body: body || "",
|
71
|
+
params: query_string_params,
|
72
|
+
options: options
|
73
|
+
)
|
74
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
75
|
+
result = ::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# @private
|
83
|
+
#
|
84
|
+
# GRPC transcoding helper method for the allocate_quota REST call
|
85
|
+
#
|
86
|
+
# @param request_pb [::Google::Cloud::ServiceControl::V1::AllocateQuotaRequest]
|
87
|
+
# A request object representing the call parameters. Required.
|
88
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
89
|
+
# Uri, Body, Query string parameters
|
90
|
+
def self.transcode_allocate_quota_request request_pb
|
91
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
92
|
+
.with_bindings(
|
93
|
+
uri_method: :post,
|
94
|
+
uri_template: "/v1/services/{service_name}:allocateQuota",
|
95
|
+
body: "*",
|
96
|
+
matches: [
|
97
|
+
["service_name", %r{^[^/]+/?$}, false]
|
98
|
+
]
|
99
|
+
)
|
100
|
+
transcoder.transcode request_pb
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/service_control/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/service_control/v1/quota_controller/credentials"
|
26
|
+
require "google/cloud/service_control/v1/quota_controller/rest/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module ServiceControl
|
31
|
+
module V1
|
32
|
+
##
|
33
|
+
# [Google Quota Control API](/service-control/overview)
|
34
|
+
#
|
35
|
+
# Allows clients to allocate and release quota against a [managed
|
36
|
+
# service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
|
37
|
+
#
|
38
|
+
# To load this service and instantiate a REST client:
|
39
|
+
#
|
40
|
+
# require "google/cloud/service_control/v1/quota_controller/rest"
|
41
|
+
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new
|
42
|
+
#
|
43
|
+
module QuotaController
|
44
|
+
# Client for the REST transport
|
45
|
+
module Rest
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
54
|
+
require "google/cloud/service_control/v1/quota_controller/rest/helpers" if ::File.file? helper_path
|
@@ -24,6 +24,7 @@ require "google/cloud/service_control/v1/version"
|
|
24
24
|
|
25
25
|
require "google/cloud/service_control/v1/quota_controller/credentials"
|
26
26
|
require "google/cloud/service_control/v1/quota_controller/client"
|
27
|
+
require "google/cloud/service_control/v1/quota_controller/rest"
|
27
28
|
|
28
29
|
module Google
|
29
30
|
module Cloud
|
@@ -35,11 +36,16 @@ module Google
|
|
35
36
|
# Allows clients to allocate and release quota against a [managed
|
36
37
|
# service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
|
37
38
|
#
|
38
|
-
#
|
39
|
+
# @example Load this service and instantiate a gRPC client
|
39
40
|
#
|
40
41
|
# require "google/cloud/service_control/v1/quota_controller"
|
41
42
|
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Client.new
|
42
43
|
#
|
44
|
+
# @example Load this service and instantiate a REST client
|
45
|
+
#
|
46
|
+
# require "google/cloud/service_control/v1/quota_controller/rest"
|
47
|
+
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new
|
48
|
+
#
|
43
49
|
module QuotaController
|
44
50
|
end
|
45
51
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/service_control/v1/quota_controller/rest"
|
20
|
+
require "google/cloud/service_control/v1/service_controller/rest"
|
21
|
+
require "google/cloud/service_control/v1/version"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module ServiceControl
|
26
|
+
##
|
27
|
+
# To load just the REST part of this package, including all its services, and instantiate a REST client:
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
#
|
31
|
+
# require "google/cloud/service_control/v1/rest"
|
32
|
+
# client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new
|
33
|
+
#
|
34
|
+
module V1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -426,9 +426,9 @@ module Google
|
|
426
426
|
# * (`String`) The path to a service account key file in JSON format
|
427
427
|
# * (`Hash`) A service account key as a Hash
|
428
428
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
429
|
-
# (see the [googleauth docs](https://
|
429
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
430
430
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
431
|
-
# (see the [signet docs](https://
|
431
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
432
432
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
433
433
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
434
434
|
# * (`nil`) indicating no credentials
|