google-cloud-cloud_controls_partner-v1beta 0.2.0 → 0.4.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/README.md +31 -21
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/client.rb +325 -9
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/rest/client.rb +301 -9
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/rest/service_stub.rb +262 -49
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/client.rb +35 -3
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/rest/client.rb +34 -3
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/rest/service_stub.rb +30 -14
- data/lib/google/cloud/cloud_controls_partner/v1beta/version.rb +1 -1
- data/lib/google/cloud/cloudcontrolspartner/v1beta/core_pb.rb +2 -1
- data/lib/google/cloud/cloudcontrolspartner/v1beta/core_services_pb.rb +6 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/customers_pb.rb +6 -1
- data/lib/google/cloud/cloudcontrolspartner/v1beta/partners_pb.rb +1 -1
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/core.rb +1 -1
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/customers.rb +46 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/partners.rb +1 -1
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- metadata +8 -9
data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/rest/service_stub.rb
CHANGED
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the get_workload REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "get_workload",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::Workload.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "list_workloads",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::ListWorkloadsResponse.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,16 +179,18 @@ module Google
|
|
163
179
|
|
164
180
|
response = @client_stub.make_http_request(
|
165
181
|
verb,
|
166
|
-
uri:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "get_customer",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::Customer.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -201,16 +219,18 @@ module Google
|
|
201
219
|
|
202
220
|
response = @client_stub.make_http_request(
|
203
221
|
verb,
|
204
|
-
uri:
|
205
|
-
body:
|
206
|
-
params:
|
222
|
+
uri: uri,
|
223
|
+
body: body || "",
|
224
|
+
params: query_string_params,
|
225
|
+
method_name: "list_customers",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::ListCustomersResponse.decode_json response.body, ignore_unknown_fields: true
|
211
|
-
|
212
|
-
|
213
|
-
|
230
|
+
catch :response do
|
231
|
+
yield result, operation if block_given?
|
232
|
+
result
|
233
|
+
end
|
214
234
|
end
|
215
235
|
|
216
236
|
##
|
@@ -239,16 +259,18 @@ module Google
|
|
239
259
|
|
240
260
|
response = @client_stub.make_http_request(
|
241
261
|
verb,
|
242
|
-
uri:
|
243
|
-
body:
|
244
|
-
params:
|
262
|
+
uri: uri,
|
263
|
+
body: body || "",
|
264
|
+
params: query_string_params,
|
265
|
+
method_name: "get_ekm_connections",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::EkmConnections.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
251
|
-
|
270
|
+
catch :response do
|
271
|
+
yield result, operation if block_given?
|
272
|
+
result
|
273
|
+
end
|
252
274
|
end
|
253
275
|
|
254
276
|
##
|
@@ -277,16 +299,18 @@ module Google
|
|
277
299
|
|
278
300
|
response = @client_stub.make_http_request(
|
279
301
|
verb,
|
280
|
-
uri:
|
281
|
-
body:
|
282
|
-
params:
|
302
|
+
uri: uri,
|
303
|
+
body: body || "",
|
304
|
+
params: query_string_params,
|
305
|
+
method_name: "get_partner_permissions",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::PartnerPermissions.decode_json response.body, ignore_unknown_fields: true
|
287
|
-
|
288
|
-
|
289
|
-
|
310
|
+
catch :response do
|
311
|
+
yield result, operation if block_given?
|
312
|
+
result
|
313
|
+
end
|
290
314
|
end
|
291
315
|
|
292
316
|
##
|
@@ -315,16 +339,18 @@ module Google
|
|
315
339
|
|
316
340
|
response = @client_stub.make_http_request(
|
317
341
|
verb,
|
318
|
-
uri:
|
319
|
-
body:
|
320
|
-
params:
|
342
|
+
uri: uri,
|
343
|
+
body: body || "",
|
344
|
+
params: query_string_params,
|
345
|
+
method_name: "list_access_approval_requests",
|
321
346
|
options: options
|
322
347
|
)
|
323
348
|
operation = ::Gapic::Rest::TransportOperation.new response
|
324
349
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::ListAccessApprovalRequestsResponse.decode_json response.body, ignore_unknown_fields: true
|
325
|
-
|
326
|
-
|
327
|
-
|
350
|
+
catch :response do
|
351
|
+
yield result, operation if block_given?
|
352
|
+
result
|
353
|
+
end
|
328
354
|
end
|
329
355
|
|
330
356
|
##
|
@@ -353,16 +379,138 @@ module Google
|
|
353
379
|
|
354
380
|
response = @client_stub.make_http_request(
|
355
381
|
verb,
|
356
|
-
uri:
|
357
|
-
body:
|
358
|
-
params:
|
382
|
+
uri: uri,
|
383
|
+
body: body || "",
|
384
|
+
params: query_string_params,
|
385
|
+
method_name: "get_partner",
|
359
386
|
options: options
|
360
387
|
)
|
361
388
|
operation = ::Gapic::Rest::TransportOperation.new response
|
362
389
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::Partner.decode_json response.body, ignore_unknown_fields: true
|
390
|
+
catch :response do
|
391
|
+
yield result, operation if block_given?
|
392
|
+
result
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
##
|
397
|
+
# Baseline implementation for the create_customer REST call
|
398
|
+
#
|
399
|
+
# @param request_pb [::Google::Cloud::CloudControlsPartner::V1beta::CreateCustomerRequest]
|
400
|
+
# A request object representing the call parameters. Required.
|
401
|
+
# @param options [::Gapic::CallOptions]
|
402
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
403
|
+
#
|
404
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
405
|
+
# @yieldparam result [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
|
406
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
407
|
+
#
|
408
|
+
# @return [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
|
409
|
+
# A result object deserialized from the server's reply
|
410
|
+
def create_customer request_pb, options = nil
|
411
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
412
|
+
|
413
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_create_customer_request request_pb
|
414
|
+
query_string_params = if query_string_params.any?
|
415
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
416
|
+
else
|
417
|
+
{}
|
418
|
+
end
|
419
|
+
|
420
|
+
response = @client_stub.make_http_request(
|
421
|
+
verb,
|
422
|
+
uri: uri,
|
423
|
+
body: body || "",
|
424
|
+
params: query_string_params,
|
425
|
+
method_name: "create_customer",
|
426
|
+
options: options
|
427
|
+
)
|
428
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
429
|
+
result = ::Google::Cloud::CloudControlsPartner::V1beta::Customer.decode_json response.body, ignore_unknown_fields: true
|
430
|
+
catch :response do
|
431
|
+
yield result, operation if block_given?
|
432
|
+
result
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
##
|
437
|
+
# Baseline implementation for the update_customer REST call
|
438
|
+
#
|
439
|
+
# @param request_pb [::Google::Cloud::CloudControlsPartner::V1beta::UpdateCustomerRequest]
|
440
|
+
# A request object representing the call parameters. Required.
|
441
|
+
# @param options [::Gapic::CallOptions]
|
442
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
443
|
+
#
|
444
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
445
|
+
# @yieldparam result [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
|
446
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
447
|
+
#
|
448
|
+
# @return [::Google::Cloud::CloudControlsPartner::V1beta::Customer]
|
449
|
+
# A result object deserialized from the server's reply
|
450
|
+
def update_customer request_pb, options = nil
|
451
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
452
|
+
|
453
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_update_customer_request request_pb
|
454
|
+
query_string_params = if query_string_params.any?
|
455
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
456
|
+
else
|
457
|
+
{}
|
458
|
+
end
|
459
|
+
|
460
|
+
response = @client_stub.make_http_request(
|
461
|
+
verb,
|
462
|
+
uri: uri,
|
463
|
+
body: body || "",
|
464
|
+
params: query_string_params,
|
465
|
+
method_name: "update_customer",
|
466
|
+
options: options
|
467
|
+
)
|
468
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
469
|
+
result = ::Google::Cloud::CloudControlsPartner::V1beta::Customer.decode_json response.body, ignore_unknown_fields: true
|
470
|
+
catch :response do
|
471
|
+
yield result, operation if block_given?
|
472
|
+
result
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
##
|
477
|
+
# Baseline implementation for the delete_customer REST call
|
478
|
+
#
|
479
|
+
# @param request_pb [::Google::Cloud::CloudControlsPartner::V1beta::DeleteCustomerRequest]
|
480
|
+
# A request object representing the call parameters. Required.
|
481
|
+
# @param options [::Gapic::CallOptions]
|
482
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
483
|
+
#
|
484
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
485
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
486
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
487
|
+
#
|
488
|
+
# @return [::Google::Protobuf::Empty]
|
489
|
+
# A result object deserialized from the server's reply
|
490
|
+
def delete_customer request_pb, options = nil
|
491
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
363
492
|
|
364
|
-
|
365
|
-
|
493
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_delete_customer_request request_pb
|
494
|
+
query_string_params = if query_string_params.any?
|
495
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
496
|
+
else
|
497
|
+
{}
|
498
|
+
end
|
499
|
+
|
500
|
+
response = @client_stub.make_http_request(
|
501
|
+
verb,
|
502
|
+
uri: uri,
|
503
|
+
body: body || "",
|
504
|
+
params: query_string_params,
|
505
|
+
method_name: "delete_customer",
|
506
|
+
options: options
|
507
|
+
)
|
508
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
509
|
+
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
510
|
+
catch :response do
|
511
|
+
yield result, operation if block_given?
|
512
|
+
result
|
513
|
+
end
|
366
514
|
end
|
367
515
|
|
368
516
|
##
|
@@ -532,6 +680,71 @@ module Google
|
|
532
680
|
)
|
533
681
|
transcoder.transcode request_pb
|
534
682
|
end
|
683
|
+
|
684
|
+
##
|
685
|
+
# @private
|
686
|
+
#
|
687
|
+
# GRPC transcoding helper method for the create_customer REST call
|
688
|
+
#
|
689
|
+
# @param request_pb [::Google::Cloud::CloudControlsPartner::V1beta::CreateCustomerRequest]
|
690
|
+
# A request object representing the call parameters. Required.
|
691
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
692
|
+
# Uri, Body, Query string parameters
|
693
|
+
def self.transcode_create_customer_request request_pb
|
694
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
695
|
+
.with_bindings(
|
696
|
+
uri_method: :post,
|
697
|
+
uri_template: "/v1beta/{parent}/customers",
|
698
|
+
body: "customer",
|
699
|
+
matches: [
|
700
|
+
["parent", %r{^organizations/[^/]+/locations/[^/]+/?$}, false]
|
701
|
+
]
|
702
|
+
)
|
703
|
+
transcoder.transcode request_pb
|
704
|
+
end
|
705
|
+
|
706
|
+
##
|
707
|
+
# @private
|
708
|
+
#
|
709
|
+
# GRPC transcoding helper method for the update_customer REST call
|
710
|
+
#
|
711
|
+
# @param request_pb [::Google::Cloud::CloudControlsPartner::V1beta::UpdateCustomerRequest]
|
712
|
+
# A request object representing the call parameters. Required.
|
713
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
714
|
+
# Uri, Body, Query string parameters
|
715
|
+
def self.transcode_update_customer_request request_pb
|
716
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
717
|
+
.with_bindings(
|
718
|
+
uri_method: :patch,
|
719
|
+
uri_template: "/v1beta/{customer.name}",
|
720
|
+
body: "customer",
|
721
|
+
matches: [
|
722
|
+
["customer.name", %r{^organizations/[^/]+/locations/[^/]+/customers/[^/]+/?$}, false]
|
723
|
+
]
|
724
|
+
)
|
725
|
+
transcoder.transcode request_pb
|
726
|
+
end
|
727
|
+
|
728
|
+
##
|
729
|
+
# @private
|
730
|
+
#
|
731
|
+
# GRPC transcoding helper method for the delete_customer REST call
|
732
|
+
#
|
733
|
+
# @param request_pb [::Google::Cloud::CloudControlsPartner::V1beta::DeleteCustomerRequest]
|
734
|
+
# A request object representing the call parameters. Required.
|
735
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
736
|
+
# Uri, Body, Query string parameters
|
737
|
+
def self.transcode_delete_customer_request request_pb
|
738
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
739
|
+
.with_bindings(
|
740
|
+
uri_method: :delete,
|
741
|
+
uri_template: "/v1beta/{name}",
|
742
|
+
matches: [
|
743
|
+
["name", %r{^organizations/[^/]+/locations/[^/]+/customers/[^/]+/?$}, false]
|
744
|
+
]
|
745
|
+
)
|
746
|
+
transcoder.transcode request_pb
|
747
|
+
end
|
535
748
|
end
|
536
749
|
end
|
537
750
|
end
|
data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/client.rb
CHANGED
@@ -167,8 +167,28 @@ module Google
|
|
167
167
|
universe_domain: @config.universe_domain,
|
168
168
|
channel_args: @config.channel_args,
|
169
169
|
interceptors: @config.interceptors,
|
170
|
-
channel_pool_config: @config.channel_pool
|
170
|
+
channel_pool_config: @config.channel_pool,
|
171
|
+
logger: @config.logger
|
171
172
|
)
|
173
|
+
|
174
|
+
@cloud_controls_partner_monitoring_stub.stub_logger&.info do |entry|
|
175
|
+
entry.set_system_name
|
176
|
+
entry.set_service
|
177
|
+
entry.message = "Created client for #{entry.service}"
|
178
|
+
entry.set_credentials_fields credentials
|
179
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
180
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
181
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# The logger used for request/response debug logging.
|
187
|
+
#
|
188
|
+
# @return [Logger]
|
189
|
+
#
|
190
|
+
def logger
|
191
|
+
@cloud_controls_partner_monitoring_stub.logger
|
172
192
|
end
|
173
193
|
|
174
194
|
# Service calls
|
@@ -280,7 +300,7 @@ module Google
|
|
280
300
|
@cloud_controls_partner_monitoring_stub.call_rpc :list_violations, request, options: options do |response, operation|
|
281
301
|
response = ::Gapic::PagedEnumerable.new @cloud_controls_partner_monitoring_stub, :list_violations, request, response, operation, options
|
282
302
|
yield response, operation if block_given?
|
283
|
-
|
303
|
+
throw :response, response
|
284
304
|
end
|
285
305
|
rescue ::GRPC::BadStatus => e
|
286
306
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -367,7 +387,6 @@ module Google
|
|
367
387
|
|
368
388
|
@cloud_controls_partner_monitoring_stub.call_rpc :get_violation, request, options: options do |response, operation|
|
369
389
|
yield response, operation if block_given?
|
370
|
-
return response
|
371
390
|
end
|
372
391
|
rescue ::GRPC::BadStatus => e
|
373
392
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -417,6 +436,13 @@ module Google
|
|
417
436
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
418
437
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
419
438
|
# * (`nil`) indicating no credentials
|
439
|
+
#
|
440
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
441
|
+
# external source for authentication to Google Cloud, you must validate it before
|
442
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
443
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
444
|
+
# For more information, refer to [Validate credential configurations from external
|
445
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
420
446
|
# @return [::Object]
|
421
447
|
# @!attribute [rw] scope
|
422
448
|
# The OAuth scopes
|
@@ -456,6 +482,11 @@ module Google
|
|
456
482
|
# default endpoint URL. The default value of nil uses the environment
|
457
483
|
# universe (usually the default "googleapis.com" universe).
|
458
484
|
# @return [::String,nil]
|
485
|
+
# @!attribute [rw] logger
|
486
|
+
# A custom logger to use for request/response debug logging, or the value
|
487
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
488
|
+
# explicitly disable logging.
|
489
|
+
# @return [::Logger,:default,nil]
|
459
490
|
#
|
460
491
|
class Configuration
|
461
492
|
extend ::Gapic::Config
|
@@ -480,6 +511,7 @@ module Google
|
|
480
511
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
481
512
|
config_attr :quota_project, nil, ::String, nil
|
482
513
|
config_attr :universe_domain, nil, ::String, nil
|
514
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
483
515
|
|
484
516
|
# @private
|
485
517
|
def initialize parent_config = nil
|
data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/rest/client.rb
CHANGED
@@ -160,8 +160,28 @@ module Google
|
|
160
160
|
endpoint: @config.endpoint,
|
161
161
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
162
162
|
universe_domain: @config.universe_domain,
|
163
|
-
credentials: credentials
|
163
|
+
credentials: credentials,
|
164
|
+
logger: @config.logger
|
164
165
|
)
|
166
|
+
|
167
|
+
@cloud_controls_partner_monitoring_stub.logger(stub: true)&.info do |entry|
|
168
|
+
entry.set_system_name
|
169
|
+
entry.set_service
|
170
|
+
entry.message = "Created client for #{entry.service}"
|
171
|
+
entry.set_credentials_fields credentials
|
172
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
173
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
174
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# The logger used for request/response debug logging.
|
180
|
+
#
|
181
|
+
# @return [Logger]
|
182
|
+
#
|
183
|
+
def logger
|
184
|
+
@cloud_controls_partner_monitoring_stub.logger
|
165
185
|
end
|
166
186
|
|
167
187
|
# Service calls
|
@@ -265,7 +285,6 @@ module Google
|
|
265
285
|
|
266
286
|
@cloud_controls_partner_monitoring_stub.list_violations request, options do |result, operation|
|
267
287
|
yield result, operation if block_given?
|
268
|
-
return result
|
269
288
|
end
|
270
289
|
rescue ::Gapic::Rest::Error => e
|
271
290
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -345,7 +364,6 @@ module Google
|
|
345
364
|
|
346
365
|
@cloud_controls_partner_monitoring_stub.get_violation request, options do |result, operation|
|
347
366
|
yield result, operation if block_given?
|
348
|
-
return result
|
349
367
|
end
|
350
368
|
rescue ::Gapic::Rest::Error => e
|
351
369
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -393,6 +411,13 @@ module Google
|
|
393
411
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
394
412
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
395
413
|
# * (`nil`) indicating no credentials
|
414
|
+
#
|
415
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
416
|
+
# external source for authentication to Google Cloud, you must validate it before
|
417
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
418
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
419
|
+
# For more information, refer to [Validate credential configurations from external
|
420
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
396
421
|
# @return [::Object]
|
397
422
|
# @!attribute [rw] scope
|
398
423
|
# The OAuth scopes
|
@@ -425,6 +450,11 @@ module Google
|
|
425
450
|
# default endpoint URL. The default value of nil uses the environment
|
426
451
|
# universe (usually the default "googleapis.com" universe).
|
427
452
|
# @return [::String,nil]
|
453
|
+
# @!attribute [rw] logger
|
454
|
+
# A custom logger to use for request/response debug logging, or the value
|
455
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
456
|
+
# explicitly disable logging.
|
457
|
+
# @return [::Logger,:default,nil]
|
428
458
|
#
|
429
459
|
class Configuration
|
430
460
|
extend ::Gapic::Config
|
@@ -446,6 +476,7 @@ module Google
|
|
446
476
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
447
477
|
config_attr :quota_project, nil, ::String, nil
|
448
478
|
config_attr :universe_domain, nil, ::String, nil
|
479
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
449
480
|
|
450
481
|
# @private
|
451
482
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the list_violations REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "list_violations",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::ListViolationsResponse.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "get_violation",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::CloudControlsPartner::V1beta::Violation.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|