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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c4909dbf7199051fed8dcd1a3ebea3a561bdf7bdd6997b06be1e032ad5f2841
4
- data.tar.gz: 4d1594926bf7f367c14dff3de0151bcc26d5dc21367a922dd08e0ecb538f98e1
3
+ metadata.gz: b421184033a18c9e7533cd2a46a8ded13aa65f70feef15f6a91a9945e32fdf4c
4
+ data.tar.gz: c225cde40b37bfffe60d714a32c8ac4d7863a6ee0c9f738ed9cbd6332c41c420
5
5
  SHA512:
6
- metadata.gz: 3ab5b4c1369fb694459b1d941e58b69f5c982c38591e42b7831b5a35a22bd0ea2e063d64144af44182568c5d7f152a1a2009753d7834d96edb14f4e5b2a5569e
7
- data.tar.gz: 7ebc6b181a41f6ee0fd2d356748d1a5465447e5b99f2e411bb0607d30a013f5ef1176c57d42d7f7c01387d34344b838f60a70bdd6d311065806febb34d7a921e
6
+ metadata.gz: 0af6417b5c6f8b587963e5f0c7122c89ab7ba6544d4cbeac8c5e8be867b0c665f33a4a33f540b9b9edfc5b9de2bfd574f8ce615a870af6b7e301e4189273f5ee
7
+ data.tar.gz: 52990513996a10b516e75a1f57d9bdc09e1b2d04a9f263def6c08c9b1042a1e1cfc637601aa4f5105058b6b1c6a255350cda20969d6aad867d3243e57edcd94f
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/access-context-manager/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- 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)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/identity/access_context_manager/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Identity::AccessContextManager::V1::AccessContextManager::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -176,8 +176,19 @@ module Google
176
176
  universe_domain: @config.universe_domain,
177
177
  channel_args: @config.channel_args,
178
178
  interceptors: @config.interceptors,
179
- channel_pool_config: @config.channel_pool
179
+ channel_pool_config: @config.channel_pool,
180
+ logger: @config.logger
180
181
  )
182
+
183
+ @access_context_manager_stub.stub_logger&.info do |entry|
184
+ entry.set_system_name
185
+ entry.set_service
186
+ entry.message = "Created client for #{entry.service}"
187
+ entry.set_credentials_fields credentials
188
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
189
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
190
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
191
+ end
181
192
  end
182
193
 
183
194
  ##
@@ -187,6 +198,15 @@ module Google
187
198
  #
188
199
  attr_reader :operations_client
189
200
 
201
+ ##
202
+ # The logger used for request/response debug logging.
203
+ #
204
+ # @return [Logger]
205
+ #
206
+ def logger
207
+ @access_context_manager_stub.logger
208
+ end
209
+
190
210
  # Service calls
191
211
 
192
212
  ##
@@ -277,7 +297,7 @@ module Google
277
297
  @access_context_manager_stub.call_rpc :list_access_policies, request, options: options do |response, operation|
278
298
  response = ::Gapic::PagedEnumerable.new @access_context_manager_stub, :list_access_policies, request, response, operation, options
279
299
  yield response, operation if block_given?
280
- return response
300
+ throw :response, response
281
301
  end
282
302
  rescue ::GRPC::BadStatus => e
283
303
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,7 +386,6 @@ module Google
366
386
 
367
387
  @access_context_manager_stub.call_rpc :get_access_policy, request, options: options do |response, operation|
368
388
  yield response, operation if block_given?
369
- return response
370
389
  end
371
390
  rescue ::GRPC::BadStatus => e
372
391
  raise ::Google::Cloud::Error.from_error(e)
@@ -487,7 +506,7 @@ module Google
487
506
  @access_context_manager_stub.call_rpc :create_access_policy, request, options: options do |response, operation|
488
507
  response = ::Gapic::Operation.new response, @operations_client, options: options
489
508
  yield response, operation if block_given?
490
- return response
509
+ throw :response, response
491
510
  end
492
511
  rescue ::GRPC::BadStatus => e
493
512
  raise ::Google::Cloud::Error.from_error(e)
@@ -588,7 +607,7 @@ module Google
588
607
  @access_context_manager_stub.call_rpc :update_access_policy, request, options: options do |response, operation|
589
608
  response = ::Gapic::Operation.new response, @operations_client, options: options
590
609
  yield response, operation if block_given?
591
- return response
610
+ throw :response, response
592
611
  end
593
612
  rescue ::GRPC::BadStatus => e
594
613
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,7 +707,7 @@ module Google
688
707
  @access_context_manager_stub.call_rpc :delete_access_policy, request, options: options do |response, operation|
689
708
  response = ::Gapic::Operation.new response, @operations_client, options: options
690
709
  yield response, operation if block_given?
691
- return response
710
+ throw :response, response
692
711
  end
693
712
  rescue ::GRPC::BadStatus => e
694
713
  raise ::Google::Cloud::Error.from_error(e)
@@ -797,7 +816,7 @@ module Google
797
816
  @access_context_manager_stub.call_rpc :list_access_levels, request, options: options do |response, operation|
798
817
  response = ::Gapic::PagedEnumerable.new @access_context_manager_stub, :list_access_levels, request, response, operation, options
799
818
  yield response, operation if block_given?
800
- return response
819
+ throw :response, response
801
820
  end
802
821
  rescue ::GRPC::BadStatus => e
803
822
  raise ::Google::Cloud::Error.from_error(e)
@@ -898,7 +917,6 @@ module Google
898
917
 
899
918
  @access_context_manager_stub.call_rpc :get_access_level, request, options: options do |response, operation|
900
919
  yield response, operation if block_given?
901
- return response
902
920
  end
903
921
  rescue ::GRPC::BadStatus => e
904
922
  raise ::Google::Cloud::Error.from_error(e)
@@ -1007,7 +1025,7 @@ module Google
1007
1025
  @access_context_manager_stub.call_rpc :create_access_level, request, options: options do |response, operation|
1008
1026
  response = ::Gapic::Operation.new response, @operations_client, options: options
1009
1027
  yield response, operation if block_given?
1010
- return response
1028
+ throw :response, response
1011
1029
  end
1012
1030
  rescue ::GRPC::BadStatus => e
1013
1031
  raise ::Google::Cloud::Error.from_error(e)
@@ -1114,7 +1132,7 @@ module Google
1114
1132
  @access_context_manager_stub.call_rpc :update_access_level, request, options: options do |response, operation|
1115
1133
  response = ::Gapic::Operation.new response, @operations_client, options: options
1116
1134
  yield response, operation if block_given?
1117
- return response
1135
+ throw :response, response
1118
1136
  end
1119
1137
  rescue ::GRPC::BadStatus => e
1120
1138
  raise ::Google::Cloud::Error.from_error(e)
@@ -1217,7 +1235,7 @@ module Google
1217
1235
  @access_context_manager_stub.call_rpc :delete_access_level, request, options: options do |response, operation|
1218
1236
  response = ::Gapic::Operation.new response, @operations_client, options: options
1219
1237
  yield response, operation if block_given?
1220
- return response
1238
+ throw :response, response
1221
1239
  end
1222
1240
  rescue ::GRPC::BadStatus => e
1223
1241
  raise ::Google::Cloud::Error.from_error(e)
@@ -1346,7 +1364,7 @@ module Google
1346
1364
  @access_context_manager_stub.call_rpc :replace_access_levels, request, options: options do |response, operation|
1347
1365
  response = ::Gapic::Operation.new response, @operations_client, options: options
1348
1366
  yield response, operation if block_given?
1349
- return response
1367
+ throw :response, response
1350
1368
  end
1351
1369
  rescue ::GRPC::BadStatus => e
1352
1370
  raise ::Google::Cloud::Error.from_error(e)
@@ -1451,7 +1469,7 @@ module Google
1451
1469
  @access_context_manager_stub.call_rpc :list_service_perimeters, request, options: options do |response, operation|
1452
1470
  response = ::Gapic::PagedEnumerable.new @access_context_manager_stub, :list_service_perimeters, request, response, operation, options
1453
1471
  yield response, operation if block_given?
1454
- return response
1472
+ throw :response, response
1455
1473
  end
1456
1474
  rescue ::GRPC::BadStatus => e
1457
1475
  raise ::Google::Cloud::Error.from_error(e)
@@ -1543,7 +1561,6 @@ module Google
1543
1561
 
1544
1562
  @access_context_manager_stub.call_rpc :get_service_perimeter, request, options: options do |response, operation|
1545
1563
  yield response, operation if block_given?
1546
- return response
1547
1564
  end
1548
1565
  rescue ::GRPC::BadStatus => e
1549
1566
  raise ::Google::Cloud::Error.from_error(e)
@@ -1653,7 +1670,7 @@ module Google
1653
1670
  @access_context_manager_stub.call_rpc :create_service_perimeter, request, options: options do |response, operation|
1654
1671
  response = ::Gapic::Operation.new response, @operations_client, options: options
1655
1672
  yield response, operation if block_given?
1656
- return response
1673
+ throw :response, response
1657
1674
  end
1658
1675
  rescue ::GRPC::BadStatus => e
1659
1676
  raise ::Google::Cloud::Error.from_error(e)
@@ -1757,7 +1774,7 @@ module Google
1757
1774
  @access_context_manager_stub.call_rpc :update_service_perimeter, request, options: options do |response, operation|
1758
1775
  response = ::Gapic::Operation.new response, @operations_client, options: options
1759
1776
  yield response, operation if block_given?
1760
- return response
1777
+ throw :response, response
1761
1778
  end
1762
1779
  rescue ::GRPC::BadStatus => e
1763
1780
  raise ::Google::Cloud::Error.from_error(e)
@@ -1860,7 +1877,7 @@ module Google
1860
1877
  @access_context_manager_stub.call_rpc :delete_service_perimeter, request, options: options do |response, operation|
1861
1878
  response = ::Gapic::Operation.new response, @operations_client, options: options
1862
1879
  yield response, operation if block_given?
1863
- return response
1880
+ throw :response, response
1864
1881
  end
1865
1882
  rescue ::GRPC::BadStatus => e
1866
1883
  raise ::Google::Cloud::Error.from_error(e)
@@ -1985,7 +2002,7 @@ module Google
1985
2002
  @access_context_manager_stub.call_rpc :replace_service_perimeters, request, options: options do |response, operation|
1986
2003
  response = ::Gapic::Operation.new response, @operations_client, options: options
1987
2004
  yield response, operation if block_given?
1988
- return response
2005
+ throw :response, response
1989
2006
  end
1990
2007
  rescue ::GRPC::BadStatus => e
1991
2008
  raise ::Google::Cloud::Error.from_error(e)
@@ -2107,7 +2124,7 @@ module Google
2107
2124
  @access_context_manager_stub.call_rpc :commit_service_perimeters, request, options: options do |response, operation|
2108
2125
  response = ::Gapic::Operation.new response, @operations_client, options: options
2109
2126
  yield response, operation if block_given?
2110
- return response
2127
+ throw :response, response
2111
2128
  end
2112
2129
  rescue ::GRPC::BadStatus => e
2113
2130
  raise ::Google::Cloud::Error.from_error(e)
@@ -2208,7 +2225,7 @@ module Google
2208
2225
  @access_context_manager_stub.call_rpc :list_gcp_user_access_bindings, request, options: options do |response, operation|
2209
2226
  response = ::Gapic::PagedEnumerable.new @access_context_manager_stub, :list_gcp_user_access_bindings, request, response, operation, options
2210
2227
  yield response, operation if block_given?
2211
- return response
2228
+ throw :response, response
2212
2229
  end
2213
2230
  rescue ::GRPC::BadStatus => e
2214
2231
  raise ::Google::Cloud::Error.from_error(e)
@@ -2296,7 +2313,6 @@ module Google
2296
2313
 
2297
2314
  @access_context_manager_stub.call_rpc :get_gcp_user_access_binding, request, options: options do |response, operation|
2298
2315
  yield response, operation if block_given?
2299
- return response
2300
2316
  end
2301
2317
  rescue ::GRPC::BadStatus => e
2302
2318
  raise ::Google::Cloud::Error.from_error(e)
@@ -2402,7 +2418,7 @@ module Google
2402
2418
  @access_context_manager_stub.call_rpc :create_gcp_user_access_binding, request, options: options do |response, operation|
2403
2419
  response = ::Gapic::Operation.new response, @operations_client, options: options
2404
2420
  yield response, operation if block_given?
2405
- return response
2421
+ throw :response, response
2406
2422
  end
2407
2423
  rescue ::GRPC::BadStatus => e
2408
2424
  raise ::Google::Cloud::Error.from_error(e)
@@ -2508,7 +2524,7 @@ module Google
2508
2524
  @access_context_manager_stub.call_rpc :update_gcp_user_access_binding, request, options: options do |response, operation|
2509
2525
  response = ::Gapic::Operation.new response, @operations_client, options: options
2510
2526
  yield response, operation if block_given?
2511
- return response
2527
+ throw :response, response
2512
2528
  end
2513
2529
  rescue ::GRPC::BadStatus => e
2514
2530
  raise ::Google::Cloud::Error.from_error(e)
@@ -2606,7 +2622,7 @@ module Google
2606
2622
  @access_context_manager_stub.call_rpc :delete_gcp_user_access_binding, request, options: options do |response, operation|
2607
2623
  response = ::Gapic::Operation.new response, @operations_client, options: options
2608
2624
  yield response, operation if block_given?
2609
- return response
2625
+ throw :response, response
2610
2626
  end
2611
2627
  rescue ::GRPC::BadStatus => e
2612
2628
  raise ::Google::Cloud::Error.from_error(e)
@@ -2709,7 +2725,6 @@ module Google
2709
2725
 
2710
2726
  @access_context_manager_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
2711
2727
  yield response, operation if block_given?
2712
- return response
2713
2728
  end
2714
2729
  rescue ::GRPC::BadStatus => e
2715
2730
  raise ::Google::Cloud::Error.from_error(e)
@@ -2800,7 +2815,6 @@ module Google
2800
2815
 
2801
2816
  @access_context_manager_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
2802
2817
  yield response, operation if block_given?
2803
- return response
2804
2818
  end
2805
2819
  rescue ::GRPC::BadStatus => e
2806
2820
  raise ::Google::Cloud::Error.from_error(e)
@@ -2897,7 +2911,6 @@ module Google
2897
2911
 
2898
2912
  @access_context_manager_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
2899
2913
  yield response, operation if block_given?
2900
- return response
2901
2914
  end
2902
2915
  rescue ::GRPC::BadStatus => e
2903
2916
  raise ::Google::Cloud::Error.from_error(e)
@@ -2986,6 +2999,11 @@ module Google
2986
2999
  # default endpoint URL. The default value of nil uses the environment
2987
3000
  # universe (usually the default "googleapis.com" universe).
2988
3001
  # @return [::String,nil]
3002
+ # @!attribute [rw] logger
3003
+ # A custom logger to use for request/response debug logging, or the value
3004
+ # `:default` (the default) to construct a default logger, or `nil` to
3005
+ # explicitly disable logging.
3006
+ # @return [::Logger,:default,nil]
2989
3007
  #
2990
3008
  class Configuration
2991
3009
  extend ::Gapic::Config
@@ -3010,6 +3028,7 @@ module Google
3010
3028
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3011
3029
  config_attr :quota_project, nil, ::String, nil
3012
3030
  config_attr :universe_domain, nil, ::String, nil
3031
+ config_attr :logger, :default, ::Logger, nil, :default
3013
3032
 
3014
3033
  # @private
3015
3034
  def initialize parent_config = nil
@@ -213,7 +213,7 @@ module Google
213
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
214
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
215
215
  yield response, operation if block_given?
216
- return response
216
+ throw :response, response
217
217
  end
218
218
  rescue ::GRPC::BadStatus => e
219
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -309,7 +309,7 @@ module Google
309
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
310
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
311
311
  yield response, operation if block_given?
312
- return response
312
+ throw :response, response
313
313
  end
314
314
  rescue ::GRPC::BadStatus => e
315
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +398,6 @@ module Google
398
398
 
399
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
400
400
  yield response, operation if block_given?
401
- return response
402
401
  end
403
402
  rescue ::GRPC::BadStatus => e
404
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,7 +590,7 @@ module Google
592
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
593
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
594
592
  yield response, operation if block_given?
595
- return response
593
+ throw :response, response
596
594
  end
597
595
  rescue ::GRPC::BadStatus => e
598
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -681,6 +679,11 @@ module Google
681
679
  # default endpoint URL. The default value of nil uses the environment
682
680
  # universe (usually the default "googleapis.com" universe).
683
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
684
687
  #
685
688
  class Configuration
686
689
  extend ::Gapic::Config
@@ -705,6 +708,7 @@ module Google
705
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
709
  config_attr :quota_project, nil, ::String, nil
707
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
708
712
 
709
713
  # @private
710
714
  def initialize parent_config = nil