google-cloud-cloud_controls_partner-v1 0.a → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core/client.rb +1171 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core/credentials.rb +47 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core/paths.rb +149 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core/rest/client.rb +1084 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core/rest/service_stub.rb +541 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core/rest.rb +52 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_core.rb +55 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/client.rb +556 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/credentials.rb +47 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/paths.rb +77 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/rest/client.rb +515 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/rest/service_stub.rb +187 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/rest.rb +52 -0
- data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring.rb +55 -0
- data/lib/google/cloud/cloud_controls_partner/v1/rest.rb +38 -0
- data/lib/google/cloud/cloud_controls_partner/v1/version.rb +7 -2
- data/lib/google/cloud/cloud_controls_partner/v1.rb +46 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/access_approval_requests_pb.rb +51 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/completion_state_pb.rb +42 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/core_pb.rb +55 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/core_services_pb.rb +60 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/customer_workloads_pb.rb +55 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/customers_pb.rb +54 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/ekm_connections_pb.rb +49 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/monitoring_pb.rb +45 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/monitoring_services_pb.rb +53 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/partner_permissions_pb.rb +47 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/partners_pb.rb +51 -0
- data/lib/google/cloud/cloudcontrolspartner/v1/violations_pb.rb +58 -0
- data/lib/google-cloud-cloud_controls_partner-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -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 +222 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/access_approval_requests.rb +143 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/completion_state.rb +44 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/core.rb +57 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/customer_workloads.rb +177 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/customers.rb +134 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/ekm_connections.rb +96 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/partner_permissions.rb +66 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/partners.rb +117 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1/violations.rb +229 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/type/interval.rb +45 -0
- metadata +93 -10
data/lib/google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/rest/client.rb
ADDED
@@ -0,0 +1,515 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/cloudcontrolspartner/v1/monitoring_pb"
|
21
|
+
require "google/cloud/cloud_controls_partner/v1/cloud_controls_partner_monitoring/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module CloudControlsPartner
|
26
|
+
module V1
|
27
|
+
module CloudControlsPartnerMonitoring
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the CloudControlsPartnerMonitoring service.
|
31
|
+
#
|
32
|
+
# Service describing handlers for resources
|
33
|
+
#
|
34
|
+
class Client
|
35
|
+
# @private
|
36
|
+
API_VERSION = ""
|
37
|
+
|
38
|
+
# @private
|
39
|
+
DEFAULT_ENDPOINT_TEMPLATE = "cloudcontrolspartner.$UNIVERSE_DOMAIN$"
|
40
|
+
|
41
|
+
include Paths
|
42
|
+
|
43
|
+
# @private
|
44
|
+
attr_reader :cloud_controls_partner_monitoring_stub
|
45
|
+
|
46
|
+
##
|
47
|
+
# Configure the CloudControlsPartnerMonitoring Client class.
|
48
|
+
#
|
49
|
+
# See {::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client::Configuration}
|
50
|
+
# for a description of the configuration fields.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
#
|
54
|
+
# # Modify the configuration for all CloudControlsPartnerMonitoring clients
|
55
|
+
# ::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.configure do |config|
|
56
|
+
# config.timeout = 10.0
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# @yield [config] Configure the Client client.
|
60
|
+
# @yieldparam config [Client::Configuration]
|
61
|
+
#
|
62
|
+
# @return [Client::Configuration]
|
63
|
+
#
|
64
|
+
def self.configure
|
65
|
+
@configure ||= begin
|
66
|
+
namespace = ["Google", "Cloud", "CloudControlsPartner", "V1"]
|
67
|
+
parent_config = while namespace.any?
|
68
|
+
parent_name = namespace.join "::"
|
69
|
+
parent_const = const_get parent_name
|
70
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
71
|
+
namespace.pop
|
72
|
+
end
|
73
|
+
default_config = Client::Configuration.new parent_config
|
74
|
+
|
75
|
+
default_config.rpcs.list_violations.timeout = 60.0
|
76
|
+
default_config.rpcs.list_violations.retry_policy = {
|
77
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.get_violation.timeout = 60.0
|
81
|
+
default_config.rpcs.get_violation.retry_policy = {
|
82
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config
|
86
|
+
end
|
87
|
+
yield @configure if block_given?
|
88
|
+
@configure
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Configure the CloudControlsPartnerMonitoring Client instance.
|
93
|
+
#
|
94
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
95
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
96
|
+
# should be made on {Client.configure}.
|
97
|
+
#
|
98
|
+
# See {::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client::Configuration}
|
99
|
+
# for a description of the configuration fields.
|
100
|
+
#
|
101
|
+
# @yield [config] Configure the Client client.
|
102
|
+
# @yieldparam config [Client::Configuration]
|
103
|
+
#
|
104
|
+
# @return [Client::Configuration]
|
105
|
+
#
|
106
|
+
def configure
|
107
|
+
yield @config if block_given?
|
108
|
+
@config
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# The effective universe domain
|
113
|
+
#
|
114
|
+
# @return [String]
|
115
|
+
#
|
116
|
+
def universe_domain
|
117
|
+
@cloud_controls_partner_monitoring_stub.universe_domain
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# Create a new CloudControlsPartnerMonitoring REST client object.
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
#
|
125
|
+
# # Create a client using the default configuration
|
126
|
+
# client = ::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.new
|
127
|
+
#
|
128
|
+
# # Create a client using a custom configuration
|
129
|
+
# client = ::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.new do |config|
|
130
|
+
# config.timeout = 10.0
|
131
|
+
# end
|
132
|
+
#
|
133
|
+
# @yield [config] Configure the CloudControlsPartnerMonitoring client.
|
134
|
+
# @yieldparam config [Client::Configuration]
|
135
|
+
#
|
136
|
+
def initialize
|
137
|
+
# Create the configuration object
|
138
|
+
@config = Configuration.new Client.configure
|
139
|
+
|
140
|
+
# Yield the configuration if needed
|
141
|
+
yield @config if block_given?
|
142
|
+
|
143
|
+
# Create credentials
|
144
|
+
credentials = @config.credentials
|
145
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
146
|
+
# but only if the default endpoint does not have a region prefix.
|
147
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
148
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
149
|
+
!@config.endpoint.split(".").first.include?("-"))
|
150
|
+
credentials ||= Credentials.default scope: @config.scope,
|
151
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
152
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
153
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
154
|
+
end
|
155
|
+
|
156
|
+
@quota_project_id = @config.quota_project
|
157
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
158
|
+
|
159
|
+
@cloud_controls_partner_monitoring_stub = ::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::ServiceStub.new(
|
160
|
+
endpoint: @config.endpoint,
|
161
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
162
|
+
universe_domain: @config.universe_domain,
|
163
|
+
credentials: credentials
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Service calls
|
168
|
+
|
169
|
+
##
|
170
|
+
# Lists Violations for a workload
|
171
|
+
# Callers may also choose to read across multiple Customers or for a single
|
172
|
+
# customer as per
|
173
|
+
# [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash
|
174
|
+
# character) as a wildcard character instead of \\{customer} & \\{workload}.
|
175
|
+
# Format:
|
176
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
|
177
|
+
#
|
178
|
+
# @overload list_violations(request, options = nil)
|
179
|
+
# Pass arguments to `list_violations` via a request object, either of type
|
180
|
+
# {::Google::Cloud::CloudControlsPartner::V1::ListViolationsRequest} or an equivalent Hash.
|
181
|
+
#
|
182
|
+
# @param request [::Google::Cloud::CloudControlsPartner::V1::ListViolationsRequest, ::Hash]
|
183
|
+
# A request object representing the call parameters. Required. To specify no
|
184
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
185
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
186
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
187
|
+
#
|
188
|
+
# @overload list_violations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, interval: nil)
|
189
|
+
# Pass arguments to `list_violations` via keyword arguments. Note that at
|
190
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
191
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
192
|
+
#
|
193
|
+
# @param parent [::String]
|
194
|
+
# Required. Parent resource
|
195
|
+
# Format
|
196
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
|
197
|
+
# @param page_size [::Integer]
|
198
|
+
# Optional. The maximum number of customers row to return. The service may
|
199
|
+
# return fewer than this value. If unspecified, at most 10 customers will be
|
200
|
+
# returned.
|
201
|
+
# @param page_token [::String]
|
202
|
+
# Optional. A page token, received from a previous `ListViolations` call.
|
203
|
+
# Provide this to retrieve the subsequent page.
|
204
|
+
# @param filter [::String]
|
205
|
+
# Optional. Filtering results
|
206
|
+
# @param order_by [::String]
|
207
|
+
# Optional. Hint for how to order the results
|
208
|
+
# @param interval [::Google::Type::Interval, ::Hash]
|
209
|
+
# Optional. Specifies the interval for retrieving violations.
|
210
|
+
# if unspecified, all violations will be returned.
|
211
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
212
|
+
# @yieldparam result [::Google::Cloud::CloudControlsPartner::V1::ListViolationsResponse]
|
213
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
214
|
+
#
|
215
|
+
# @return [::Google::Cloud::CloudControlsPartner::V1::ListViolationsResponse]
|
216
|
+
#
|
217
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
218
|
+
#
|
219
|
+
# @example Basic example
|
220
|
+
# require "google/cloud/cloud_controls_partner/v1"
|
221
|
+
#
|
222
|
+
# # Create a client object. The client can be reused for multiple calls.
|
223
|
+
# client = Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.new
|
224
|
+
#
|
225
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
226
|
+
# request = Google::Cloud::CloudControlsPartner::V1::ListViolationsRequest.new
|
227
|
+
#
|
228
|
+
# # Call the list_violations method.
|
229
|
+
# result = client.list_violations request
|
230
|
+
#
|
231
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
232
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
233
|
+
# result.each do |item|
|
234
|
+
# # Each element is of type ::Google::Cloud::CloudControlsPartner::V1::Violation.
|
235
|
+
# p item
|
236
|
+
# end
|
237
|
+
#
|
238
|
+
def list_violations request, options = nil
|
239
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
240
|
+
|
241
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1::ListViolationsRequest
|
242
|
+
|
243
|
+
# Converts hash and nil to an options object
|
244
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
245
|
+
|
246
|
+
# Customize the options with defaults
|
247
|
+
call_metadata = @config.rpcs.list_violations.metadata.to_h
|
248
|
+
|
249
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
250
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
251
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
252
|
+
gapic_version: ::Google::Cloud::CloudControlsPartner::V1::VERSION,
|
253
|
+
transports_version_send: [:rest]
|
254
|
+
|
255
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
256
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
257
|
+
|
258
|
+
options.apply_defaults timeout: @config.rpcs.list_violations.timeout,
|
259
|
+
metadata: call_metadata,
|
260
|
+
retry_policy: @config.rpcs.list_violations.retry_policy
|
261
|
+
|
262
|
+
options.apply_defaults timeout: @config.timeout,
|
263
|
+
metadata: @config.metadata,
|
264
|
+
retry_policy: @config.retry_policy
|
265
|
+
|
266
|
+
@cloud_controls_partner_monitoring_stub.list_violations request, options do |result, operation|
|
267
|
+
yield result, operation if block_given?
|
268
|
+
return result
|
269
|
+
end
|
270
|
+
rescue ::Gapic::Rest::Error => e
|
271
|
+
raise ::Google::Cloud::Error.from_error(e)
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Gets details of a single Violation.
|
276
|
+
#
|
277
|
+
# @overload get_violation(request, options = nil)
|
278
|
+
# Pass arguments to `get_violation` via a request object, either of type
|
279
|
+
# {::Google::Cloud::CloudControlsPartner::V1::GetViolationRequest} or an equivalent Hash.
|
280
|
+
#
|
281
|
+
# @param request [::Google::Cloud::CloudControlsPartner::V1::GetViolationRequest, ::Hash]
|
282
|
+
# A request object representing the call parameters. Required. To specify no
|
283
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
284
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
285
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
286
|
+
#
|
287
|
+
# @overload get_violation(name: nil)
|
288
|
+
# Pass arguments to `get_violation` via keyword arguments. Note that at
|
289
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
290
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
291
|
+
#
|
292
|
+
# @param name [::String]
|
293
|
+
# Required. Format:
|
294
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}`
|
295
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
296
|
+
# @yieldparam result [::Google::Cloud::CloudControlsPartner::V1::Violation]
|
297
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
298
|
+
#
|
299
|
+
# @return [::Google::Cloud::CloudControlsPartner::V1::Violation]
|
300
|
+
#
|
301
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
302
|
+
#
|
303
|
+
# @example Basic example
|
304
|
+
# require "google/cloud/cloud_controls_partner/v1"
|
305
|
+
#
|
306
|
+
# # Create a client object. The client can be reused for multiple calls.
|
307
|
+
# client = Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.new
|
308
|
+
#
|
309
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
310
|
+
# request = Google::Cloud::CloudControlsPartner::V1::GetViolationRequest.new
|
311
|
+
#
|
312
|
+
# # Call the get_violation method.
|
313
|
+
# result = client.get_violation request
|
314
|
+
#
|
315
|
+
# # The returned object is of type Google::Cloud::CloudControlsPartner::V1::Violation.
|
316
|
+
# p result
|
317
|
+
#
|
318
|
+
def get_violation request, options = nil
|
319
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
320
|
+
|
321
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1::GetViolationRequest
|
322
|
+
|
323
|
+
# Converts hash and nil to an options object
|
324
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
325
|
+
|
326
|
+
# Customize the options with defaults
|
327
|
+
call_metadata = @config.rpcs.get_violation.metadata.to_h
|
328
|
+
|
329
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
330
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
331
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
332
|
+
gapic_version: ::Google::Cloud::CloudControlsPartner::V1::VERSION,
|
333
|
+
transports_version_send: [:rest]
|
334
|
+
|
335
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
336
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
337
|
+
|
338
|
+
options.apply_defaults timeout: @config.rpcs.get_violation.timeout,
|
339
|
+
metadata: call_metadata,
|
340
|
+
retry_policy: @config.rpcs.get_violation.retry_policy
|
341
|
+
|
342
|
+
options.apply_defaults timeout: @config.timeout,
|
343
|
+
metadata: @config.metadata,
|
344
|
+
retry_policy: @config.retry_policy
|
345
|
+
|
346
|
+
@cloud_controls_partner_monitoring_stub.get_violation request, options do |result, operation|
|
347
|
+
yield result, operation if block_given?
|
348
|
+
return result
|
349
|
+
end
|
350
|
+
rescue ::Gapic::Rest::Error => e
|
351
|
+
raise ::Google::Cloud::Error.from_error(e)
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# Configuration class for the CloudControlsPartnerMonitoring REST API.
|
356
|
+
#
|
357
|
+
# This class represents the configuration for CloudControlsPartnerMonitoring REST,
|
358
|
+
# providing control over timeouts, retry behavior, logging, transport
|
359
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
360
|
+
# applied individually to specific RPCs. See
|
361
|
+
# {::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client::Configuration::Rpcs}
|
362
|
+
# for a list of RPCs that can be configured independently.
|
363
|
+
#
|
364
|
+
# Configuration can be applied globally to all clients, or to a single client
|
365
|
+
# on construction.
|
366
|
+
#
|
367
|
+
# @example
|
368
|
+
#
|
369
|
+
# # Modify the global config, setting the timeout for
|
370
|
+
# # list_violations to 20 seconds,
|
371
|
+
# # and all remaining timeouts to 10 seconds.
|
372
|
+
# ::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.configure do |config|
|
373
|
+
# config.timeout = 10.0
|
374
|
+
# config.rpcs.list_violations.timeout = 20.0
|
375
|
+
# end
|
376
|
+
#
|
377
|
+
# # Apply the above configuration only to a new client.
|
378
|
+
# client = ::Google::Cloud::CloudControlsPartner::V1::CloudControlsPartnerMonitoring::Rest::Client.new do |config|
|
379
|
+
# config.timeout = 10.0
|
380
|
+
# config.rpcs.list_violations.timeout = 20.0
|
381
|
+
# end
|
382
|
+
#
|
383
|
+
# @!attribute [rw] endpoint
|
384
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
385
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
386
|
+
# @return [::String,nil]
|
387
|
+
# @!attribute [rw] credentials
|
388
|
+
# Credentials to send with calls. You may provide any of the following types:
|
389
|
+
# * (`String`) The path to a service account key file in JSON format
|
390
|
+
# * (`Hash`) A service account key as a Hash
|
391
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
392
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
393
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
394
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
395
|
+
# * (`nil`) indicating no credentials
|
396
|
+
# @return [::Object]
|
397
|
+
# @!attribute [rw] scope
|
398
|
+
# The OAuth scopes
|
399
|
+
# @return [::Array<::String>]
|
400
|
+
# @!attribute [rw] lib_name
|
401
|
+
# The library name as recorded in instrumentation and logging
|
402
|
+
# @return [::String]
|
403
|
+
# @!attribute [rw] lib_version
|
404
|
+
# The library version as recorded in instrumentation and logging
|
405
|
+
# @return [::String]
|
406
|
+
# @!attribute [rw] timeout
|
407
|
+
# The call timeout in seconds.
|
408
|
+
# @return [::Numeric]
|
409
|
+
# @!attribute [rw] metadata
|
410
|
+
# Additional 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
|
+
# @!attribute [rw] universe_domain
|
424
|
+
# The universe domain within which to make requests. This determines the
|
425
|
+
# default endpoint URL. The default value of nil uses the environment
|
426
|
+
# universe (usually the default "googleapis.com" universe).
|
427
|
+
# @return [::String,nil]
|
428
|
+
#
|
429
|
+
class Configuration
|
430
|
+
extend ::Gapic::Config
|
431
|
+
|
432
|
+
# @private
|
433
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
434
|
+
DEFAULT_ENDPOINT = "cloudcontrolspartner.googleapis.com"
|
435
|
+
|
436
|
+
config_attr :endpoint, nil, ::String, nil
|
437
|
+
config_attr :credentials, nil do |value|
|
438
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
439
|
+
allowed.any? { |klass| klass === value }
|
440
|
+
end
|
441
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
442
|
+
config_attr :lib_name, nil, ::String, nil
|
443
|
+
config_attr :lib_version, nil, ::String, nil
|
444
|
+
config_attr :timeout, nil, ::Numeric, nil
|
445
|
+
config_attr :metadata, nil, ::Hash, nil
|
446
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
447
|
+
config_attr :quota_project, nil, ::String, nil
|
448
|
+
config_attr :universe_domain, nil, ::String, nil
|
449
|
+
|
450
|
+
# @private
|
451
|
+
def initialize parent_config = nil
|
452
|
+
@parent_config = parent_config unless parent_config.nil?
|
453
|
+
|
454
|
+
yield self if block_given?
|
455
|
+
end
|
456
|
+
|
457
|
+
##
|
458
|
+
# Configurations for individual RPCs
|
459
|
+
# @return [Rpcs]
|
460
|
+
#
|
461
|
+
def rpcs
|
462
|
+
@rpcs ||= begin
|
463
|
+
parent_rpcs = nil
|
464
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
465
|
+
Rpcs.new parent_rpcs
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
##
|
470
|
+
# Configuration RPC class for the CloudControlsPartnerMonitoring API.
|
471
|
+
#
|
472
|
+
# Includes fields providing the configuration for each RPC in this service.
|
473
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
474
|
+
# the following configuration fields:
|
475
|
+
#
|
476
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
477
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
478
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
479
|
+
# include the following keys:
|
480
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
481
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
482
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
483
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
484
|
+
# trigger a retry.
|
485
|
+
#
|
486
|
+
class Rpcs
|
487
|
+
##
|
488
|
+
# RPC-specific configuration for `list_violations`
|
489
|
+
# @return [::Gapic::Config::Method]
|
490
|
+
#
|
491
|
+
attr_reader :list_violations
|
492
|
+
##
|
493
|
+
# RPC-specific configuration for `get_violation`
|
494
|
+
# @return [::Gapic::Config::Method]
|
495
|
+
#
|
496
|
+
attr_reader :get_violation
|
497
|
+
|
498
|
+
# @private
|
499
|
+
def initialize parent_rpcs = nil
|
500
|
+
list_violations_config = parent_rpcs.list_violations if parent_rpcs.respond_to? :list_violations
|
501
|
+
@list_violations = ::Gapic::Config::Method.new list_violations_config
|
502
|
+
get_violation_config = parent_rpcs.get_violation if parent_rpcs.respond_to? :get_violation
|
503
|
+
@get_violation = ::Gapic::Config::Method.new get_violation_config
|
504
|
+
|
505
|
+
yield self if block_given?
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
end
|
510
|
+
end
|
511
|
+
end
|
512
|
+
end
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|