google-identity-access_context_manager-v1 0.8.1 → 0.9.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.
@@ -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
@@ -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
  ##