google-cloud-gdc_hardware_management-v1alpha 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -305,15 +305,27 @@ module Google
305
305
  endpoint: @config.endpoint,
306
306
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
307
307
  universe_domain: @config.universe_domain,
308
- credentials: credentials
308
+ credentials: credentials,
309
+ logger: @config.logger
309
310
  )
310
311
 
312
+ @gdc_hardware_management_stub.logger(stub: true)&.info do |entry|
313
+ entry.set_system_name
314
+ entry.set_service
315
+ entry.message = "Created client for #{entry.service}"
316
+ entry.set_credentials_fields credentials
317
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
318
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
319
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
320
+ end
321
+
311
322
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
312
323
  config.credentials = credentials
313
324
  config.quota_project = @quota_project_id
314
325
  config.endpoint = @gdc_hardware_management_stub.endpoint
315
326
  config.universe_domain = @gdc_hardware_management_stub.universe_domain
316
327
  config.bindings_override = @config.bindings_override
328
+ config.logger = @gdc_hardware_management_stub.logger if config.respond_to? :logger=
317
329
  end
318
330
  end
319
331
 
@@ -331,6 +343,15 @@ module Google
331
343
  #
332
344
  attr_reader :location_client
333
345
 
346
+ ##
347
+ # The logger used for request/response debug logging.
348
+ #
349
+ # @return [Logger]
350
+ #
351
+ def logger
352
+ @gdc_hardware_management_stub.logger
353
+ end
354
+
334
355
  # Service calls
335
356
 
336
357
  ##
@@ -424,7 +445,6 @@ module Google
424
445
 
425
446
  @gdc_hardware_management_stub.list_orders request, options do |result, operation|
426
447
  yield result, operation if block_given?
427
- return result
428
448
  end
429
449
  rescue ::Gapic::Rest::Error => e
430
450
  raise ::Google::Cloud::Error.from_error(e)
@@ -503,7 +523,6 @@ module Google
503
523
 
504
524
  @gdc_hardware_management_stub.get_order request, options do |result, operation|
505
525
  yield result, operation if block_given?
506
- return result
507
526
  end
508
527
  rescue ::Gapic::Rest::Error => e
509
528
  raise ::Google::Cloud::Error.from_error(e)
@@ -605,7 +624,7 @@ module Google
605
624
  @gdc_hardware_management_stub.create_order request, options do |result, operation|
606
625
  result = ::Gapic::Operation.new result, @operations_client, options: options
607
626
  yield result, operation if block_given?
608
- return result
627
+ throw :response, result
609
628
  end
610
629
  rescue ::Gapic::Rest::Error => e
611
630
  raise ::Google::Cloud::Error.from_error(e)
@@ -700,7 +719,7 @@ module Google
700
719
  @gdc_hardware_management_stub.update_order request, options do |result, operation|
701
720
  result = ::Gapic::Operation.new result, @operations_client, options: options
702
721
  yield result, operation if block_given?
703
- return result
722
+ throw :response, result
704
723
  end
705
724
  rescue ::Gapic::Rest::Error => e
706
725
  raise ::Google::Cloud::Error.from_error(e)
@@ -796,7 +815,7 @@ module Google
796
815
  @gdc_hardware_management_stub.delete_order request, options do |result, operation|
797
816
  result = ::Gapic::Operation.new result, @operations_client, options: options
798
817
  yield result, operation if block_given?
799
- return result
818
+ throw :response, result
800
819
  end
801
820
  rescue ::Gapic::Rest::Error => e
802
821
  raise ::Google::Cloud::Error.from_error(e)
@@ -890,7 +909,7 @@ module Google
890
909
  @gdc_hardware_management_stub.submit_order request, options do |result, operation|
891
910
  result = ::Gapic::Operation.new result, @operations_client, options: options
892
911
  yield result, operation if block_given?
893
- return result
912
+ throw :response, result
894
913
  end
895
914
  rescue ::Gapic::Rest::Error => e
896
915
  raise ::Google::Cloud::Error.from_error(e)
@@ -987,7 +1006,6 @@ module Google
987
1006
 
988
1007
  @gdc_hardware_management_stub.list_sites request, options do |result, operation|
989
1008
  yield result, operation if block_given?
990
- return result
991
1009
  end
992
1010
  rescue ::Gapic::Rest::Error => e
993
1011
  raise ::Google::Cloud::Error.from_error(e)
@@ -1067,7 +1085,6 @@ module Google
1067
1085
 
1068
1086
  @gdc_hardware_management_stub.get_site request, options do |result, operation|
1069
1087
  yield result, operation if block_given?
1070
- return result
1071
1088
  end
1072
1089
  rescue ::Gapic::Rest::Error => e
1073
1090
  raise ::Google::Cloud::Error.from_error(e)
@@ -1169,7 +1186,7 @@ module Google
1169
1186
  @gdc_hardware_management_stub.create_site request, options do |result, operation|
1170
1187
  result = ::Gapic::Operation.new result, @operations_client, options: options
1171
1188
  yield result, operation if block_given?
1172
- return result
1189
+ throw :response, result
1173
1190
  end
1174
1191
  rescue ::Gapic::Rest::Error => e
1175
1192
  raise ::Google::Cloud::Error.from_error(e)
@@ -1264,7 +1281,7 @@ module Google
1264
1281
  @gdc_hardware_management_stub.update_site request, options do |result, operation|
1265
1282
  result = ::Gapic::Operation.new result, @operations_client, options: options
1266
1283
  yield result, operation if block_given?
1267
- return result
1284
+ throw :response, result
1268
1285
  end
1269
1286
  rescue ::Gapic::Rest::Error => e
1270
1287
  raise ::Google::Cloud::Error.from_error(e)
@@ -1355,7 +1372,7 @@ module Google
1355
1372
  @gdc_hardware_management_stub.delete_site request, options do |result, operation|
1356
1373
  result = ::Gapic::Operation.new result, @operations_client, options: options
1357
1374
  yield result, operation if block_given?
1358
- return result
1375
+ throw :response, result
1359
1376
  end
1360
1377
  rescue ::Gapic::Rest::Error => e
1361
1378
  raise ::Google::Cloud::Error.from_error(e)
@@ -1448,7 +1465,6 @@ module Google
1448
1465
 
1449
1466
  @gdc_hardware_management_stub.list_hardware_groups request, options do |result, operation|
1450
1467
  yield result, operation if block_given?
1451
- return result
1452
1468
  end
1453
1469
  rescue ::Gapic::Rest::Error => e
1454
1470
  raise ::Google::Cloud::Error.from_error(e)
@@ -1529,7 +1545,6 @@ module Google
1529
1545
 
1530
1546
  @gdc_hardware_management_stub.get_hardware_group request, options do |result, operation|
1531
1547
  yield result, operation if block_given?
1532
- return result
1533
1548
  end
1534
1549
  rescue ::Gapic::Rest::Error => e
1535
1550
  raise ::Google::Cloud::Error.from_error(e)
@@ -1631,7 +1646,7 @@ module Google
1631
1646
  @gdc_hardware_management_stub.create_hardware_group request, options do |result, operation|
1632
1647
  result = ::Gapic::Operation.new result, @operations_client, options: options
1633
1648
  yield result, operation if block_given?
1634
- return result
1649
+ throw :response, result
1635
1650
  end
1636
1651
  rescue ::Gapic::Rest::Error => e
1637
1652
  raise ::Google::Cloud::Error.from_error(e)
@@ -1727,7 +1742,7 @@ module Google
1727
1742
  @gdc_hardware_management_stub.update_hardware_group request, options do |result, operation|
1728
1743
  result = ::Gapic::Operation.new result, @operations_client, options: options
1729
1744
  yield result, operation if block_given?
1730
- return result
1745
+ throw :response, result
1731
1746
  end
1732
1747
  rescue ::Gapic::Rest::Error => e
1733
1748
  raise ::Google::Cloud::Error.from_error(e)
@@ -1819,7 +1834,7 @@ module Google
1819
1834
  @gdc_hardware_management_stub.delete_hardware_group request, options do |result, operation|
1820
1835
  result = ::Gapic::Operation.new result, @operations_client, options: options
1821
1836
  yield result, operation if block_given?
1822
- return result
1837
+ throw :response, result
1823
1838
  end
1824
1839
  rescue ::Gapic::Rest::Error => e
1825
1840
  raise ::Google::Cloud::Error.from_error(e)
@@ -1916,7 +1931,6 @@ module Google
1916
1931
 
1917
1932
  @gdc_hardware_management_stub.list_hardware request, options do |result, operation|
1918
1933
  yield result, operation if block_given?
1919
- return result
1920
1934
  end
1921
1935
  rescue ::Gapic::Rest::Error => e
1922
1936
  raise ::Google::Cloud::Error.from_error(e)
@@ -1996,7 +2010,6 @@ module Google
1996
2010
 
1997
2011
  @gdc_hardware_management_stub.get_hardware request, options do |result, operation|
1998
2012
  yield result, operation if block_given?
1999
- return result
2000
2013
  end
2001
2014
  rescue ::Gapic::Rest::Error => e
2002
2015
  raise ::Google::Cloud::Error.from_error(e)
@@ -2095,7 +2108,7 @@ module Google
2095
2108
  @gdc_hardware_management_stub.create_hardware request, options do |result, operation|
2096
2109
  result = ::Gapic::Operation.new result, @operations_client, options: options
2097
2110
  yield result, operation if block_given?
2098
- return result
2111
+ throw :response, result
2099
2112
  end
2100
2113
  rescue ::Gapic::Rest::Error => e
2101
2114
  raise ::Google::Cloud::Error.from_error(e)
@@ -2190,7 +2203,7 @@ module Google
2190
2203
  @gdc_hardware_management_stub.update_hardware request, options do |result, operation|
2191
2204
  result = ::Gapic::Operation.new result, @operations_client, options: options
2192
2205
  yield result, operation if block_given?
2193
- return result
2206
+ throw :response, result
2194
2207
  end
2195
2208
  rescue ::Gapic::Rest::Error => e
2196
2209
  raise ::Google::Cloud::Error.from_error(e)
@@ -2281,7 +2294,7 @@ module Google
2281
2294
  @gdc_hardware_management_stub.delete_hardware request, options do |result, operation|
2282
2295
  result = ::Gapic::Operation.new result, @operations_client, options: options
2283
2296
  yield result, operation if block_given?
2284
- return result
2297
+ throw :response, result
2285
2298
  end
2286
2299
  rescue ::Gapic::Rest::Error => e
2287
2300
  raise ::Google::Cloud::Error.from_error(e)
@@ -2374,7 +2387,6 @@ module Google
2374
2387
 
2375
2388
  @gdc_hardware_management_stub.list_comments request, options do |result, operation|
2376
2389
  yield result, operation if block_given?
2377
- return result
2378
2390
  end
2379
2391
  rescue ::Gapic::Rest::Error => e
2380
2392
  raise ::Google::Cloud::Error.from_error(e)
@@ -2455,7 +2467,6 @@ module Google
2455
2467
 
2456
2468
  @gdc_hardware_management_stub.get_comment request, options do |result, operation|
2457
2469
  yield result, operation if block_given?
2458
- return result
2459
2470
  end
2460
2471
  rescue ::Gapic::Rest::Error => e
2461
2472
  raise ::Google::Cloud::Error.from_error(e)
@@ -2557,7 +2568,7 @@ module Google
2557
2568
  @gdc_hardware_management_stub.create_comment request, options do |result, operation|
2558
2569
  result = ::Gapic::Operation.new result, @operations_client, options: options
2559
2570
  yield result, operation if block_given?
2560
- return result
2571
+ throw :response, result
2561
2572
  end
2562
2573
  rescue ::Gapic::Rest::Error => e
2563
2574
  raise ::Google::Cloud::Error.from_error(e)
@@ -2643,7 +2654,6 @@ module Google
2643
2654
 
2644
2655
  @gdc_hardware_management_stub.record_action_on_comment request, options do |result, operation|
2645
2656
  yield result, operation if block_given?
2646
- return result
2647
2657
  end
2648
2658
  rescue ::Gapic::Rest::Error => e
2649
2659
  raise ::Google::Cloud::Error.from_error(e)
@@ -2736,7 +2746,6 @@ module Google
2736
2746
 
2737
2747
  @gdc_hardware_management_stub.list_change_log_entries request, options do |result, operation|
2738
2748
  yield result, operation if block_given?
2739
- return result
2740
2749
  end
2741
2750
  rescue ::Gapic::Rest::Error => e
2742
2751
  raise ::Google::Cloud::Error.from_error(e)
@@ -2817,7 +2826,6 @@ module Google
2817
2826
 
2818
2827
  @gdc_hardware_management_stub.get_change_log_entry request, options do |result, operation|
2819
2828
  yield result, operation if block_given?
2820
- return result
2821
2829
  end
2822
2830
  rescue ::Gapic::Rest::Error => e
2823
2831
  raise ::Google::Cloud::Error.from_error(e)
@@ -2914,7 +2922,6 @@ module Google
2914
2922
 
2915
2923
  @gdc_hardware_management_stub.list_skus request, options do |result, operation|
2916
2924
  yield result, operation if block_given?
2917
- return result
2918
2925
  end
2919
2926
  rescue ::Gapic::Rest::Error => e
2920
2927
  raise ::Google::Cloud::Error.from_error(e)
@@ -2994,7 +3001,6 @@ module Google
2994
3001
 
2995
3002
  @gdc_hardware_management_stub.get_sku request, options do |result, operation|
2996
3003
  yield result, operation if block_given?
2997
- return result
2998
3004
  end
2999
3005
  rescue ::Gapic::Rest::Error => e
3000
3006
  raise ::Google::Cloud::Error.from_error(e)
@@ -3091,7 +3097,6 @@ module Google
3091
3097
 
3092
3098
  @gdc_hardware_management_stub.list_zones request, options do |result, operation|
3093
3099
  yield result, operation if block_given?
3094
- return result
3095
3100
  end
3096
3101
  rescue ::Gapic::Rest::Error => e
3097
3102
  raise ::Google::Cloud::Error.from_error(e)
@@ -3171,7 +3176,6 @@ module Google
3171
3176
 
3172
3177
  @gdc_hardware_management_stub.get_zone request, options do |result, operation|
3173
3178
  yield result, operation if block_given?
3174
- return result
3175
3179
  end
3176
3180
  rescue ::Gapic::Rest::Error => e
3177
3181
  raise ::Google::Cloud::Error.from_error(e)
@@ -3273,7 +3277,7 @@ module Google
3273
3277
  @gdc_hardware_management_stub.create_zone request, options do |result, operation|
3274
3278
  result = ::Gapic::Operation.new result, @operations_client, options: options
3275
3279
  yield result, operation if block_given?
3276
- return result
3280
+ throw :response, result
3277
3281
  end
3278
3282
  rescue ::Gapic::Rest::Error => e
3279
3283
  raise ::Google::Cloud::Error.from_error(e)
@@ -3368,7 +3372,7 @@ module Google
3368
3372
  @gdc_hardware_management_stub.update_zone request, options do |result, operation|
3369
3373
  result = ::Gapic::Operation.new result, @operations_client, options: options
3370
3374
  yield result, operation if block_given?
3371
- return result
3375
+ throw :response, result
3372
3376
  end
3373
3377
  rescue ::Gapic::Rest::Error => e
3374
3378
  raise ::Google::Cloud::Error.from_error(e)
@@ -3459,7 +3463,7 @@ module Google
3459
3463
  @gdc_hardware_management_stub.delete_zone request, options do |result, operation|
3460
3464
  result = ::Gapic::Operation.new result, @operations_client, options: options
3461
3465
  yield result, operation if block_given?
3462
- return result
3466
+ throw :response, result
3463
3467
  end
3464
3468
  rescue ::Gapic::Rest::Error => e
3465
3469
  raise ::Google::Cloud::Error.from_error(e)
@@ -3556,7 +3560,7 @@ module Google
3556
3560
  @gdc_hardware_management_stub.signal_zone_state request, options do |result, operation|
3557
3561
  result = ::Gapic::Operation.new result, @operations_client, options: options
3558
3562
  yield result, operation if block_given?
3559
- return result
3563
+ throw :response, result
3560
3564
  end
3561
3565
  rescue ::Gapic::Rest::Error => e
3562
3566
  raise ::Google::Cloud::Error.from_error(e)
@@ -3636,6 +3640,11 @@ module Google
3636
3640
  # default endpoint URL. The default value of nil uses the environment
3637
3641
  # universe (usually the default "googleapis.com" universe).
3638
3642
  # @return [::String,nil]
3643
+ # @!attribute [rw] logger
3644
+ # A custom logger to use for request/response debug logging, or the value
3645
+ # `:default` (the default) to construct a default logger, or `nil` to
3646
+ # explicitly disable logging.
3647
+ # @return [::Logger,:default,nil]
3639
3648
  #
3640
3649
  class Configuration
3641
3650
  extend ::Gapic::Config
@@ -3664,6 +3673,7 @@ module Google
3664
3673
  # by the host service.
3665
3674
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3666
3675
  config_attr :bindings_override, {}, ::Hash, nil
3676
+ config_attr :logger, :default, ::Logger, nil, :default
3667
3677
 
3668
3678
  # @private
3669
3679
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,6 +534,11 @@ module Google
543
534
  # default endpoint URL. The default value of nil uses the environment
544
535
  # universe (usually the default "googleapis.com" universe).
545
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
546
542
  #
547
543
  class Configuration
548
544
  extend ::Gapic::Config
@@ -564,6 +560,7 @@ module Google
564
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
561
  config_attr :quota_project, nil, ::String, nil
566
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
567
564
 
568
565
  # @private
569
566
  def initialize parent_config = nil
@@ -683,16 +680,18 @@ module Google
683
680
 
684
681
  response = @client_stub.make_http_request(
685
682
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
689
687
  options: options
690
688
  )
691
689
  operation = ::Gapic::Rest::TransportOperation.new response
692
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
696
695
  end
697
696
 
698
697
  ##
@@ -721,16 +720,18 @@ module Google
721
720
 
722
721
  response = @client_stub.make_http_request(
723
722
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
727
727
  options: options
728
728
  )
729
729
  operation = ::Gapic::Rest::TransportOperation.new response
730
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
734
735
  end
735
736
 
736
737
  ##
@@ -759,16 +760,18 @@ module Google
759
760
 
760
761
  response = @client_stub.make_http_request(
761
762
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
765
767
  options: options
766
768
  )
767
769
  operation = ::Gapic::Rest::TransportOperation.new response
768
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
772
775
  end
773
776
 
774
777
  ##
@@ -797,16 +800,18 @@ module Google
797
800
 
798
801
  response = @client_stub.make_http_request(
799
802
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
803
807
  options: options
804
808
  )
805
809
  operation = ::Gapic::Rest::TransportOperation.new response
806
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
810
815
  end
811
816
 
812
817
  ##