google-cloud-billing-v1 1.1.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 372912626d09ad704f8e342901c66ddcf07fd48e6791b97c5b42083d1a75ee33
4
- data.tar.gz: 1f65aaac121dc76313733e3d52982786584e736277cb60ed669b5213fd5f9b58
3
+ metadata.gz: 1d66cc5cd4177f18bd2d39afa9b59624d8f27d947abcd8ab185df98eebb020eb
4
+ data.tar.gz: 413f589a3928eb10aeae6f40b40d4cfeadad4d14687639f0b16bc9bfc99117f9
5
5
  SHA512:
6
- metadata.gz: 5e1dd947c75cb857cf6d6b44e6c1532d8da0e4baad5ce76e93b59abb96066f0bdfa672f512e4a0a074ce65b3abd1c6a1aa50d8f01058b5df24c60d854e7bbf56
7
- data.tar.gz: 3085b294a3c335ff31b6018f29c3af97bccf3c69cc2ca814359a88ed30e52c9d5bfd3187c3ec76775c7f43165439301d7691bed51be9dbf27733ef02e2fca9ad
6
+ metadata.gz: 513ac4b53fe1343e38267996116f203f9a294fe88dc51b744a013b23b4ee401ea70edd234a9dfbdc856ab21ba1cf0ca0a2a0a72bc0ee0866fb27996f62e539ec
7
+ data.tar.gz: c121811154c0785a2e1c938b132175b47a774803012ce46d5b1b77af7fe1f7ea69b112776387ea2e5b9065a88bf3fe21eb4c48efb0cd35462efde9748d80ea8b
data/README.md CHANGED
@@ -42,40 +42,50 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/billing)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/billing/v1"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::Billing::V1::CloudBilling::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
75
85
 
76
86
  ## Supported Ruby Versions
77
87
 
78
- This library is supported on Ruby 2.7+.
88
+ This library is supported on Ruby 3.0+.
79
89
 
80
90
  Google provides official support for Ruby versions that are actively supported
81
91
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -205,8 +205,28 @@ module Google
205
205
  universe_domain: @config.universe_domain,
206
206
  channel_args: @config.channel_args,
207
207
  interceptors: @config.interceptors,
208
- channel_pool_config: @config.channel_pool
208
+ channel_pool_config: @config.channel_pool,
209
+ logger: @config.logger
209
210
  )
211
+
212
+ @cloud_billing_stub.stub_logger&.info do |entry|
213
+ entry.set_system_name
214
+ entry.set_service
215
+ entry.message = "Created client for #{entry.service}"
216
+ entry.set_credentials_fields credentials
217
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
218
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
219
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
220
+ end
221
+ end
222
+
223
+ ##
224
+ # The logger used for request/response debug logging.
225
+ #
226
+ # @return [Logger]
227
+ #
228
+ def logger
229
+ @cloud_billing_stub.logger
210
230
  end
211
231
 
212
232
  # Service calls
@@ -294,7 +314,6 @@ module Google
294
314
 
295
315
  @cloud_billing_stub.call_rpc :get_billing_account, request, options: options do |response, operation|
296
316
  yield response, operation if block_given?
297
- return response
298
317
  end
299
318
  rescue ::GRPC::BadStatus => e
300
319
  raise ::Google::Cloud::Error.from_error(e)
@@ -399,7 +418,7 @@ module Google
399
418
  @cloud_billing_stub.call_rpc :list_billing_accounts, request, options: options do |response, operation|
400
419
  response = ::Gapic::PagedEnumerable.new @cloud_billing_stub, :list_billing_accounts, request, response, operation, options
401
420
  yield response, operation if block_given?
402
- return response
421
+ throw :response, response
403
422
  end
404
423
  rescue ::GRPC::BadStatus => e
405
424
  raise ::Google::Cloud::Error.from_error(e)
@@ -496,7 +515,6 @@ module Google
496
515
 
497
516
  @cloud_billing_stub.call_rpc :update_billing_account, request, options: options do |response, operation|
498
517
  yield response, operation if block_given?
499
- return response
500
518
  end
501
519
  rescue ::GRPC::BadStatus => e
502
520
  raise ::Google::Cloud::Error.from_error(e)
@@ -596,7 +614,6 @@ module Google
596
614
 
597
615
  @cloud_billing_stub.call_rpc :create_billing_account, request, options: options do |response, operation|
598
616
  yield response, operation if block_given?
599
- return response
600
617
  end
601
618
  rescue ::GRPC::BadStatus => e
602
619
  raise ::Google::Cloud::Error.from_error(e)
@@ -699,7 +716,7 @@ module Google
699
716
  @cloud_billing_stub.call_rpc :list_project_billing_info, request, options: options do |response, operation|
700
717
  response = ::Gapic::PagedEnumerable.new @cloud_billing_stub, :list_project_billing_info, request, response, operation, options
701
718
  yield response, operation if block_given?
702
- return response
719
+ throw :response, response
703
720
  end
704
721
  rescue ::GRPC::BadStatus => e
705
722
  raise ::Google::Cloud::Error.from_error(e)
@@ -790,7 +807,6 @@ module Google
790
807
 
791
808
  @cloud_billing_stub.call_rpc :get_project_billing_info, request, options: options do |response, operation|
792
809
  yield response, operation if block_given?
793
- return response
794
810
  end
795
811
  rescue ::GRPC::BadStatus => e
796
812
  raise ::Google::Cloud::Error.from_error(e)
@@ -913,7 +929,6 @@ module Google
913
929
 
914
930
  @cloud_billing_stub.call_rpc :update_project_billing_info, request, options: options do |response, operation|
915
931
  yield response, operation if block_given?
916
- return response
917
932
  end
918
933
  rescue ::GRPC::BadStatus => e
919
934
  raise ::Google::Cloud::Error.from_error(e)
@@ -1006,7 +1021,6 @@ module Google
1006
1021
 
1007
1022
  @cloud_billing_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
1008
1023
  yield response, operation if block_given?
1009
- return response
1010
1024
  end
1011
1025
  rescue ::GRPC::BadStatus => e
1012
1026
  raise ::Google::Cloud::Error.from_error(e)
@@ -1108,7 +1122,6 @@ module Google
1108
1122
 
1109
1123
  @cloud_billing_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
1110
1124
  yield response, operation if block_given?
1111
- return response
1112
1125
  end
1113
1126
  rescue ::GRPC::BadStatus => e
1114
1127
  raise ::Google::Cloud::Error.from_error(e)
@@ -1202,7 +1215,6 @@ module Google
1202
1215
 
1203
1216
  @cloud_billing_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
1204
1217
  yield response, operation if block_given?
1205
- return response
1206
1218
  end
1207
1219
  rescue ::GRPC::BadStatus => e
1208
1220
  raise ::Google::Cloud::Error.from_error(e)
@@ -1295,7 +1307,6 @@ module Google
1295
1307
 
1296
1308
  @cloud_billing_stub.call_rpc :move_billing_account, request, options: options do |response, operation|
1297
1309
  yield response, operation if block_given?
1298
- return response
1299
1310
  end
1300
1311
  rescue ::GRPC::BadStatus => e
1301
1312
  raise ::Google::Cloud::Error.from_error(e)
@@ -1345,6 +1356,13 @@ module Google
1345
1356
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1346
1357
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1347
1358
  # * (`nil`) indicating no credentials
1359
+ #
1360
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1361
+ # external source for authentication to Google Cloud, you must validate it before
1362
+ # providing it to a Google API client library. Providing an unvalidated credential
1363
+ # configuration to Google APIs can compromise the security of your systems and data.
1364
+ # For more information, refer to [Validate credential configurations from external
1365
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1348
1366
  # @return [::Object]
1349
1367
  # @!attribute [rw] scope
1350
1368
  # The OAuth scopes
@@ -1384,6 +1402,11 @@ module Google
1384
1402
  # default endpoint URL. The default value of nil uses the environment
1385
1403
  # universe (usually the default "googleapis.com" universe).
1386
1404
  # @return [::String,nil]
1405
+ # @!attribute [rw] logger
1406
+ # A custom logger to use for request/response debug logging, or the value
1407
+ # `:default` (the default) to construct a default logger, or `nil` to
1408
+ # explicitly disable logging.
1409
+ # @return [::Logger,:default,nil]
1387
1410
  #
1388
1411
  class Configuration
1389
1412
  extend ::Gapic::Config
@@ -1408,6 +1431,7 @@ module Google
1408
1431
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1409
1432
  config_attr :quota_project, nil, ::String, nil
1410
1433
  config_attr :universe_domain, nil, ::String, nil
1434
+ config_attr :logger, :default, ::Logger, nil, :default
1411
1435
 
1412
1436
  # @private
1413
1437
  def initialize parent_config = nil
@@ -198,8 +198,28 @@ module Google
198
198
  endpoint: @config.endpoint,
199
199
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
200
200
  universe_domain: @config.universe_domain,
201
- credentials: credentials
201
+ credentials: credentials,
202
+ logger: @config.logger
202
203
  )
204
+
205
+ @cloud_billing_stub.logger(stub: true)&.info do |entry|
206
+ entry.set_system_name
207
+ entry.set_service
208
+ entry.message = "Created client for #{entry.service}"
209
+ entry.set_credentials_fields credentials
210
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
211
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
212
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
213
+ end
214
+ end
215
+
216
+ ##
217
+ # The logger used for request/response debug logging.
218
+ #
219
+ # @return [Logger]
220
+ #
221
+ def logger
222
+ @cloud_billing_stub.logger
203
223
  end
204
224
 
205
225
  # Service calls
@@ -280,7 +300,6 @@ module Google
280
300
 
281
301
  @cloud_billing_stub.get_billing_account request, options do |result, operation|
282
302
  yield result, operation if block_given?
283
- return result
284
303
  end
285
304
  rescue ::Gapic::Rest::Error => e
286
305
  raise ::Google::Cloud::Error.from_error(e)
@@ -386,7 +405,7 @@ module Google
386
405
  @cloud_billing_stub.list_billing_accounts request, options do |result, operation|
387
406
  result = ::Gapic::Rest::PagedEnumerable.new @cloud_billing_stub, :list_billing_accounts, "billing_accounts", request, result, options
388
407
  yield result, operation if block_given?
389
- return result
408
+ throw :response, result
390
409
  end
391
410
  rescue ::Gapic::Rest::Error => e
392
411
  raise ::Google::Cloud::Error.from_error(e)
@@ -476,7 +495,6 @@ module Google
476
495
 
477
496
  @cloud_billing_stub.update_billing_account request, options do |result, operation|
478
497
  yield result, operation if block_given?
479
- return result
480
498
  end
481
499
  rescue ::Gapic::Rest::Error => e
482
500
  raise ::Google::Cloud::Error.from_error(e)
@@ -577,7 +595,6 @@ module Google
577
595
 
578
596
  @cloud_billing_stub.create_billing_account request, options do |result, operation|
579
597
  yield result, operation if block_given?
580
- return result
581
598
  end
582
599
  rescue ::Gapic::Rest::Error => e
583
600
  raise ::Google::Cloud::Error.from_error(e)
@@ -673,7 +690,7 @@ module Google
673
690
  @cloud_billing_stub.list_project_billing_info request, options do |result, operation|
674
691
  result = ::Gapic::Rest::PagedEnumerable.new @cloud_billing_stub, :list_project_billing_info, "project_billing_info", request, result, options
675
692
  yield result, operation if block_given?
676
- return result
693
+ throw :response, result
677
694
  end
678
695
  rescue ::Gapic::Rest::Error => e
679
696
  raise ::Google::Cloud::Error.from_error(e)
@@ -757,7 +774,6 @@ module Google
757
774
 
758
775
  @cloud_billing_stub.get_project_billing_info request, options do |result, operation|
759
776
  yield result, operation if block_given?
760
- return result
761
777
  end
762
778
  rescue ::Gapic::Rest::Error => e
763
779
  raise ::Google::Cloud::Error.from_error(e)
@@ -873,7 +889,6 @@ module Google
873
889
 
874
890
  @cloud_billing_stub.update_project_billing_info request, options do |result, operation|
875
891
  yield result, operation if block_given?
876
- return result
877
892
  end
878
893
  rescue ::Gapic::Rest::Error => e
879
894
  raise ::Google::Cloud::Error.from_error(e)
@@ -959,7 +974,6 @@ module Google
959
974
 
960
975
  @cloud_billing_stub.get_iam_policy request, options do |result, operation|
961
976
  yield result, operation if block_given?
962
- return result
963
977
  end
964
978
  rescue ::Gapic::Rest::Error => e
965
979
  raise ::Google::Cloud::Error.from_error(e)
@@ -1054,7 +1068,6 @@ module Google
1054
1068
 
1055
1069
  @cloud_billing_stub.set_iam_policy request, options do |result, operation|
1056
1070
  yield result, operation if block_given?
1057
- return result
1058
1071
  end
1059
1072
  rescue ::Gapic::Rest::Error => e
1060
1073
  raise ::Google::Cloud::Error.from_error(e)
@@ -1141,7 +1154,6 @@ module Google
1141
1154
 
1142
1155
  @cloud_billing_stub.test_iam_permissions request, options do |result, operation|
1143
1156
  yield result, operation if block_given?
1144
- return result
1145
1157
  end
1146
1158
  rescue ::Gapic::Rest::Error => e
1147
1159
  raise ::Google::Cloud::Error.from_error(e)
@@ -1227,7 +1239,6 @@ module Google
1227
1239
 
1228
1240
  @cloud_billing_stub.move_billing_account request, options do |result, operation|
1229
1241
  yield result, operation if block_given?
1230
- return result
1231
1242
  end
1232
1243
  rescue ::Gapic::Rest::Error => e
1233
1244
  raise ::Google::Cloud::Error.from_error(e)
@@ -1275,6 +1286,13 @@ module Google
1275
1286
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1276
1287
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1277
1288
  # * (`nil`) indicating no credentials
1289
+ #
1290
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1291
+ # external source for authentication to Google Cloud, you must validate it before
1292
+ # providing it to a Google API client library. Providing an unvalidated credential
1293
+ # configuration to Google APIs can compromise the security of your systems and data.
1294
+ # For more information, refer to [Validate credential configurations from external
1295
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1278
1296
  # @return [::Object]
1279
1297
  # @!attribute [rw] scope
1280
1298
  # The OAuth scopes
@@ -1307,6 +1325,11 @@ module Google
1307
1325
  # default endpoint URL. The default value of nil uses the environment
1308
1326
  # universe (usually the default "googleapis.com" universe).
1309
1327
  # @return [::String,nil]
1328
+ # @!attribute [rw] logger
1329
+ # A custom logger to use for request/response debug logging, or the value
1330
+ # `:default` (the default) to construct a default logger, or `nil` to
1331
+ # explicitly disable logging.
1332
+ # @return [::Logger,:default,nil]
1310
1333
  #
1311
1334
  class Configuration
1312
1335
  extend ::Gapic::Config
@@ -1328,6 +1351,7 @@ module Google
1328
1351
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1329
1352
  config_attr :quota_project, nil, ::String, nil
1330
1353
  config_attr :universe_domain, nil, ::String, nil
1354
+ config_attr :logger, :default, ::Logger, nil, :default
1331
1355
 
1332
1356
  # @private
1333
1357
  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 get_billing_account 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_billing_account",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Billing::V1::BillingAccount.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: "list_billing_accounts",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Billing::V1::ListBillingAccountsResponse.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_billing_account",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Billing::V1::BillingAccount.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: "create_billing_account",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Billing::V1::BillingAccount.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: "list_project_billing_info",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Billing::V1::ListProjectBillingInfoResponse.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
  ##
@@ -277,16 +299,18 @@ module Google
277
299
 
278
300
  response = @client_stub.make_http_request(
279
301
  verb,
280
- uri: uri,
281
- body: body || "",
282
- params: query_string_params,
302
+ uri: uri,
303
+ body: body || "",
304
+ params: query_string_params,
305
+ method_name: "get_project_billing_info",
283
306
  options: options
284
307
  )
285
308
  operation = ::Gapic::Rest::TransportOperation.new response
286
309
  result = ::Google::Cloud::Billing::V1::ProjectBillingInfo.decode_json response.body, ignore_unknown_fields: true
287
-
288
- yield result, operation if block_given?
289
- result
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: uri,
319
- body: body || "",
320
- params: query_string_params,
342
+ uri: uri,
343
+ body: body || "",
344
+ params: query_string_params,
345
+ method_name: "update_project_billing_info",
321
346
  options: options
322
347
  )
323
348
  operation = ::Gapic::Rest::TransportOperation.new response
324
349
  result = ::Google::Cloud::Billing::V1::ProjectBillingInfo.decode_json response.body, ignore_unknown_fields: true
325
-
326
- yield result, operation if block_given?
327
- result
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,18 @@ module Google
353
379
 
354
380
  response = @client_stub.make_http_request(
355
381
  verb,
356
- uri: uri,
357
- body: body || "",
358
- params: query_string_params,
382
+ uri: uri,
383
+ body: body || "",
384
+ params: query_string_params,
385
+ method_name: "get_iam_policy",
359
386
  options: options
360
387
  )
361
388
  operation = ::Gapic::Rest::TransportOperation.new response
362
389
  result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
363
-
364
- yield result, operation if block_given?
365
- result
390
+ catch :response do
391
+ yield result, operation if block_given?
392
+ result
393
+ end
366
394
  end
367
395
 
368
396
  ##
@@ -391,16 +419,18 @@ module Google
391
419
 
392
420
  response = @client_stub.make_http_request(
393
421
  verb,
394
- uri: uri,
395
- body: body || "",
396
- params: query_string_params,
422
+ uri: uri,
423
+ body: body || "",
424
+ params: query_string_params,
425
+ method_name: "set_iam_policy",
397
426
  options: options
398
427
  )
399
428
  operation = ::Gapic::Rest::TransportOperation.new response
400
429
  result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true
401
-
402
- yield result, operation if block_given?
403
- result
430
+ catch :response do
431
+ yield result, operation if block_given?
432
+ result
433
+ end
404
434
  end
405
435
 
406
436
  ##
@@ -429,16 +459,18 @@ module Google
429
459
 
430
460
  response = @client_stub.make_http_request(
431
461
  verb,
432
- uri: uri,
433
- body: body || "",
434
- params: query_string_params,
462
+ uri: uri,
463
+ body: body || "",
464
+ params: query_string_params,
465
+ method_name: "test_iam_permissions",
435
466
  options: options
436
467
  )
437
468
  operation = ::Gapic::Rest::TransportOperation.new response
438
469
  result = ::Google::Iam::V1::TestIamPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
439
-
440
- yield result, operation if block_given?
441
- result
470
+ catch :response do
471
+ yield result, operation if block_given?
472
+ result
473
+ end
442
474
  end
443
475
 
444
476
  ##
@@ -467,16 +499,18 @@ module Google
467
499
 
468
500
  response = @client_stub.make_http_request(
469
501
  verb,
470
- uri: uri,
471
- body: body || "",
472
- params: query_string_params,
502
+ uri: uri,
503
+ body: body || "",
504
+ params: query_string_params,
505
+ method_name: "move_billing_account",
473
506
  options: options
474
507
  )
475
508
  operation = ::Gapic::Rest::TransportOperation.new response
476
509
  result = ::Google::Cloud::Billing::V1::BillingAccount.decode_json response.body, ignore_unknown_fields: true
477
-
478
- yield result, operation if block_given?
479
- result
510
+ catch :response do
511
+ yield result, operation if block_given?
512
+ result
513
+ end
480
514
  end
481
515
 
482
516
  ##
@@ -163,8 +163,28 @@ module Google
163
163
  universe_domain: @config.universe_domain,
164
164
  channel_args: @config.channel_args,
165
165
  interceptors: @config.interceptors,
166
- channel_pool_config: @config.channel_pool
166
+ channel_pool_config: @config.channel_pool,
167
+ logger: @config.logger
167
168
  )
169
+
170
+ @cloud_catalog_stub.stub_logger&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+ end
180
+
181
+ ##
182
+ # The logger used for request/response debug logging.
183
+ #
184
+ # @return [Logger]
185
+ #
186
+ def logger
187
+ @cloud_catalog_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -250,7 +270,7 @@ module Google
250
270
  @cloud_catalog_stub.call_rpc :list_services, request, options: options do |response, operation|
251
271
  response = ::Gapic::PagedEnumerable.new @cloud_catalog_stub, :list_services, request, response, operation, options
252
272
  yield response, operation if block_given?
253
- return response
273
+ throw :response, response
254
274
  end
255
275
  rescue ::GRPC::BadStatus => e
256
276
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,7 +386,7 @@ module Google
366
386
  @cloud_catalog_stub.call_rpc :list_skus, request, options: options do |response, operation|
367
387
  response = ::Gapic::PagedEnumerable.new @cloud_catalog_stub, :list_skus, request, response, operation, options
368
388
  yield response, operation if block_given?
369
- return response
389
+ throw :response, response
370
390
  end
371
391
  rescue ::GRPC::BadStatus => e
372
392
  raise ::Google::Cloud::Error.from_error(e)
@@ -416,6 +436,13 @@ module Google
416
436
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
417
437
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
418
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).
419
446
  # @return [::Object]
420
447
  # @!attribute [rw] scope
421
448
  # The OAuth scopes
@@ -455,6 +482,11 @@ module Google
455
482
  # default endpoint URL. The default value of nil uses the environment
456
483
  # universe (usually the default "googleapis.com" universe).
457
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]
458
490
  #
459
491
  class Configuration
460
492
  extend ::Gapic::Config
@@ -479,6 +511,7 @@ module Google
479
511
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
480
512
  config_attr :quota_project, nil, ::String, nil
481
513
  config_attr :universe_domain, nil, ::String, nil
514
+ config_attr :logger, :default, ::Logger, nil, :default
482
515
 
483
516
  # @private
484
517
  def initialize parent_config = nil
@@ -156,8 +156,28 @@ module Google
156
156
  endpoint: @config.endpoint,
157
157
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
158
  universe_domain: @config.universe_domain,
159
- credentials: credentials
159
+ credentials: credentials,
160
+ logger: @config.logger
160
161
  )
162
+
163
+ @cloud_catalog_stub.logger(stub: true)&.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
+ @cloud_catalog_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -244,7 +264,7 @@ module Google
244
264
  @cloud_catalog_stub.list_services request, options do |result, operation|
245
265
  result = ::Gapic::Rest::PagedEnumerable.new @cloud_catalog_stub, :list_services, "services", request, result, options
246
266
  yield result, operation if block_given?
247
- return result
267
+ throw :response, result
248
268
  end
249
269
  rescue ::Gapic::Rest::Error => e
250
270
  raise ::Google::Cloud::Error.from_error(e)
@@ -353,7 +373,7 @@ module Google
353
373
  @cloud_catalog_stub.list_skus request, options do |result, operation|
354
374
  result = ::Gapic::Rest::PagedEnumerable.new @cloud_catalog_stub, :list_skus, "skus", request, result, options
355
375
  yield result, operation if block_given?
356
- return result
376
+ throw :response, result
357
377
  end
358
378
  rescue ::Gapic::Rest::Error => e
359
379
  raise ::Google::Cloud::Error.from_error(e)
@@ -401,6 +421,13 @@ module Google
401
421
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
402
422
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
403
423
  # * (`nil`) indicating no credentials
424
+ #
425
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
426
+ # external source for authentication to Google Cloud, you must validate it before
427
+ # providing it to a Google API client library. Providing an unvalidated credential
428
+ # configuration to Google APIs can compromise the security of your systems and data.
429
+ # For more information, refer to [Validate credential configurations from external
430
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
404
431
  # @return [::Object]
405
432
  # @!attribute [rw] scope
406
433
  # The OAuth scopes
@@ -433,6 +460,11 @@ module Google
433
460
  # default endpoint URL. The default value of nil uses the environment
434
461
  # universe (usually the default "googleapis.com" universe).
435
462
  # @return [::String,nil]
463
+ # @!attribute [rw] logger
464
+ # A custom logger to use for request/response debug logging, or the value
465
+ # `:default` (the default) to construct a default logger, or `nil` to
466
+ # explicitly disable logging.
467
+ # @return [::Logger,:default,nil]
436
468
  #
437
469
  class Configuration
438
470
  extend ::Gapic::Config
@@ -454,6 +486,7 @@ module Google
454
486
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
455
487
  config_attr :quota_project, nil, ::String, nil
456
488
  config_attr :universe_domain, nil, ::String, nil
489
+ config_attr :logger, :default, ::Logger, nil, :default
457
490
 
458
491
  # @private
459
492
  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_services 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_services",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Billing::V1::ListServicesResponse.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: "list_skus",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Billing::V1::ListSkusResponse.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
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Billing
23
23
  module V1
24
- VERSION = "1.1.0"
24
+ VERSION = "1.3.0"
25
25
  end
26
26
  end
27
27
  end
@@ -306,9 +306,28 @@ module Google
306
306
  # @!attribute [rw] common
307
307
  # @return [::Google::Api::CommonLanguageSettings]
308
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
309
319
  class GoSettings
310
320
  include ::Google::Protobuf::MessageExts
311
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
312
331
  end
313
332
 
314
333
  # Describes the generator configuration for a method.
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-billing-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-04 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: gapic-common
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 0.21.1
18
+ version: 0.25.0
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 2.a
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: 0.21.1
28
+ version: 0.25.0
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: 2.a
@@ -112,7 +111,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
112
111
  licenses:
113
112
  - Apache-2.0
114
113
  metadata: {}
115
- post_install_message:
116
114
  rdoc_options: []
117
115
  require_paths:
118
116
  - lib
@@ -120,15 +118,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
118
  requirements:
121
119
  - - ">="
122
120
  - !ruby/object:Gem::Version
123
- version: '2.7'
121
+ version: '3.0'
124
122
  required_rubygems_version: !ruby/object:Gem::Requirement
125
123
  requirements:
126
124
  - - ">="
127
125
  - !ruby/object:Gem::Version
128
126
  version: '0'
129
127
  requirements: []
130
- rubygems_version: 3.5.22
131
- signing_key:
128
+ rubygems_version: 3.6.2
132
129
  specification_version: 4
133
130
  summary: Allows developers to manage billing for their Google Cloud Platform projects
134
131
  programmatically.