google-cloud-service_control-v1 0.1.0

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