google-cloud-service_control-v1 0.4.6 → 0.6.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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +13 -8
  4. data/lib/google/api/servicecontrol/v1/check_error_pb.rb +2 -1
  5. data/lib/google/api/servicecontrol/v1/distribution_pb.rb +2 -1
  6. data/lib/google/api/servicecontrol/v1/http_request_pb.rb +2 -1
  7. data/lib/google/api/servicecontrol/v1/log_entry_pb.rb +2 -1
  8. data/lib/google/api/servicecontrol/v1/metric_value_pb.rb +2 -1
  9. data/lib/google/api/servicecontrol/v1/operation_pb.rb +2 -1
  10. data/lib/google/api/servicecontrol/v1/quota_controller_pb.rb +2 -1
  11. data/lib/google/api/servicecontrol/v1/service_controller_pb.rb +2 -2
  12. data/lib/google/cloud/service_control/v1/quota_controller/rest/client.rb +364 -0
  13. data/lib/google/cloud/service_control/v1/quota_controller/rest/service_stub.rb +108 -0
  14. data/lib/google/cloud/service_control/v1/quota_controller/rest.rb +54 -0
  15. data/lib/google/cloud/service_control/v1/quota_controller.rb +7 -1
  16. data/lib/google/cloud/service_control/v1/rest.rb +38 -0
  17. data/lib/google/cloud/service_control/v1/service_controller/rest/client.rb +487 -0
  18. data/lib/google/cloud/service_control/v1/service_controller/rest/service_stub.rb +168 -0
  19. data/lib/google/cloud/service_control/v1/service_controller/rest.rb +54 -0
  20. data/lib/google/cloud/service_control/v1/service_controller.rb +7 -1
  21. data/lib/google/cloud/service_control/v1/version.rb +1 -1
  22. data/lib/google/cloud/service_control/v1.rb +8 -1
  23. data/proto_docs/google/api/client.rb +318 -0
  24. data/proto_docs/google/api/launch_stage.rb +71 -0
  25. data/proto_docs/google/protobuf/any.rb +3 -3
  26. data/proto_docs/google/protobuf/struct.rb +2 -2
  27. data/proto_docs/google/rpc/status.rb +4 -2
  28. metadata +23 -13
@@ -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
- # To load this service and instantiate a client:
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
@@ -0,0 +1,487 @@
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/service_controller_pb"
21
+ require "google/cloud/service_control/v1/service_controller/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ServiceControl
26
+ module V1
27
+ module ServiceController
28
+ module Rest
29
+ ##
30
+ # REST client for the ServiceController service.
31
+ #
32
+ # [Google Service Control API](/service-control/overview)
33
+ #
34
+ # Lets clients check and report operations 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 :service_controller_stub
40
+
41
+ ##
42
+ # Configure the ServiceController Client class.
43
+ #
44
+ # See {::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all ServiceController clients
50
+ # ::Google::Cloud::ServiceControl::V1::ServiceController::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.rpcs.check.timeout = 5.0
71
+ default_config.rpcs.check.retry_policy = {
72
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config.rpcs.report.timeout = 16.0
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the ServiceController Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new ServiceController REST client object.
105
+ #
106
+ # @example
107
+ #
108
+ # # Create a client using the default configuration
109
+ # client = ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.new
110
+ #
111
+ # # Create a client using a custom configuration
112
+ # client = ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.new do |config|
113
+ # config.timeout = 10.0
114
+ # end
115
+ #
116
+ # @yield [config] Configure the ServiceController client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ def initialize
120
+ # Create the configuration object
121
+ @config = Configuration.new Client.configure
122
+
123
+ # Yield the configuration if needed
124
+ yield @config if block_given?
125
+
126
+ # Create credentials
127
+ credentials = @config.credentials
128
+ # Use self-signed JWT if the endpoint is unchanged from default,
129
+ # but only if the default endpoint does not have a region prefix.
130
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
131
+ !@config.endpoint.split(".").first.include?("-")
132
+ credentials ||= Credentials.default scope: @config.scope,
133
+ enable_self_signed_jwt: enable_self_signed_jwt
134
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
135
+ credentials = Credentials.new credentials, scope: @config.scope
136
+ end
137
+
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @service_controller_stub = ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
142
+ end
143
+
144
+ # Service calls
145
+
146
+ ##
147
+ # Checks whether an operation on a service should be allowed to proceed
148
+ # based on the configuration of the service and related policies. It must be
149
+ # called before the operation is executed.
150
+ #
151
+ # If feasible, the client should cache the check results and reuse them for
152
+ # 60 seconds. In case of any server errors, the client should rely on the
153
+ # cached results for much longer time to avoid outage.
154
+ # WARNING: There is general 60s delay for the configuration and policy
155
+ # propagation, therefore callers MUST NOT depend on the `Check` method having
156
+ # the latest policy information.
157
+ #
158
+ # NOTE: the {::Google::Cloud::ServiceControl::V1::CheckRequest CheckRequest} has
159
+ # the size limit (wire-format byte size) of 1MB.
160
+ #
161
+ # This method requires the `servicemanagement.services.check` permission
162
+ # on the specified service. For more information, see
163
+ # [Cloud IAM](https://cloud.google.com/iam).
164
+ #
165
+ # @overload check(request, options = nil)
166
+ # Pass arguments to `check` via a request object, either of type
167
+ # {::Google::Cloud::ServiceControl::V1::CheckRequest} or an equivalent Hash.
168
+ #
169
+ # @param request [::Google::Cloud::ServiceControl::V1::CheckRequest, ::Hash]
170
+ # A request object representing the call parameters. Required. To specify no
171
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
172
+ # @param options [::Gapic::CallOptions, ::Hash]
173
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
174
+ #
175
+ # @overload check(service_name: nil, operation: nil, service_config_id: nil)
176
+ # Pass arguments to `check` via keyword arguments. Note that at
177
+ # least one keyword argument is required. To specify no parameters, or to keep all
178
+ # the default parameter values, pass an empty Hash as a request object (see above).
179
+ #
180
+ # @param service_name [::String]
181
+ # The service name as specified in its service configuration. For example,
182
+ # `"pubsub.googleapis.com"`.
183
+ #
184
+ # See
185
+ # [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
186
+ # for the definition of a service name.
187
+ # @param operation [::Google::Cloud::ServiceControl::V1::Operation, ::Hash]
188
+ # The operation to be checked.
189
+ # @param service_config_id [::String]
190
+ # Specifies which version of service configuration should be used to process
191
+ # the request.
192
+ #
193
+ # If unspecified or no matching version can be found, the
194
+ # latest one will be used.
195
+ # @yield [result, operation] Access the result along with the TransportOperation object
196
+ # @yieldparam result [::Google::Cloud::ServiceControl::V1::CheckResponse]
197
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
198
+ #
199
+ # @return [::Google::Cloud::ServiceControl::V1::CheckResponse]
200
+ #
201
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
202
+ def check request, options = nil
203
+ raise ::ArgumentError, "request must be provided" if request.nil?
204
+
205
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceControl::V1::CheckRequest
206
+
207
+ # Converts hash and nil to an options object
208
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
209
+
210
+ # Customize the options with defaults
211
+ call_metadata = @config.rpcs.check.metadata.to_h
212
+
213
+ # Set x-goog-api-client and x-goog-user-project headers
214
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
215
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
216
+ gapic_version: ::Google::Cloud::ServiceControl::V1::VERSION,
217
+ transports_version_send: [:rest]
218
+
219
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
220
+
221
+ options.apply_defaults timeout: @config.rpcs.check.timeout,
222
+ metadata: call_metadata,
223
+ retry_policy: @config.rpcs.check.retry_policy
224
+
225
+ options.apply_defaults timeout: @config.timeout,
226
+ metadata: @config.metadata,
227
+ retry_policy: @config.retry_policy
228
+
229
+ @service_controller_stub.check request, options do |result, operation|
230
+ yield result, operation if block_given?
231
+ return result
232
+ end
233
+ rescue ::Gapic::Rest::Error => e
234
+ raise ::Google::Cloud::Error.from_error(e)
235
+ end
236
+
237
+ ##
238
+ # Reports operation results to Google Service Control, such as logs and
239
+ # metrics. It should be called after an operation is completed.
240
+ #
241
+ # If feasible, the client should aggregate reporting data for up to 5
242
+ # seconds to reduce API traffic. Limiting aggregation to 5 seconds is to
243
+ # reduce data loss during client crashes. Clients should carefully choose
244
+ # the aggregation time window to avoid data loss risk more than 0.01%
245
+ # for business and compliance reasons.
246
+ #
247
+ # NOTE: the {::Google::Cloud::ServiceControl::V1::ReportRequest ReportRequest} has
248
+ # the size limit (wire-format byte size) of 1MB.
249
+ #
250
+ # This method requires the `servicemanagement.services.report` permission
251
+ # on the specified service. For more information, see
252
+ # [Google Cloud IAM](https://cloud.google.com/iam).
253
+ #
254
+ # @overload report(request, options = nil)
255
+ # Pass arguments to `report` via a request object, either of type
256
+ # {::Google::Cloud::ServiceControl::V1::ReportRequest} or an equivalent Hash.
257
+ #
258
+ # @param request [::Google::Cloud::ServiceControl::V1::ReportRequest, ::Hash]
259
+ # A request object representing the call parameters. Required. To specify no
260
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
261
+ # @param options [::Gapic::CallOptions, ::Hash]
262
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
263
+ #
264
+ # @overload report(service_name: nil, operations: nil, service_config_id: nil)
265
+ # Pass arguments to `report` via keyword arguments. Note that at
266
+ # least one keyword argument is required. To specify no parameters, or to keep all
267
+ # the default parameter values, pass an empty Hash as a request object (see above).
268
+ #
269
+ # @param service_name [::String]
270
+ # The service name as specified in its service configuration. For example,
271
+ # `"pubsub.googleapis.com"`.
272
+ #
273
+ # See
274
+ # [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
275
+ # for the definition of a service name.
276
+ # @param operations [::Array<::Google::Cloud::ServiceControl::V1::Operation, ::Hash>]
277
+ # Operations to be reported.
278
+ #
279
+ # Typically the service should report one operation per request.
280
+ # Putting multiple operations into a single request is allowed, but should
281
+ # be used only when multiple operations are natually available at the time
282
+ # of the report.
283
+ #
284
+ # There is no limit on the number of operations in the same ReportRequest,
285
+ # however the ReportRequest size should be no larger than 1MB. See
286
+ # {::Google::Cloud::ServiceControl::V1::ReportResponse#report_errors ReportResponse.report_errors}
287
+ # for partial failure behavior.
288
+ # @param service_config_id [::String]
289
+ # Specifies which version of service config should be used to process the
290
+ # request.
291
+ #
292
+ # If unspecified or no matching version can be found, the
293
+ # latest one will be used.
294
+ # @yield [result, operation] Access the result along with the TransportOperation object
295
+ # @yieldparam result [::Google::Cloud::ServiceControl::V1::ReportResponse]
296
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
297
+ #
298
+ # @return [::Google::Cloud::ServiceControl::V1::ReportResponse]
299
+ #
300
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
301
+ def report request, options = nil
302
+ raise ::ArgumentError, "request must be provided" if request.nil?
303
+
304
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceControl::V1::ReportRequest
305
+
306
+ # Converts hash and nil to an options object
307
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
308
+
309
+ # Customize the options with defaults
310
+ call_metadata = @config.rpcs.report.metadata.to_h
311
+
312
+ # Set x-goog-api-client and x-goog-user-project headers
313
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
314
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
315
+ gapic_version: ::Google::Cloud::ServiceControl::V1::VERSION,
316
+ transports_version_send: [:rest]
317
+
318
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
319
+
320
+ options.apply_defaults timeout: @config.rpcs.report.timeout,
321
+ metadata: call_metadata,
322
+ retry_policy: @config.rpcs.report.retry_policy
323
+
324
+ options.apply_defaults timeout: @config.timeout,
325
+ metadata: @config.metadata,
326
+ retry_policy: @config.retry_policy
327
+
328
+ @service_controller_stub.report request, options do |result, operation|
329
+ yield result, operation if block_given?
330
+ return result
331
+ end
332
+ rescue ::Gapic::Rest::Error => e
333
+ raise ::Google::Cloud::Error.from_error(e)
334
+ end
335
+
336
+ ##
337
+ # Configuration class for the ServiceController REST API.
338
+ #
339
+ # This class represents the configuration for ServiceController REST,
340
+ # providing control over timeouts, retry behavior, logging, transport
341
+ # parameters, and other low-level controls. Certain parameters can also be
342
+ # applied individually to specific RPCs. See
343
+ # {::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client::Configuration::Rpcs}
344
+ # for a list of RPCs that can be configured independently.
345
+ #
346
+ # Configuration can be applied globally to all clients, or to a single client
347
+ # on construction.
348
+ #
349
+ # @example
350
+ #
351
+ # # Modify the global config, setting the timeout for
352
+ # # check to 20 seconds,
353
+ # # and all remaining timeouts to 10 seconds.
354
+ # ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.configure do |config|
355
+ # config.timeout = 10.0
356
+ # config.rpcs.check.timeout = 20.0
357
+ # end
358
+ #
359
+ # # Apply the above configuration only to a new client.
360
+ # client = ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.new do |config|
361
+ # config.timeout = 10.0
362
+ # config.rpcs.check.timeout = 20.0
363
+ # end
364
+ #
365
+ # @!attribute [rw] endpoint
366
+ # The hostname or hostname:port of the service endpoint.
367
+ # Defaults to `"servicecontrol.googleapis.com"`.
368
+ # @return [::String]
369
+ # @!attribute [rw] credentials
370
+ # Credentials to send with calls. You may provide any of the following types:
371
+ # * (`String`) The path to a service account key file in JSON format
372
+ # * (`Hash`) A service account key as a Hash
373
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
374
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
375
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
376
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
377
+ # * (`nil`) indicating no credentials
378
+ # @return [::Object]
379
+ # @!attribute [rw] scope
380
+ # The OAuth scopes
381
+ # @return [::Array<::String>]
382
+ # @!attribute [rw] lib_name
383
+ # The library name as recorded in instrumentation and logging
384
+ # @return [::String]
385
+ # @!attribute [rw] lib_version
386
+ # The library version as recorded in instrumentation and logging
387
+ # @return [::String]
388
+ # @!attribute [rw] timeout
389
+ # The call timeout in seconds.
390
+ # @return [::Numeric]
391
+ # @!attribute [rw] metadata
392
+ # Additional headers to be sent with the call.
393
+ # @return [::Hash{::Symbol=>::String}]
394
+ # @!attribute [rw] retry_policy
395
+ # The retry policy. The value is a hash with the following keys:
396
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
397
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
398
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
399
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
400
+ # trigger a retry.
401
+ # @return [::Hash]
402
+ # @!attribute [rw] quota_project
403
+ # A separate project against which to charge quota.
404
+ # @return [::String]
405
+ #
406
+ class Configuration
407
+ extend ::Gapic::Config
408
+
409
+ config_attr :endpoint, "servicecontrol.googleapis.com", ::String
410
+ config_attr :credentials, nil do |value|
411
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
412
+ allowed.any? { |klass| klass === value }
413
+ end
414
+ config_attr :scope, nil, ::String, ::Array, nil
415
+ config_attr :lib_name, nil, ::String, nil
416
+ config_attr :lib_version, nil, ::String, nil
417
+ config_attr :timeout, nil, ::Numeric, nil
418
+ config_attr :metadata, nil, ::Hash, nil
419
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
420
+ config_attr :quota_project, nil, ::String, nil
421
+
422
+ # @private
423
+ def initialize parent_config = nil
424
+ @parent_config = parent_config unless parent_config.nil?
425
+
426
+ yield self if block_given?
427
+ end
428
+
429
+ ##
430
+ # Configurations for individual RPCs
431
+ # @return [Rpcs]
432
+ #
433
+ def rpcs
434
+ @rpcs ||= begin
435
+ parent_rpcs = nil
436
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
437
+ Rpcs.new parent_rpcs
438
+ end
439
+ end
440
+
441
+ ##
442
+ # Configuration RPC class for the ServiceController API.
443
+ #
444
+ # Includes fields providing the configuration for each RPC in this service.
445
+ # Each configuration object is of type `Gapic::Config::Method` and includes
446
+ # the following configuration fields:
447
+ #
448
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
449
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
450
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
451
+ # include the following keys:
452
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
453
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
454
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
455
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
456
+ # trigger a retry.
457
+ #
458
+ class Rpcs
459
+ ##
460
+ # RPC-specific configuration for `check`
461
+ # @return [::Gapic::Config::Method]
462
+ #
463
+ attr_reader :check
464
+ ##
465
+ # RPC-specific configuration for `report`
466
+ # @return [::Gapic::Config::Method]
467
+ #
468
+ attr_reader :report
469
+
470
+ # @private
471
+ def initialize parent_rpcs = nil
472
+ check_config = parent_rpcs.check if parent_rpcs.respond_to? :check
473
+ @check = ::Gapic::Config::Method.new check_config
474
+ report_config = parent_rpcs.report if parent_rpcs.respond_to? :report
475
+ @report = ::Gapic::Config::Method.new report_config
476
+
477
+ yield self if block_given?
478
+ end
479
+ end
480
+ end
481
+ end
482
+ end
483
+ end
484
+ end
485
+ end
486
+ end
487
+ end