google-cloud-app_engine-v1 1.0.1 → 1.2.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/cloud/app_engine/v1/applications/client.rb +37 -5
  4. data/lib/google/cloud/app_engine/v1/applications/operations.rb +19 -15
  5. data/lib/google/cloud/app_engine/v1/applications/rest/client.rb +37 -5
  6. data/lib/google/cloud/app_engine/v1/applications/rest/operations.rb +50 -38
  7. data/lib/google/cloud/app_engine/v1/applications/rest/service_stub.rb +46 -26
  8. data/lib/google/cloud/app_engine/v1/authorized_certificates/client.rb +35 -6
  9. data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/client.rb +35 -6
  10. data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/service_stub.rb +54 -32
  11. data/lib/google/cloud/app_engine/v1/authorized_domains/client.rb +35 -2
  12. data/lib/google/cloud/app_engine/v1/authorized_domains/rest/client.rb +35 -2
  13. data/lib/google/cloud/app_engine/v1/authorized_domains/rest/service_stub.rb +22 -8
  14. data/lib/google/cloud/app_engine/v1/domain_mappings/client.rb +38 -6
  15. data/lib/google/cloud/app_engine/v1/domain_mappings/operations.rb +19 -15
  16. data/lib/google/cloud/app_engine/v1/domain_mappings/rest/client.rb +38 -6
  17. data/lib/google/cloud/app_engine/v1/domain_mappings/rest/operations.rb +50 -38
  18. data/lib/google/cloud/app_engine/v1/domain_mappings/rest/service_stub.rb +54 -32
  19. data/lib/google/cloud/app_engine/v1/firewall/client.rb +35 -7
  20. data/lib/google/cloud/app_engine/v1/firewall/rest/client.rb +35 -7
  21. data/lib/google/cloud/app_engine/v1/firewall/rest/service_stub.rb +62 -38
  22. data/lib/google/cloud/app_engine/v1/instances/client.rb +37 -5
  23. data/lib/google/cloud/app_engine/v1/instances/operations.rb +19 -15
  24. data/lib/google/cloud/app_engine/v1/instances/rest/client.rb +37 -5
  25. data/lib/google/cloud/app_engine/v1/instances/rest/operations.rb +50 -38
  26. data/lib/google/cloud/app_engine/v1/instances/rest/service_stub.rb +46 -26
  27. data/lib/google/cloud/app_engine/v1/services/client.rb +37 -5
  28. data/lib/google/cloud/app_engine/v1/services/operations.rb +19 -15
  29. data/lib/google/cloud/app_engine/v1/services/rest/client.rb +37 -5
  30. data/lib/google/cloud/app_engine/v1/services/rest/operations.rb +50 -38
  31. data/lib/google/cloud/app_engine/v1/services/rest/service_stub.rb +46 -26
  32. data/lib/google/cloud/app_engine/v1/version.rb +1 -1
  33. data/lib/google/cloud/app_engine/v1/versions/client.rb +38 -6
  34. data/lib/google/cloud/app_engine/v1/versions/operations.rb +19 -15
  35. data/lib/google/cloud/app_engine/v1/versions/rest/client.rb +38 -6
  36. data/lib/google/cloud/app_engine/v1/versions/rest/operations.rb +50 -38
  37. data/lib/google/cloud/app_engine/v1/versions/rest/service_stub.rb +54 -32
  38. data/proto_docs/google/api/client.rb +39 -0
  39. data/proto_docs/google/appengine/v1/app_yaml.rb +6 -0
  40. data/proto_docs/google/appengine/v1/audit_data.rb +4 -0
  41. data/proto_docs/google/appengine/v1/version.rb +6 -0
  42. data/proto_docs/google/longrunning/operations.rb +23 -14
  43. metadata +6 -9
@@ -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
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
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
- raise_faraday_errors: false
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_application 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: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "get_application",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::AppEngine::V1::Application.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
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: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "create_application",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
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: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "update_application",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
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: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "repair_application",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -156,8 +156,28 @@ module Google
156
156
  universe_domain: @config.universe_domain,
157
157
  channel_args: @config.channel_args,
158
158
  interceptors: @config.interceptors,
159
- channel_pool_config: @config.channel_pool
159
+ channel_pool_config: @config.channel_pool,
160
+ logger: @config.logger
160
161
  )
162
+
163
+ @authorized_certificates_stub.stub_logger&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+ end
173
+
174
+ ##
175
+ # The logger used for request/response debug logging.
176
+ #
177
+ # @return [Logger]
178
+ #
179
+ def logger
180
+ @authorized_certificates_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -253,7 +273,7 @@ module Google
253
273
  @authorized_certificates_stub.call_rpc :list_authorized_certificates, request, options: options do |response, operation|
254
274
  response = ::Gapic::PagedEnumerable.new @authorized_certificates_stub, :list_authorized_certificates, request, response, operation, options
255
275
  yield response, operation if block_given?
256
- return response
276
+ throw :response, response
257
277
  end
258
278
  rescue ::GRPC::BadStatus => e
259
279
  raise ::Google::Cloud::Error.from_error(e)
@@ -342,7 +362,6 @@ module Google
342
362
 
343
363
  @authorized_certificates_stub.call_rpc :get_authorized_certificate, request, options: options do |response, operation|
344
364
  yield response, operation if block_given?
345
- return response
346
365
  end
347
366
  rescue ::GRPC::BadStatus => e
348
367
  raise ::Google::Cloud::Error.from_error(e)
@@ -430,7 +449,6 @@ module Google
430
449
 
431
450
  @authorized_certificates_stub.call_rpc :create_authorized_certificate, request, options: options do |response, operation|
432
451
  yield response, operation if block_given?
433
- return response
434
452
  end
435
453
  rescue ::GRPC::BadStatus => e
436
454
  raise ::Google::Cloud::Error.from_error(e)
@@ -527,7 +545,6 @@ module Google
527
545
 
528
546
  @authorized_certificates_stub.call_rpc :update_authorized_certificate, request, options: options do |response, operation|
529
547
  yield response, operation if block_given?
530
- return response
531
548
  end
532
549
  rescue ::GRPC::BadStatus => e
533
550
  raise ::Google::Cloud::Error.from_error(e)
@@ -614,7 +631,6 @@ module Google
614
631
 
615
632
  @authorized_certificates_stub.call_rpc :delete_authorized_certificate, request, options: options do |response, operation|
616
633
  yield response, operation if block_given?
617
- return response
618
634
  end
619
635
  rescue ::GRPC::BadStatus => e
620
636
  raise ::Google::Cloud::Error.from_error(e)
@@ -664,6 +680,13 @@ module Google
664
680
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
665
681
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
666
682
  # * (`nil`) indicating no credentials
683
+ #
684
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
685
+ # external source for authentication to Google Cloud, you must validate it before
686
+ # providing it to a Google API client library. Providing an unvalidated credential
687
+ # configuration to Google APIs can compromise the security of your systems and data.
688
+ # For more information, refer to [Validate credential configurations from external
689
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
667
690
  # @return [::Object]
668
691
  # @!attribute [rw] scope
669
692
  # The OAuth scopes
@@ -703,6 +726,11 @@ module Google
703
726
  # default endpoint URL. The default value of nil uses the environment
704
727
  # universe (usually the default "googleapis.com" universe).
705
728
  # @return [::String,nil]
729
+ # @!attribute [rw] logger
730
+ # A custom logger to use for request/response debug logging, or the value
731
+ # `:default` (the default) to construct a default logger, or `nil` to
732
+ # explicitly disable logging.
733
+ # @return [::Logger,:default,nil]
706
734
  #
707
735
  class Configuration
708
736
  extend ::Gapic::Config
@@ -727,6 +755,7 @@ module Google
727
755
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
728
756
  config_attr :quota_project, nil, ::String, nil
729
757
  config_attr :universe_domain, nil, ::String, nil
758
+ config_attr :logger, :default, ::Logger, nil, :default
730
759
 
731
760
  # @private
732
761
  def initialize parent_config = nil
@@ -149,8 +149,28 @@ module Google
149
149
  endpoint: @config.endpoint,
150
150
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
151
151
  universe_domain: @config.universe_domain,
152
- credentials: credentials
152
+ credentials: credentials,
153
+ logger: @config.logger
153
154
  )
155
+
156
+ @authorized_certificates_stub.logger(stub: true)&.info do |entry|
157
+ entry.set_system_name
158
+ entry.set_service
159
+ entry.message = "Created client for #{entry.service}"
160
+ entry.set_credentials_fields credentials
161
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
162
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
163
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
164
+ end
165
+ end
166
+
167
+ ##
168
+ # The logger used for request/response debug logging.
169
+ #
170
+ # @return [Logger]
171
+ #
172
+ def logger
173
+ @authorized_certificates_stub.logger
154
174
  end
155
175
 
156
176
  # Service calls
@@ -239,7 +259,7 @@ module Google
239
259
  @authorized_certificates_stub.list_authorized_certificates request, options do |result, operation|
240
260
  result = ::Gapic::Rest::PagedEnumerable.new @authorized_certificates_stub, :list_authorized_certificates, "certificates", request, result, options
241
261
  yield result, operation if block_given?
242
- return result
262
+ throw :response, result
243
263
  end
244
264
  rescue ::Gapic::Rest::Error => e
245
265
  raise ::Google::Cloud::Error.from_error(e)
@@ -321,7 +341,6 @@ module Google
321
341
 
322
342
  @authorized_certificates_stub.get_authorized_certificate request, options do |result, operation|
323
343
  yield result, operation if block_given?
324
- return result
325
344
  end
326
345
  rescue ::Gapic::Rest::Error => e
327
346
  raise ::Google::Cloud::Error.from_error(e)
@@ -402,7 +421,6 @@ module Google
402
421
 
403
422
  @authorized_certificates_stub.create_authorized_certificate request, options do |result, operation|
404
423
  yield result, operation if block_given?
405
- return result
406
424
  end
407
425
  rescue ::Gapic::Rest::Error => e
408
426
  raise ::Google::Cloud::Error.from_error(e)
@@ -492,7 +510,6 @@ module Google
492
510
 
493
511
  @authorized_certificates_stub.update_authorized_certificate request, options do |result, operation|
494
512
  yield result, operation if block_given?
495
- return result
496
513
  end
497
514
  rescue ::Gapic::Rest::Error => e
498
515
  raise ::Google::Cloud::Error.from_error(e)
@@ -572,7 +589,6 @@ module Google
572
589
 
573
590
  @authorized_certificates_stub.delete_authorized_certificate request, options do |result, operation|
574
591
  yield result, operation if block_given?
575
- return result
576
592
  end
577
593
  rescue ::Gapic::Rest::Error => e
578
594
  raise ::Google::Cloud::Error.from_error(e)
@@ -620,6 +636,13 @@ module Google
620
636
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
621
637
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
622
638
  # * (`nil`) indicating no credentials
639
+ #
640
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
641
+ # external source for authentication to Google Cloud, you must validate it before
642
+ # providing it to a Google API client library. Providing an unvalidated credential
643
+ # configuration to Google APIs can compromise the security of your systems and data.
644
+ # For more information, refer to [Validate credential configurations from external
645
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
623
646
  # @return [::Object]
624
647
  # @!attribute [rw] scope
625
648
  # The OAuth scopes
@@ -652,6 +675,11 @@ module Google
652
675
  # default endpoint URL. The default value of nil uses the environment
653
676
  # universe (usually the default "googleapis.com" universe).
654
677
  # @return [::String,nil]
678
+ # @!attribute [rw] logger
679
+ # A custom logger to use for request/response debug logging, or the value
680
+ # `:default` (the default) to construct a default logger, or `nil` to
681
+ # explicitly disable logging.
682
+ # @return [::Logger,:default,nil]
655
683
  #
656
684
  class Configuration
657
685
  extend ::Gapic::Config
@@ -673,6 +701,7 @@ module Google
673
701
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
674
702
  config_attr :quota_project, nil, ::String, nil
675
703
  config_attr :universe_domain, nil, ::String, nil
704
+ config_attr :logger, :default, ::Logger, nil, :default
676
705
 
677
706
  # @private
678
707
  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
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
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
- raise_faraday_errors: false
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_authorized_certificates 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: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "list_authorized_certificates",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::AppEngine::V1::ListAuthorizedCertificatesResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
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: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "get_authorized_certificate",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::AppEngine::V1::AuthorizedCertificate.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
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: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "create_authorized_certificate",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::AppEngine::V1::AuthorizedCertificate.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
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: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "update_authorized_certificate",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::AppEngine::V1::AuthorizedCertificate.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
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: uri,
243
- body: body || "",
244
- params: query_string_params,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "delete_authorized_certificate",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
249
-
250
- yield result, operation if block_given?
251
- result
270
+ catch :response do
271
+ yield result, operation if block_given?
272
+ result
273
+ end
252
274
  end
253
275
 
254
276
  ##
@@ -157,8 +157,28 @@ module Google
157
157
  universe_domain: @config.universe_domain,
158
158
  channel_args: @config.channel_args,
159
159
  interceptors: @config.interceptors,
160
- channel_pool_config: @config.channel_pool
160
+ channel_pool_config: @config.channel_pool,
161
+ logger: @config.logger
161
162
  )
163
+
164
+ @authorized_domains_stub.stub_logger&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @authorized_domains_stub.logger
162
182
  end
163
183
 
164
184
  # Service calls
@@ -252,7 +272,7 @@ module Google
252
272
  @authorized_domains_stub.call_rpc :list_authorized_domains, request, options: options do |response, operation|
253
273
  response = ::Gapic::PagedEnumerable.new @authorized_domains_stub, :list_authorized_domains, request, response, operation, options
254
274
  yield response, operation if block_given?
255
- return response
275
+ throw :response, response
256
276
  end
257
277
  rescue ::GRPC::BadStatus => e
258
278
  raise ::Google::Cloud::Error.from_error(e)
@@ -302,6 +322,13 @@ module Google
302
322
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
303
323
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
304
324
  # * (`nil`) indicating no credentials
325
+ #
326
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
327
+ # external source for authentication to Google Cloud, you must validate it before
328
+ # providing it to a Google API client library. Providing an unvalidated credential
329
+ # configuration to Google APIs can compromise the security of your systems and data.
330
+ # For more information, refer to [Validate credential configurations from external
331
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
305
332
  # @return [::Object]
306
333
  # @!attribute [rw] scope
307
334
  # The OAuth scopes
@@ -341,6 +368,11 @@ module Google
341
368
  # default endpoint URL. The default value of nil uses the environment
342
369
  # universe (usually the default "googleapis.com" universe).
343
370
  # @return [::String,nil]
371
+ # @!attribute [rw] logger
372
+ # A custom logger to use for request/response debug logging, or the value
373
+ # `:default` (the default) to construct a default logger, or `nil` to
374
+ # explicitly disable logging.
375
+ # @return [::Logger,:default,nil]
344
376
  #
345
377
  class Configuration
346
378
  extend ::Gapic::Config
@@ -365,6 +397,7 @@ module Google
365
397
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
366
398
  config_attr :quota_project, nil, ::String, nil
367
399
  config_attr :universe_domain, nil, ::String, nil
400
+ config_attr :logger, :default, ::Logger, nil, :default
368
401
 
369
402
  # @private
370
403
  def initialize parent_config = nil
@@ -150,8 +150,28 @@ module Google
150
150
  endpoint: @config.endpoint,
151
151
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
152
152
  universe_domain: @config.universe_domain,
153
- credentials: credentials
153
+ credentials: credentials,
154
+ logger: @config.logger
154
155
  )
156
+
157
+ @authorized_domains_stub.logger(stub: true)&.info do |entry|
158
+ entry.set_system_name
159
+ entry.set_service
160
+ entry.message = "Created client for #{entry.service}"
161
+ entry.set_credentials_fields credentials
162
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
163
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
164
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
165
+ end
166
+ end
167
+
168
+ ##
169
+ # The logger used for request/response debug logging.
170
+ #
171
+ # @return [Logger]
172
+ #
173
+ def logger
174
+ @authorized_domains_stub.logger
155
175
  end
156
176
 
157
177
  # Service calls
@@ -238,7 +258,7 @@ module Google
238
258
  @authorized_domains_stub.list_authorized_domains request, options do |result, operation|
239
259
  result = ::Gapic::Rest::PagedEnumerable.new @authorized_domains_stub, :list_authorized_domains, "domains", request, result, options
240
260
  yield result, operation if block_given?
241
- return result
261
+ throw :response, result
242
262
  end
243
263
  rescue ::Gapic::Rest::Error => e
244
264
  raise ::Google::Cloud::Error.from_error(e)
@@ -286,6 +306,13 @@ module Google
286
306
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
287
307
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
288
308
  # * (`nil`) indicating no credentials
309
+ #
310
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
311
+ # external source for authentication to Google Cloud, you must validate it before
312
+ # providing it to a Google API client library. Providing an unvalidated credential
313
+ # configuration to Google APIs can compromise the security of your systems and data.
314
+ # For more information, refer to [Validate credential configurations from external
315
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
289
316
  # @return [::Object]
290
317
  # @!attribute [rw] scope
291
318
  # The OAuth scopes
@@ -318,6 +345,11 @@ module Google
318
345
  # default endpoint URL. The default value of nil uses the environment
319
346
  # universe (usually the default "googleapis.com" universe).
320
347
  # @return [::String,nil]
348
+ # @!attribute [rw] logger
349
+ # A custom logger to use for request/response debug logging, or the value
350
+ # `:default` (the default) to construct a default logger, or `nil` to
351
+ # explicitly disable logging.
352
+ # @return [::Logger,:default,nil]
321
353
  #
322
354
  class Configuration
323
355
  extend ::Gapic::Config
@@ -339,6 +371,7 @@ module Google
339
371
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
340
372
  config_attr :quota_project, nil, ::String, nil
341
373
  config_attr :universe_domain, nil, ::String, nil
374
+ config_attr :logger, :default, ::Logger, nil, :default
342
375
 
343
376
  # @private
344
377
  def initialize parent_config = nil