google-cloud-data_catalog-v1 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -164,14 +164,26 @@ module Google
164
164
  endpoint: @config.endpoint,
165
165
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
166
166
  universe_domain: @config.universe_domain,
167
- credentials: credentials
167
+ credentials: credentials,
168
+ logger: @config.logger
168
169
  )
169
170
 
171
+ @data_catalog_stub.logger(stub: true)&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
180
+
170
181
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
171
182
  config.credentials = credentials
172
183
  config.quota_project = @quota_project_id
173
184
  config.endpoint = @data_catalog_stub.endpoint
174
185
  config.universe_domain = @data_catalog_stub.universe_domain
186
+ config.logger = @data_catalog_stub.logger if config.respond_to? :logger=
175
187
  end
176
188
  end
177
189
 
@@ -189,6 +201,15 @@ module Google
189
201
  #
190
202
  attr_reader :iam_policy_client
191
203
 
204
+ ##
205
+ # The logger used for request/response debug logging.
206
+ #
207
+ # @return [Logger]
208
+ #
209
+ def logger
210
+ @data_catalog_stub.logger
211
+ end
212
+
192
213
  # Service calls
193
214
 
194
215
  ##
@@ -337,7 +358,6 @@ module Google
337
358
 
338
359
  @data_catalog_stub.search_catalog request, options do |result, operation|
339
360
  yield result, operation if block_given?
340
- return result
341
361
  end
342
362
  rescue ::Gapic::Rest::Error => e
343
363
  raise ::Google::Cloud::Error.from_error(e)
@@ -454,7 +474,6 @@ module Google
454
474
 
455
475
  @data_catalog_stub.create_entry_group request, options do |result, operation|
456
476
  yield result, operation if block_given?
457
- return result
458
477
  end
459
478
  rescue ::Gapic::Rest::Error => e
460
479
  raise ::Google::Cloud::Error.from_error(e)
@@ -535,7 +554,6 @@ module Google
535
554
 
536
555
  @data_catalog_stub.get_entry_group request, options do |result, operation|
537
556
  yield result, operation if block_given?
538
- return result
539
557
  end
540
558
  rescue ::Gapic::Rest::Error => e
541
559
  raise ::Google::Cloud::Error.from_error(e)
@@ -625,7 +643,6 @@ module Google
625
643
 
626
644
  @data_catalog_stub.update_entry_group request, options do |result, operation|
627
645
  yield result, operation if block_given?
628
- return result
629
646
  end
630
647
  rescue ::Gapic::Rest::Error => e
631
648
  raise ::Google::Cloud::Error.from_error(e)
@@ -711,7 +728,6 @@ module Google
711
728
 
712
729
  @data_catalog_stub.delete_entry_group request, options do |result, operation|
713
730
  yield result, operation if block_given?
714
- return result
715
731
  end
716
732
  rescue ::Gapic::Rest::Error => e
717
733
  raise ::Google::Cloud::Error.from_error(e)
@@ -805,7 +821,7 @@ module Google
805
821
  @data_catalog_stub.list_entry_groups request, options do |result, operation|
806
822
  result = ::Gapic::Rest::PagedEnumerable.new @data_catalog_stub, :list_entry_groups, "entry_groups", request, result, options
807
823
  yield result, operation if block_given?
808
- return result
824
+ throw :response, result
809
825
  end
810
826
  rescue ::Gapic::Rest::Error => e
811
827
  raise ::Google::Cloud::Error.from_error(e)
@@ -905,7 +921,6 @@ module Google
905
921
 
906
922
  @data_catalog_stub.create_entry request, options do |result, operation|
907
923
  yield result, operation if block_given?
908
- return result
909
924
  end
910
925
  rescue ::Gapic::Rest::Error => e
911
926
  raise ::Google::Cloud::Error.from_error(e)
@@ -1019,7 +1034,6 @@ module Google
1019
1034
 
1020
1035
  @data_catalog_stub.update_entry request, options do |result, operation|
1021
1036
  yield result, operation if block_given?
1022
- return result
1023
1037
  end
1024
1038
  rescue ::Gapic::Rest::Error => e
1025
1039
  raise ::Google::Cloud::Error.from_error(e)
@@ -1107,7 +1121,6 @@ module Google
1107
1121
 
1108
1122
  @data_catalog_stub.delete_entry request, options do |result, operation|
1109
1123
  yield result, operation if block_given?
1110
- return result
1111
1124
  end
1112
1125
  rescue ::Gapic::Rest::Error => e
1113
1126
  raise ::Google::Cloud::Error.from_error(e)
@@ -1186,7 +1199,6 @@ module Google
1186
1199
 
1187
1200
  @data_catalog_stub.get_entry request, options do |result, operation|
1188
1201
  yield result, operation if block_given?
1189
- return result
1190
1202
  end
1191
1203
  rescue ::Gapic::Rest::Error => e
1192
1204
  raise ::Google::Cloud::Error.from_error(e)
@@ -1314,7 +1326,6 @@ module Google
1314
1326
 
1315
1327
  @data_catalog_stub.lookup_entry request, options do |result, operation|
1316
1328
  yield result, operation if block_given?
1317
- return result
1318
1329
  end
1319
1330
  rescue ::Gapic::Rest::Error => e
1320
1331
  raise ::Google::Cloud::Error.from_error(e)
@@ -1416,7 +1427,7 @@ module Google
1416
1427
  @data_catalog_stub.list_entries request, options do |result, operation|
1417
1428
  result = ::Gapic::Rest::PagedEnumerable.new @data_catalog_stub, :list_entries, "entries", request, result, options
1418
1429
  yield result, operation if block_given?
1419
- return result
1430
+ throw :response, result
1420
1431
  end
1421
1432
  rescue ::Gapic::Rest::Error => e
1422
1433
  raise ::Google::Cloud::Error.from_error(e)
@@ -1501,7 +1512,6 @@ module Google
1501
1512
 
1502
1513
  @data_catalog_stub.modify_entry_overview request, options do |result, operation|
1503
1514
  yield result, operation if block_given?
1504
- return result
1505
1515
  end
1506
1516
  rescue ::Gapic::Rest::Error => e
1507
1517
  raise ::Google::Cloud::Error.from_error(e)
@@ -1586,7 +1596,6 @@ module Google
1586
1596
 
1587
1597
  @data_catalog_stub.modify_entry_contacts request, options do |result, operation|
1588
1598
  yield result, operation if block_given?
1589
- return result
1590
1599
  end
1591
1600
  rescue ::Gapic::Rest::Error => e
1592
1601
  raise ::Google::Cloud::Error.from_error(e)
@@ -1679,7 +1688,6 @@ module Google
1679
1688
 
1680
1689
  @data_catalog_stub.create_tag_template request, options do |result, operation|
1681
1690
  yield result, operation if block_given?
1682
- return result
1683
1691
  end
1684
1692
  rescue ::Gapic::Rest::Error => e
1685
1693
  raise ::Google::Cloud::Error.from_error(e)
@@ -1758,7 +1766,6 @@ module Google
1758
1766
 
1759
1767
  @data_catalog_stub.get_tag_template request, options do |result, operation|
1760
1768
  yield result, operation if block_given?
1761
- return result
1762
1769
  end
1763
1770
  rescue ::Gapic::Rest::Error => e
1764
1771
  raise ::Google::Cloud::Error.from_error(e)
@@ -1855,7 +1862,6 @@ module Google
1855
1862
 
1856
1863
  @data_catalog_stub.update_tag_template request, options do |result, operation|
1857
1864
  yield result, operation if block_given?
1858
- return result
1859
1865
  end
1860
1866
  rescue ::Gapic::Rest::Error => e
1861
1867
  raise ::Google::Cloud::Error.from_error(e)
@@ -1942,7 +1948,6 @@ module Google
1942
1948
 
1943
1949
  @data_catalog_stub.delete_tag_template request, options do |result, operation|
1944
1950
  yield result, operation if block_given?
1945
- return result
1946
1951
  end
1947
1952
  rescue ::Gapic::Rest::Error => e
1948
1953
  raise ::Google::Cloud::Error.from_error(e)
@@ -2037,7 +2042,6 @@ module Google
2037
2042
 
2038
2043
  @data_catalog_stub.create_tag_template_field request, options do |result, operation|
2039
2044
  yield result, operation if block_given?
2040
- return result
2041
2045
  end
2042
2046
  rescue ::Gapic::Rest::Error => e
2043
2047
  raise ::Google::Cloud::Error.from_error(e)
@@ -2142,7 +2146,6 @@ module Google
2142
2146
 
2143
2147
  @data_catalog_stub.update_tag_template_field request, options do |result, operation|
2144
2148
  yield result, operation if block_given?
2145
- return result
2146
2149
  end
2147
2150
  rescue ::Gapic::Rest::Error => e
2148
2151
  raise ::Google::Cloud::Error.from_error(e)
@@ -2228,7 +2231,6 @@ module Google
2228
2231
 
2229
2232
  @data_catalog_stub.rename_tag_template_field request, options do |result, operation|
2230
2233
  yield result, operation if block_given?
2231
- return result
2232
2234
  end
2233
2235
  rescue ::Gapic::Rest::Error => e
2234
2236
  raise ::Google::Cloud::Error.from_error(e)
@@ -2312,7 +2314,6 @@ module Google
2312
2314
 
2313
2315
  @data_catalog_stub.rename_tag_template_field_enum_value request, options do |result, operation|
2314
2316
  yield result, operation if block_given?
2315
- return result
2316
2317
  end
2317
2318
  rescue ::Gapic::Rest::Error => e
2318
2319
  raise ::Google::Cloud::Error.from_error(e)
@@ -2400,7 +2401,6 @@ module Google
2400
2401
 
2401
2402
  @data_catalog_stub.delete_tag_template_field request, options do |result, operation|
2402
2403
  yield result, operation if block_given?
2403
- return result
2404
2404
  end
2405
2405
  rescue ::Gapic::Rest::Error => e
2406
2406
  raise ::Google::Cloud::Error.from_error(e)
@@ -2498,7 +2498,6 @@ module Google
2498
2498
 
2499
2499
  @data_catalog_stub.create_tag request, options do |result, operation|
2500
2500
  yield result, operation if block_given?
2501
- return result
2502
2501
  end
2503
2502
  rescue ::Gapic::Rest::Error => e
2504
2503
  raise ::Google::Cloud::Error.from_error(e)
@@ -2584,7 +2583,6 @@ module Google
2584
2583
 
2585
2584
  @data_catalog_stub.update_tag request, options do |result, operation|
2586
2585
  yield result, operation if block_given?
2587
- return result
2588
2586
  end
2589
2587
  rescue ::Gapic::Rest::Error => e
2590
2588
  raise ::Google::Cloud::Error.from_error(e)
@@ -2663,7 +2661,6 @@ module Google
2663
2661
 
2664
2662
  @data_catalog_stub.delete_tag request, options do |result, operation|
2665
2663
  yield result, operation if block_given?
2666
- return result
2667
2664
  end
2668
2665
  rescue ::Gapic::Rest::Error => e
2669
2666
  raise ::Google::Cloud::Error.from_error(e)
@@ -2758,7 +2755,7 @@ module Google
2758
2755
  @data_catalog_stub.list_tags request, options do |result, operation|
2759
2756
  result = ::Gapic::Rest::PagedEnumerable.new @data_catalog_stub, :list_tags, "tags", request, result, options
2760
2757
  yield result, operation if block_given?
2761
- return result
2758
+ throw :response, result
2762
2759
  end
2763
2760
  rescue ::Gapic::Rest::Error => e
2764
2761
  raise ::Google::Cloud::Error.from_error(e)
@@ -2868,7 +2865,7 @@ module Google
2868
2865
  @data_catalog_stub.reconcile_tags request, options do |result, operation|
2869
2866
  result = ::Gapic::Operation.new result, @operations_client, options: options
2870
2867
  yield result, operation if block_given?
2871
- return result
2868
+ throw :response, result
2872
2869
  end
2873
2870
  rescue ::Gapic::Rest::Error => e
2874
2871
  raise ::Google::Cloud::Error.from_error(e)
@@ -2948,7 +2945,6 @@ module Google
2948
2945
 
2949
2946
  @data_catalog_stub.star_entry request, options do |result, operation|
2950
2947
  yield result, operation if block_given?
2951
- return result
2952
2948
  end
2953
2949
  rescue ::Gapic::Rest::Error => e
2954
2950
  raise ::Google::Cloud::Error.from_error(e)
@@ -3028,7 +3024,6 @@ module Google
3028
3024
 
3029
3025
  @data_catalog_stub.unstar_entry request, options do |result, operation|
3030
3026
  yield result, operation if block_given?
3031
- return result
3032
3027
  end
3033
3028
  rescue ::Gapic::Rest::Error => e
3034
3029
  raise ::Google::Cloud::Error.from_error(e)
@@ -3135,7 +3130,6 @@ module Google
3135
3130
 
3136
3131
  @data_catalog_stub.set_iam_policy request, options do |result, operation|
3137
3132
  yield result, operation if block_given?
3138
- return result
3139
3133
  end
3140
3134
  rescue ::Gapic::Rest::Error => e
3141
3135
  raise ::Google::Cloud::Error.from_error(e)
@@ -3238,7 +3232,6 @@ module Google
3238
3232
 
3239
3233
  @data_catalog_stub.get_iam_policy request, options do |result, operation|
3240
3234
  yield result, operation if block_given?
3241
- return result
3242
3235
  end
3243
3236
  rescue ::Gapic::Rest::Error => e
3244
3237
  raise ::Google::Cloud::Error.from_error(e)
@@ -3336,7 +3329,6 @@ module Google
3336
3329
 
3337
3330
  @data_catalog_stub.test_iam_permissions request, options do |result, operation|
3338
3331
  yield result, operation if block_given?
3339
- return result
3340
3332
  end
3341
3333
  rescue ::Gapic::Rest::Error => e
3342
3334
  raise ::Google::Cloud::Error.from_error(e)
@@ -3445,7 +3437,7 @@ module Google
3445
3437
  @data_catalog_stub.import_entries request, options do |result, operation|
3446
3438
  result = ::Gapic::Operation.new result, @operations_client, options: options
3447
3439
  yield result, operation if block_given?
3448
- return result
3440
+ throw :response, result
3449
3441
  end
3450
3442
  rescue ::Gapic::Rest::Error => e
3451
3443
  raise ::Google::Cloud::Error.from_error(e)
@@ -3529,7 +3521,6 @@ module Google
3529
3521
 
3530
3522
  @data_catalog_stub.set_config request, options do |result, operation|
3531
3523
  yield result, operation if block_given?
3532
- return result
3533
3524
  end
3534
3525
  rescue ::Gapic::Rest::Error => e
3535
3526
  raise ::Google::Cloud::Error.from_error(e)
@@ -3610,7 +3601,6 @@ module Google
3610
3601
 
3611
3602
  @data_catalog_stub.retrieve_config request, options do |result, operation|
3612
3603
  yield result, operation if block_given?
3613
- return result
3614
3604
  end
3615
3605
  rescue ::Gapic::Rest::Error => e
3616
3606
  raise ::Google::Cloud::Error.from_error(e)
@@ -3693,7 +3683,6 @@ module Google
3693
3683
 
3694
3684
  @data_catalog_stub.retrieve_effective_config request, options do |result, operation|
3695
3685
  yield result, operation if block_given?
3696
- return result
3697
3686
  end
3698
3687
  rescue ::Gapic::Rest::Error => e
3699
3688
  raise ::Google::Cloud::Error.from_error(e)
@@ -3773,6 +3762,11 @@ module Google
3773
3762
  # default endpoint URL. The default value of nil uses the environment
3774
3763
  # universe (usually the default "googleapis.com" universe).
3775
3764
  # @return [::String,nil]
3765
+ # @!attribute [rw] logger
3766
+ # A custom logger to use for request/response debug logging, or the value
3767
+ # `:default` (the default) to construct a default logger, or `nil` to
3768
+ # explicitly disable logging.
3769
+ # @return [::Logger,:default,nil]
3776
3770
  #
3777
3771
  class Configuration
3778
3772
  extend ::Gapic::Config
@@ -3794,6 +3788,7 @@ module Google
3794
3788
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3795
3789
  config_attr :quota_project, nil, ::String, nil
3796
3790
  config_attr :universe_domain, nil, ::String, nil
3791
+ config_attr :logger, :default, ::Logger, nil, :default
3797
3792
 
3798
3793
  # @private
3799
3794
  def initialize parent_config = nil
@@ -196,7 +196,7 @@ module Google
196
196
  @operations_stub.list_operations request, options do |result, operation|
197
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
198
  yield result, operation if block_given?
199
- return result
199
+ throw :response, result
200
200
  end
201
201
  rescue ::Gapic::Rest::Error => e
202
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -285,7 +285,7 @@ module Google
285
285
  @operations_stub.get_operation request, options do |result, operation|
286
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
287
287
  yield result, operation if block_given?
288
- return result
288
+ throw :response, result
289
289
  end
290
290
  rescue ::Gapic::Rest::Error => e
291
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +367,6 @@ module Google
367
367
 
368
368
  @operations_stub.delete_operation request, options do |result, operation|
369
369
  yield result, operation if block_given?
370
- return result
371
370
  end
372
371
  rescue ::Gapic::Rest::Error => e
373
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -536,6 +534,11 @@ module Google
536
534
  # default endpoint URL. The default value of nil uses the environment
537
535
  # universe (usually the default "googleapis.com" universe).
538
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]
539
542
  #
540
543
  class Configuration
541
544
  extend ::Gapic::Config
@@ -557,6 +560,7 @@ module Google
557
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
561
  config_attr :quota_project, nil, ::String, nil
559
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
560
564
 
561
565
  # @private
562
566
  def initialize parent_config = nil
@@ -676,16 +680,18 @@ module Google
676
680
 
677
681
  response = @client_stub.make_http_request(
678
682
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
682
687
  options: options
683
688
  )
684
689
  operation = ::Gapic::Rest::TransportOperation.new response
685
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
689
695
  end
690
696
 
691
697
  ##
@@ -714,16 +720,18 @@ module Google
714
720
 
715
721
  response = @client_stub.make_http_request(
716
722
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
720
727
  options: options
721
728
  )
722
729
  operation = ::Gapic::Rest::TransportOperation.new response
723
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
727
735
  end
728
736
 
729
737
  ##
@@ -752,16 +760,18 @@ module Google
752
760
 
753
761
  response = @client_stub.make_http_request(
754
762
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
758
767
  options: options
759
768
  )
760
769
  operation = ::Gapic::Rest::TransportOperation.new response
761
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
765
775
  end
766
776
 
767
777
  ##
@@ -790,16 +800,18 @@ module Google
790
800
 
791
801
  response = @client_stub.make_http_request(
792
802
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
796
807
  options: options
797
808
  )
798
809
  operation = ::Gapic::Rest::TransportOperation.new response
799
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
803
815
  end
804
816
 
805
817
  ##