google-identity-access_context_manager-v1 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -169,8 +169,19 @@ module Google
169
169
  endpoint: @config.endpoint,
170
170
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
171
171
  universe_domain: @config.universe_domain,
172
- credentials: credentials
172
+ credentials: credentials,
173
+ logger: @config.logger
173
174
  )
175
+
176
+ @access_context_manager_stub.logger(stub: true)&.info do |entry|
177
+ entry.set_system_name
178
+ entry.set_service
179
+ entry.message = "Created client for #{entry.service}"
180
+ entry.set_credentials_fields credentials
181
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
182
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
183
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
184
+ end
174
185
  end
175
186
 
176
187
  ##
@@ -180,6 +191,15 @@ module Google
180
191
  #
181
192
  attr_reader :operations_client
182
193
 
194
+ ##
195
+ # The logger used for request/response debug logging.
196
+ #
197
+ # @return [Logger]
198
+ #
199
+ def logger
200
+ @access_context_manager_stub.logger
201
+ end
202
+
183
203
  # Service calls
184
204
 
185
205
  ##
@@ -271,7 +291,7 @@ module Google
271
291
  @access_context_manager_stub.list_access_policies request, options do |result, operation|
272
292
  result = ::Gapic::Rest::PagedEnumerable.new @access_context_manager_stub, :list_access_policies, "access_policies", request, result, options
273
293
  yield result, operation if block_given?
274
- return result
294
+ throw :response, result
275
295
  end
276
296
  rescue ::Gapic::Rest::Error => e
277
297
  raise ::Google::Cloud::Error.from_error(e)
@@ -353,7 +373,6 @@ module Google
353
373
 
354
374
  @access_context_manager_stub.get_access_policy request, options do |result, operation|
355
375
  yield result, operation if block_given?
356
- return result
357
376
  end
358
377
  rescue ::Gapic::Rest::Error => e
359
378
  raise ::Google::Cloud::Error.from_error(e)
@@ -475,7 +494,7 @@ module Google
475
494
  @access_context_manager_stub.create_access_policy request, options do |result, operation|
476
495
  result = ::Gapic::Operation.new result, @operations_client, options: options
477
496
  yield result, operation if block_given?
478
- return result
497
+ throw :response, result
479
498
  end
480
499
  rescue ::Gapic::Rest::Error => e
481
500
  raise ::Google::Cloud::Error.from_error(e)
@@ -569,7 +588,7 @@ module Google
569
588
  @access_context_manager_stub.update_access_policy request, options do |result, operation|
570
589
  result = ::Gapic::Operation.new result, @operations_client, options: options
571
590
  yield result, operation if block_given?
572
- return result
591
+ throw :response, result
573
592
  end
574
593
  rescue ::Gapic::Rest::Error => e
575
594
  raise ::Google::Cloud::Error.from_error(e)
@@ -662,7 +681,7 @@ module Google
662
681
  @access_context_manager_stub.delete_access_policy request, options do |result, operation|
663
682
  result = ::Gapic::Operation.new result, @operations_client, options: options
664
683
  yield result, operation if block_given?
665
- return result
684
+ throw :response, result
666
685
  end
667
686
  rescue ::Gapic::Rest::Error => e
668
687
  raise ::Google::Cloud::Error.from_error(e)
@@ -764,7 +783,7 @@ module Google
764
783
  @access_context_manager_stub.list_access_levels request, options do |result, operation|
765
784
  result = ::Gapic::Rest::PagedEnumerable.new @access_context_manager_stub, :list_access_levels, "access_levels", request, result, options
766
785
  yield result, operation if block_given?
767
- return result
786
+ throw :response, result
768
787
  end
769
788
  rescue ::Gapic::Rest::Error => e
770
789
  raise ::Google::Cloud::Error.from_error(e)
@@ -858,7 +877,6 @@ module Google
858
877
 
859
878
  @access_context_manager_stub.get_access_level request, options do |result, operation|
860
879
  yield result, operation if block_given?
861
- return result
862
880
  end
863
881
  rescue ::Gapic::Rest::Error => e
864
882
  raise ::Google::Cloud::Error.from_error(e)
@@ -960,7 +978,7 @@ module Google
960
978
  @access_context_manager_stub.create_access_level request, options do |result, operation|
961
979
  result = ::Gapic::Operation.new result, @operations_client, options: options
962
980
  yield result, operation if block_given?
963
- return result
981
+ throw :response, result
964
982
  end
965
983
  rescue ::Gapic::Rest::Error => e
966
984
  raise ::Google::Cloud::Error.from_error(e)
@@ -1060,7 +1078,7 @@ module Google
1060
1078
  @access_context_manager_stub.update_access_level request, options do |result, operation|
1061
1079
  result = ::Gapic::Operation.new result, @operations_client, options: options
1062
1080
  yield result, operation if block_given?
1063
- return result
1081
+ throw :response, result
1064
1082
  end
1065
1083
  rescue ::Gapic::Rest::Error => e
1066
1084
  raise ::Google::Cloud::Error.from_error(e)
@@ -1156,7 +1174,7 @@ module Google
1156
1174
  @access_context_manager_stub.delete_access_level request, options do |result, operation|
1157
1175
  result = ::Gapic::Operation.new result, @operations_client, options: options
1158
1176
  yield result, operation if block_given?
1159
- return result
1177
+ throw :response, result
1160
1178
  end
1161
1179
  rescue ::Gapic::Rest::Error => e
1162
1180
  raise ::Google::Cloud::Error.from_error(e)
@@ -1278,7 +1296,7 @@ module Google
1278
1296
  @access_context_manager_stub.replace_access_levels request, options do |result, operation|
1279
1297
  result = ::Gapic::Operation.new result, @operations_client, options: options
1280
1298
  yield result, operation if block_given?
1281
- return result
1299
+ throw :response, result
1282
1300
  end
1283
1301
  rescue ::Gapic::Rest::Error => e
1284
1302
  raise ::Google::Cloud::Error.from_error(e)
@@ -1376,7 +1394,7 @@ module Google
1376
1394
  @access_context_manager_stub.list_service_perimeters request, options do |result, operation|
1377
1395
  result = ::Gapic::Rest::PagedEnumerable.new @access_context_manager_stub, :list_service_perimeters, "service_perimeters", request, result, options
1378
1396
  yield result, operation if block_given?
1379
- return result
1397
+ throw :response, result
1380
1398
  end
1381
1399
  rescue ::Gapic::Rest::Error => e
1382
1400
  raise ::Google::Cloud::Error.from_error(e)
@@ -1461,7 +1479,6 @@ module Google
1461
1479
 
1462
1480
  @access_context_manager_stub.get_service_perimeter request, options do |result, operation|
1463
1481
  yield result, operation if block_given?
1464
- return result
1465
1482
  end
1466
1483
  rescue ::Gapic::Rest::Error => e
1467
1484
  raise ::Google::Cloud::Error.from_error(e)
@@ -1564,7 +1581,7 @@ module Google
1564
1581
  @access_context_manager_stub.create_service_perimeter request, options do |result, operation|
1565
1582
  result = ::Gapic::Operation.new result, @operations_client, options: options
1566
1583
  yield result, operation if block_given?
1567
- return result
1584
+ throw :response, result
1568
1585
  end
1569
1586
  rescue ::Gapic::Rest::Error => e
1570
1587
  raise ::Google::Cloud::Error.from_error(e)
@@ -1661,7 +1678,7 @@ module Google
1661
1678
  @access_context_manager_stub.update_service_perimeter request, options do |result, operation|
1662
1679
  result = ::Gapic::Operation.new result, @operations_client, options: options
1663
1680
  yield result, operation if block_given?
1664
- return result
1681
+ throw :response, result
1665
1682
  end
1666
1683
  rescue ::Gapic::Rest::Error => e
1667
1684
  raise ::Google::Cloud::Error.from_error(e)
@@ -1757,7 +1774,7 @@ module Google
1757
1774
  @access_context_manager_stub.delete_service_perimeter request, options do |result, operation|
1758
1775
  result = ::Gapic::Operation.new result, @operations_client, options: options
1759
1776
  yield result, operation if block_given?
1760
- return result
1777
+ throw :response, result
1761
1778
  end
1762
1779
  rescue ::Gapic::Rest::Error => e
1763
1780
  raise ::Google::Cloud::Error.from_error(e)
@@ -1875,7 +1892,7 @@ module Google
1875
1892
  @access_context_manager_stub.replace_service_perimeters request, options do |result, operation|
1876
1893
  result = ::Gapic::Operation.new result, @operations_client, options: options
1877
1894
  yield result, operation if block_given?
1878
- return result
1895
+ throw :response, result
1879
1896
  end
1880
1897
  rescue ::Gapic::Rest::Error => e
1881
1898
  raise ::Google::Cloud::Error.from_error(e)
@@ -1990,7 +2007,7 @@ module Google
1990
2007
  @access_context_manager_stub.commit_service_perimeters request, options do |result, operation|
1991
2008
  result = ::Gapic::Operation.new result, @operations_client, options: options
1992
2009
  yield result, operation if block_given?
1993
- return result
2010
+ throw :response, result
1994
2011
  end
1995
2012
  rescue ::Gapic::Rest::Error => e
1996
2013
  raise ::Google::Cloud::Error.from_error(e)
@@ -2084,7 +2101,7 @@ module Google
2084
2101
  @access_context_manager_stub.list_gcp_user_access_bindings request, options do |result, operation|
2085
2102
  result = ::Gapic::Rest::PagedEnumerable.new @access_context_manager_stub, :list_gcp_user_access_bindings, "gcp_user_access_bindings", request, result, options
2086
2103
  yield result, operation if block_given?
2087
- return result
2104
+ throw :response, result
2088
2105
  end
2089
2106
  rescue ::Gapic::Rest::Error => e
2090
2107
  raise ::Google::Cloud::Error.from_error(e)
@@ -2165,7 +2182,6 @@ module Google
2165
2182
 
2166
2183
  @access_context_manager_stub.get_gcp_user_access_binding request, options do |result, operation|
2167
2184
  yield result, operation if block_given?
2168
- return result
2169
2185
  end
2170
2186
  rescue ::Gapic::Rest::Error => e
2171
2187
  raise ::Google::Cloud::Error.from_error(e)
@@ -2264,7 +2280,7 @@ module Google
2264
2280
  @access_context_manager_stub.create_gcp_user_access_binding request, options do |result, operation|
2265
2281
  result = ::Gapic::Operation.new result, @operations_client, options: options
2266
2282
  yield result, operation if block_given?
2267
- return result
2283
+ throw :response, result
2268
2284
  end
2269
2285
  rescue ::Gapic::Rest::Error => e
2270
2286
  raise ::Google::Cloud::Error.from_error(e)
@@ -2363,7 +2379,7 @@ module Google
2363
2379
  @access_context_manager_stub.update_gcp_user_access_binding request, options do |result, operation|
2364
2380
  result = ::Gapic::Operation.new result, @operations_client, options: options
2365
2381
  yield result, operation if block_given?
2366
- return result
2382
+ throw :response, result
2367
2383
  end
2368
2384
  rescue ::Gapic::Rest::Error => e
2369
2385
  raise ::Google::Cloud::Error.from_error(e)
@@ -2454,7 +2470,7 @@ module Google
2454
2470
  @access_context_manager_stub.delete_gcp_user_access_binding request, options do |result, operation|
2455
2471
  result = ::Gapic::Operation.new result, @operations_client, options: options
2456
2472
  yield result, operation if block_given?
2457
- return result
2473
+ throw :response, result
2458
2474
  end
2459
2475
  rescue ::Gapic::Rest::Error => e
2460
2476
  raise ::Google::Cloud::Error.from_error(e)
@@ -2550,7 +2566,6 @@ module Google
2550
2566
 
2551
2567
  @access_context_manager_stub.set_iam_policy request, options do |result, operation|
2552
2568
  yield result, operation if block_given?
2553
- return result
2554
2569
  end
2555
2570
  rescue ::Gapic::Rest::Error => e
2556
2571
  raise ::Google::Cloud::Error.from_error(e)
@@ -2634,7 +2649,6 @@ module Google
2634
2649
 
2635
2650
  @access_context_manager_stub.get_iam_policy request, options do |result, operation|
2636
2651
  yield result, operation if block_given?
2637
- return result
2638
2652
  end
2639
2653
  rescue ::Gapic::Rest::Error => e
2640
2654
  raise ::Google::Cloud::Error.from_error(e)
@@ -2724,7 +2738,6 @@ module Google
2724
2738
 
2725
2739
  @access_context_manager_stub.test_iam_permissions request, options do |result, operation|
2726
2740
  yield result, operation if block_given?
2727
- return result
2728
2741
  end
2729
2742
  rescue ::Gapic::Rest::Error => e
2730
2743
  raise ::Google::Cloud::Error.from_error(e)
@@ -2804,6 +2817,11 @@ module Google
2804
2817
  # default endpoint URL. The default value of nil uses the environment
2805
2818
  # universe (usually the default "googleapis.com" universe).
2806
2819
  # @return [::String,nil]
2820
+ # @!attribute [rw] logger
2821
+ # A custom logger to use for request/response debug logging, or the value
2822
+ # `:default` (the default) to construct a default logger, or `nil` to
2823
+ # explicitly disable logging.
2824
+ # @return [::Logger,:default,nil]
2807
2825
  #
2808
2826
  class Configuration
2809
2827
  extend ::Gapic::Config
@@ -2825,6 +2843,7 @@ module Google
2825
2843
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2826
2844
  config_attr :quota_project, nil, ::String, nil
2827
2845
  config_attr :universe_domain, nil, ::String, nil
2846
+ config_attr :logger, :default, ::Logger, nil, :default
2828
2847
 
2829
2848
  # @private
2830
2849
  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
  ##