google-iam-v2 0.6.2 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c819f6c58cebafdc2ebb7b3b04a15d6ef6a0e3ddd4c001402eee453359c2e8e
4
- data.tar.gz: f7a104dd3d7c6efe031f1e74f69a200ee0b2f2f2265e5bcdbcd584ab2fc638d6
3
+ metadata.gz: c8a4fae3d4e18f401b0144bc76271d3b10c8c1892bb9e6d71351bcacb2d25b2a
4
+ data.tar.gz: 3cfc551e3c0cdd7950417dae678ed5db20a7c11b514f4ce86b6dbbf42a2feb9a
5
5
  SHA512:
6
- metadata.gz: 774d63b8bb700d7441c95f138b27c5f8bc155a1d5909c769396f41881cc26cf28ad0a033f3bd99ae02177006c18eabd990e6020c4aaa45370fc8839f5ba1cbbd
7
- data.tar.gz: 8b177bd609a48d7ea541f314c3726ad9cdd077dc7b28fb2f21a249618b25a696cf0b1ff73e4f41355a82e7ea0161189be29c8489b891dec0b81030fb2bf9810e
6
+ metadata.gz: a1e79423f6695e8d02f09569539f082aa42863a3777f3786c1d2ce6e47d8eeba2dc40f99d543f2e2668e14d601c5da658d066b402afb9e678c712b813d2c43de
7
+ data.tar.gz: ca3bb939efe4d624427f90292089b559a2db05659479cd7921c4f011860bafb776ca67ae759580a2e5730423c08c87b4e357c321a009ec5460cec97817b532ab
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/iam)
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/iam/v2"
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::Iam::V2::Policies::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).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -186,8 +186,19 @@ module Google
186
186
  universe_domain: @config.universe_domain,
187
187
  channel_args: @config.channel_args,
188
188
  interceptors: @config.interceptors,
189
- channel_pool_config: @config.channel_pool
189
+ channel_pool_config: @config.channel_pool,
190
+ logger: @config.logger
190
191
  )
192
+
193
+ @policies_stub.stub_logger&.info do |entry|
194
+ entry.set_system_name
195
+ entry.set_service
196
+ entry.message = "Created client for #{entry.service}"
197
+ entry.set_credentials_fields credentials
198
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
199
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
200
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
201
+ end
191
202
  end
192
203
 
193
204
  ##
@@ -197,6 +208,15 @@ module Google
197
208
  #
198
209
  attr_reader :operations_client
199
210
 
211
+ ##
212
+ # The logger used for request/response debug logging.
213
+ #
214
+ # @return [Logger]
215
+ #
216
+ def logger
217
+ @policies_stub.logger
218
+ end
219
+
200
220
  # Service calls
201
221
 
202
222
  ##
@@ -305,7 +325,7 @@ module Google
305
325
  @policies_stub.call_rpc :list_policies, request, options: options do |response, operation|
306
326
  response = ::Gapic::PagedEnumerable.new @policies_stub, :list_policies, request, response, operation, options
307
327
  yield response, operation if block_given?
308
- return response
328
+ throw :response, response
309
329
  end
310
330
  rescue ::GRPC::BadStatus => e
311
331
  raise ::Google::Cloud::Error.from_error(e)
@@ -400,7 +420,6 @@ module Google
400
420
 
401
421
  @policies_stub.call_rpc :get_policy, request, options: options do |response, operation|
402
422
  yield response, operation if block_given?
403
- return response
404
423
  end
405
424
  rescue ::GRPC::BadStatus => e
406
425
  raise ::Google::Cloud::Error.from_error(e)
@@ -511,7 +530,7 @@ module Google
511
530
  @policies_stub.call_rpc :create_policy, request, options: options do |response, operation|
512
531
  response = ::Gapic::Operation.new response, @operations_client, options: options
513
532
  yield response, operation if block_given?
514
- return response
533
+ throw :response, response
515
534
  end
516
535
  rescue ::GRPC::BadStatus => e
517
536
  raise ::Google::Cloud::Error.from_error(e)
@@ -619,7 +638,7 @@ module Google
619
638
  @policies_stub.call_rpc :update_policy, request, options: options do |response, operation|
620
639
  response = ::Gapic::Operation.new response, @operations_client, options: options
621
640
  yield response, operation if block_given?
622
- return response
641
+ throw :response, response
623
642
  end
624
643
  rescue ::GRPC::BadStatus => e
625
644
  raise ::Google::Cloud::Error.from_error(e)
@@ -729,7 +748,7 @@ module Google
729
748
  @policies_stub.call_rpc :delete_policy, request, options: options do |response, operation|
730
749
  response = ::Gapic::Operation.new response, @operations_client, options: options
731
750
  yield response, operation if block_given?
732
- return response
751
+ throw :response, response
733
752
  end
734
753
  rescue ::GRPC::BadStatus => e
735
754
  raise ::Google::Cloud::Error.from_error(e)
@@ -779,6 +798,13 @@ module Google
779
798
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
780
799
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
781
800
  # * (`nil`) indicating no credentials
801
+ #
802
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
803
+ # external source for authentication to Google Cloud, you must validate it before
804
+ # providing it to a Google API client library. Providing an unvalidated credential
805
+ # configuration to Google APIs can compromise the security of your systems and data.
806
+ # For more information, refer to [Validate credential configurations from external
807
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
782
808
  # @return [::Object]
783
809
  # @!attribute [rw] scope
784
810
  # The OAuth scopes
@@ -818,6 +844,11 @@ module Google
818
844
  # default endpoint URL. The default value of nil uses the environment
819
845
  # universe (usually the default "googleapis.com" universe).
820
846
  # @return [::String,nil]
847
+ # @!attribute [rw] logger
848
+ # A custom logger to use for request/response debug logging, or the value
849
+ # `:default` (the default) to construct a default logger, or `nil` to
850
+ # explicitly disable logging.
851
+ # @return [::Logger,:default,nil]
821
852
  #
822
853
  class Configuration
823
854
  extend ::Gapic::Config
@@ -842,6 +873,7 @@ module Google
842
873
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
843
874
  config_attr :quota_project, nil, ::String, nil
844
875
  config_attr :universe_domain, nil, ::String, nil
876
+ config_attr :logger, :default, ::Logger, nil, :default
845
877
 
846
878
  # @private
847
879
  def initialize parent_config = nil
@@ -212,7 +212,7 @@ module Google
212
212
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
213
213
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
214
214
  yield response, operation if block_given?
215
- return response
215
+ throw :response, response
216
216
  end
217
217
  rescue ::GRPC::BadStatus => e
218
218
  raise ::Google::Cloud::Error.from_error(e)
@@ -308,7 +308,7 @@ module Google
308
308
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
309
309
  response = ::Gapic::Operation.new response, @operations_client, options: options
310
310
  yield response, operation if block_given?
311
- return response
311
+ throw :response, response
312
312
  end
313
313
  rescue ::GRPC::BadStatus => e
314
314
  raise ::Google::Cloud::Error.from_error(e)
@@ -397,7 +397,6 @@ module Google
397
397
 
398
398
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
399
399
  yield response, operation if block_given?
400
- return response
401
400
  end
402
401
  rescue ::GRPC::BadStatus => e
403
402
  raise ::Google::Cloud::Error.from_error(e)
@@ -493,7 +492,6 @@ module Google
493
492
 
494
493
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
495
494
  yield response, operation if block_given?
496
- return response
497
495
  end
498
496
  rescue ::GRPC::BadStatus => e
499
497
  raise ::Google::Cloud::Error.from_error(e)
@@ -591,7 +589,7 @@ module Google
591
589
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
592
590
  response = ::Gapic::Operation.new response, @operations_client, options: options
593
591
  yield response, operation if block_given?
594
- return response
592
+ throw :response, response
595
593
  end
596
594
  rescue ::GRPC::BadStatus => e
597
595
  raise ::Google::Cloud::Error.from_error(e)
@@ -641,6 +639,13 @@ module Google
641
639
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
642
640
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
643
641
  # * (`nil`) indicating no credentials
642
+ #
643
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
644
+ # external source for authentication to Google Cloud, you must validate it before
645
+ # providing it to a Google API client library. Providing an unvalidated credential
646
+ # configuration to Google APIs can compromise the security of your systems and data.
647
+ # For more information, refer to [Validate credential configurations from external
648
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
644
649
  # @return [::Object]
645
650
  # @!attribute [rw] scope
646
651
  # The OAuth scopes
@@ -680,6 +685,11 @@ module Google
680
685
  # default endpoint URL. The default value of nil uses the environment
681
686
  # universe (usually the default "googleapis.com" universe).
682
687
  # @return [::String,nil]
688
+ # @!attribute [rw] logger
689
+ # A custom logger to use for request/response debug logging, or the value
690
+ # `:default` (the default) to construct a default logger, or `nil` to
691
+ # explicitly disable logging.
692
+ # @return [::Logger,:default,nil]
683
693
  #
684
694
  class Configuration
685
695
  extend ::Gapic::Config
@@ -704,6 +714,7 @@ module Google
704
714
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
705
715
  config_attr :quota_project, nil, ::String, nil
706
716
  config_attr :universe_domain, nil, ::String, nil
717
+ config_attr :logger, :default, ::Logger, nil, :default
707
718
 
708
719
  # @private
709
720
  def initialize parent_config = nil
@@ -179,8 +179,19 @@ module Google
179
179
  endpoint: @config.endpoint,
180
180
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
181
181
  universe_domain: @config.universe_domain,
182
- credentials: credentials
182
+ credentials: credentials,
183
+ logger: @config.logger
183
184
  )
185
+
186
+ @policies_stub.logger(stub: true)&.info do |entry|
187
+ entry.set_system_name
188
+ entry.set_service
189
+ entry.message = "Created client for #{entry.service}"
190
+ entry.set_credentials_fields credentials
191
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
192
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
193
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
194
+ end
184
195
  end
185
196
 
186
197
  ##
@@ -190,6 +201,15 @@ module Google
190
201
  #
191
202
  attr_reader :operations_client
192
203
 
204
+ ##
205
+ # The logger used for request/response debug logging.
206
+ #
207
+ # @return [Logger]
208
+ #
209
+ def logger
210
+ @policies_stub.logger
211
+ end
212
+
193
213
  # Service calls
194
214
 
195
215
  ##
@@ -291,7 +311,7 @@ module Google
291
311
  @policies_stub.list_policies request, options do |result, operation|
292
312
  result = ::Gapic::Rest::PagedEnumerable.new @policies_stub, :list_policies, "policies", request, result, options
293
313
  yield result, operation if block_given?
294
- return result
314
+ throw :response, result
295
315
  end
296
316
  rescue ::Gapic::Rest::Error => e
297
317
  raise ::Google::Cloud::Error.from_error(e)
@@ -379,7 +399,6 @@ module Google
379
399
 
380
400
  @policies_stub.get_policy request, options do |result, operation|
381
401
  yield result, operation if block_given?
382
- return result
383
402
  end
384
403
  rescue ::Gapic::Rest::Error => e
385
404
  raise ::Google::Cloud::Error.from_error(e)
@@ -483,7 +502,7 @@ module Google
483
502
  @policies_stub.create_policy request, options do |result, operation|
484
503
  result = ::Gapic::Operation.new result, @operations_client, options: options
485
504
  yield result, operation if block_given?
486
- return result
505
+ throw :response, result
487
506
  end
488
507
  rescue ::Gapic::Rest::Error => e
489
508
  raise ::Google::Cloud::Error.from_error(e)
@@ -584,7 +603,7 @@ module Google
584
603
  @policies_stub.update_policy request, options do |result, operation|
585
604
  result = ::Gapic::Operation.new result, @operations_client, options: options
586
605
  yield result, operation if block_given?
587
- return result
606
+ throw :response, result
588
607
  end
589
608
  rescue ::Gapic::Rest::Error => e
590
609
  raise ::Google::Cloud::Error.from_error(e)
@@ -687,7 +706,7 @@ module Google
687
706
  @policies_stub.delete_policy request, options do |result, operation|
688
707
  result = ::Gapic::Operation.new result, @operations_client, options: options
689
708
  yield result, operation if block_given?
690
- return result
709
+ throw :response, result
691
710
  end
692
711
  rescue ::Gapic::Rest::Error => e
693
712
  raise ::Google::Cloud::Error.from_error(e)
@@ -735,6 +754,13 @@ module Google
735
754
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
736
755
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
737
756
  # * (`nil`) indicating no credentials
757
+ #
758
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
759
+ # external source for authentication to Google Cloud, you must validate it before
760
+ # providing it to a Google API client library. Providing an unvalidated credential
761
+ # configuration to Google APIs can compromise the security of your systems and data.
762
+ # For more information, refer to [Validate credential configurations from external
763
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
738
764
  # @return [::Object]
739
765
  # @!attribute [rw] scope
740
766
  # The OAuth scopes
@@ -767,6 +793,11 @@ module Google
767
793
  # default endpoint URL. The default value of nil uses the environment
768
794
  # universe (usually the default "googleapis.com" universe).
769
795
  # @return [::String,nil]
796
+ # @!attribute [rw] logger
797
+ # A custom logger to use for request/response debug logging, or the value
798
+ # `:default` (the default) to construct a default logger, or `nil` to
799
+ # explicitly disable logging.
800
+ # @return [::Logger,:default,nil]
770
801
  #
771
802
  class Configuration
772
803
  extend ::Gapic::Config
@@ -788,6 +819,7 @@ module Google
788
819
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
789
820
  config_attr :quota_project, nil, ::String, nil
790
821
  config_attr :universe_domain, nil, ::String, nil
822
+ config_attr :logger, :default, ::Logger, nil, :default
791
823
 
792
824
  # @private
793
825
  def initialize parent_config = nil
@@ -195,7 +195,7 @@ module Google
195
195
  @operations_stub.list_operations request, options do |result, operation|
196
196
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
197
197
  yield result, operation if block_given?
198
- return result
198
+ throw :response, result
199
199
  end
200
200
  rescue ::Gapic::Rest::Error => e
201
201
  raise ::Google::Cloud::Error.from_error(e)
@@ -284,7 +284,7 @@ module Google
284
284
  @operations_stub.get_operation request, options do |result, operation|
285
285
  result = ::Gapic::Operation.new result, @operations_client, options: options
286
286
  yield result, operation if block_given?
287
- return result
287
+ throw :response, result
288
288
  end
289
289
  rescue ::Gapic::Rest::Error => e
290
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,7 +366,6 @@ module Google
366
366
 
367
367
  @operations_stub.delete_operation request, options do |result, operation|
368
368
  yield result, operation if block_given?
369
- return result
370
369
  end
371
370
  rescue ::Gapic::Rest::Error => e
372
371
  raise ::Google::Cloud::Error.from_error(e)
@@ -455,7 +454,6 @@ module Google
455
454
 
456
455
  @operations_stub.cancel_operation request, options do |result, operation|
457
456
  yield result, operation if block_given?
458
- return result
459
457
  end
460
458
  rescue ::Gapic::Rest::Error => e
461
459
  raise ::Google::Cloud::Error.from_error(e)
@@ -503,6 +501,13 @@ module Google
503
501
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
504
502
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
505
503
  # * (`nil`) indicating no credentials
504
+ #
505
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
506
+ # external source for authentication to Google Cloud, you must validate it before
507
+ # providing it to a Google API client library. Providing an unvalidated credential
508
+ # configuration to Google APIs can compromise the security of your systems and data.
509
+ # For more information, refer to [Validate credential configurations from external
510
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
506
511
  # @return [::Object]
507
512
  # @!attribute [rw] scope
508
513
  # The OAuth scopes
@@ -535,6 +540,11 @@ module Google
535
540
  # default endpoint URL. The default value of nil uses the environment
536
541
  # universe (usually the default "googleapis.com" universe).
537
542
  # @return [::String,nil]
543
+ # @!attribute [rw] logger
544
+ # A custom logger to use for request/response debug logging, or the value
545
+ # `:default` (the default) to construct a default logger, or `nil` to
546
+ # explicitly disable logging.
547
+ # @return [::Logger,:default,nil]
538
548
  #
539
549
  class Configuration
540
550
  extend ::Gapic::Config
@@ -556,6 +566,7 @@ module Google
556
566
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
557
567
  config_attr :quota_project, nil, ::String, nil
558
568
  config_attr :universe_domain, nil, ::String, nil
569
+ config_attr :logger, :default, ::Logger, nil, :default
559
570
 
560
571
  # @private
561
572
  def initialize parent_config = nil
@@ -675,16 +686,18 @@ module Google
675
686
 
676
687
  response = @client_stub.make_http_request(
677
688
  verb,
678
- uri: uri,
679
- body: body || "",
680
- params: query_string_params,
689
+ uri: uri,
690
+ body: body || "",
691
+ params: query_string_params,
692
+ method_name: "list_operations",
681
693
  options: options
682
694
  )
683
695
  operation = ::Gapic::Rest::TransportOperation.new response
684
696
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
685
-
686
- yield result, operation if block_given?
687
- result
697
+ catch :response do
698
+ yield result, operation if block_given?
699
+ result
700
+ end
688
701
  end
689
702
 
690
703
  ##
@@ -713,16 +726,18 @@ module Google
713
726
 
714
727
  response = @client_stub.make_http_request(
715
728
  verb,
716
- uri: uri,
717
- body: body || "",
718
- params: query_string_params,
729
+ uri: uri,
730
+ body: body || "",
731
+ params: query_string_params,
732
+ method_name: "get_operation",
719
733
  options: options
720
734
  )
721
735
  operation = ::Gapic::Rest::TransportOperation.new response
722
736
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
723
-
724
- yield result, operation if block_given?
725
- result
737
+ catch :response do
738
+ yield result, operation if block_given?
739
+ result
740
+ end
726
741
  end
727
742
 
728
743
  ##
@@ -751,16 +766,18 @@ module Google
751
766
 
752
767
  response = @client_stub.make_http_request(
753
768
  verb,
754
- uri: uri,
755
- body: body || "",
756
- params: query_string_params,
769
+ uri: uri,
770
+ body: body || "",
771
+ params: query_string_params,
772
+ method_name: "delete_operation",
757
773
  options: options
758
774
  )
759
775
  operation = ::Gapic::Rest::TransportOperation.new response
760
776
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
761
-
762
- yield result, operation if block_given?
763
- result
777
+ catch :response do
778
+ yield result, operation if block_given?
779
+ result
780
+ end
764
781
  end
765
782
 
766
783
  ##
@@ -789,16 +806,18 @@ module Google
789
806
 
790
807
  response = @client_stub.make_http_request(
791
808
  verb,
792
- uri: uri,
793
- body: body || "",
794
- params: query_string_params,
809
+ uri: uri,
810
+ body: body || "",
811
+ params: query_string_params,
812
+ method_name: "cancel_operation",
795
813
  options: options
796
814
  )
797
815
  operation = ::Gapic::Rest::TransportOperation.new response
798
816
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
799
-
800
- yield result, operation if block_given?
801
- result
817
+ catch :response do
818
+ yield result, operation if block_given?
819
+ result
820
+ end
802
821
  end
803
822
 
804
823
  ##
@@ -29,7 +29,8 @@ module Google
29
29
  # including transcoding, making the REST call, and deserialing the response.
30
30
  #
31
31
  class ServiceStub
32
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
32
+ # @private
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
33
34
  # These require statements are intentionally placed here to initialize
34
35
  # the REST modules only when it's required.
35
36
  require "gapic/rest"
@@ -39,7 +40,9 @@ module Google
39
40
  universe_domain: universe_domain,
40
41
  credentials: credentials,
41
42
  numeric_enums: true,
42
- raise_faraday_errors: false
43
+ service_name: self.class,
44
+ raise_faraday_errors: false,
45
+ logger: logger
43
46
  end
44
47
 
45
48
  ##
@@ -60,6 +63,15 @@ module Google
60
63
  @client_stub.endpoint
61
64
  end
62
65
 
66
+ ##
67
+ # The logger used for request/response debug logging.
68
+ #
69
+ # @return [Logger]
70
+ #
71
+ def logger stub: false
72
+ stub ? @client_stub.stub_logger : @client_stub.logger
73
+ end
74
+
63
75
  ##
64
76
  # Baseline implementation for the list_policies REST call
65
77
  #
@@ -86,16 +98,18 @@ module Google
86
98
 
87
99
  response = @client_stub.make_http_request(
88
100
  verb,
89
- uri: uri,
90
- body: body || "",
91
- params: query_string_params,
101
+ uri: uri,
102
+ body: body || "",
103
+ params: query_string_params,
104
+ method_name: "list_policies",
92
105
  options: options
93
106
  )
94
107
  operation = ::Gapic::Rest::TransportOperation.new response
95
108
  result = ::Google::Iam::V2::ListPoliciesResponse.decode_json response.body, ignore_unknown_fields: true
96
-
97
- yield result, operation if block_given?
98
- result
109
+ catch :response do
110
+ yield result, operation if block_given?
111
+ result
112
+ end
99
113
  end
100
114
 
101
115
  ##
@@ -124,16 +138,18 @@ module Google
124
138
 
125
139
  response = @client_stub.make_http_request(
126
140
  verb,
127
- uri: uri,
128
- body: body || "",
129
- params: query_string_params,
141
+ uri: uri,
142
+ body: body || "",
143
+ params: query_string_params,
144
+ method_name: "get_policy",
130
145
  options: options
131
146
  )
132
147
  operation = ::Gapic::Rest::TransportOperation.new response
133
148
  result = ::Google::Iam::V2::Policy.decode_json response.body, ignore_unknown_fields: true
134
-
135
- yield result, operation if block_given?
136
- result
149
+ catch :response do
150
+ yield result, operation if block_given?
151
+ result
152
+ end
137
153
  end
138
154
 
139
155
  ##
@@ -162,16 +178,18 @@ module Google
162
178
 
163
179
  response = @client_stub.make_http_request(
164
180
  verb,
165
- uri: uri,
166
- body: body || "",
167
- params: query_string_params,
181
+ uri: uri,
182
+ body: body || "",
183
+ params: query_string_params,
184
+ method_name: "create_policy",
168
185
  options: options
169
186
  )
170
187
  operation = ::Gapic::Rest::TransportOperation.new response
171
188
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
172
-
173
- yield result, operation if block_given?
174
- result
189
+ catch :response do
190
+ yield result, operation if block_given?
191
+ result
192
+ end
175
193
  end
176
194
 
177
195
  ##
@@ -200,16 +218,18 @@ module Google
200
218
 
201
219
  response = @client_stub.make_http_request(
202
220
  verb,
203
- uri: uri,
204
- body: body || "",
205
- params: query_string_params,
221
+ uri: uri,
222
+ body: body || "",
223
+ params: query_string_params,
224
+ method_name: "update_policy",
206
225
  options: options
207
226
  )
208
227
  operation = ::Gapic::Rest::TransportOperation.new response
209
228
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
210
-
211
- yield result, operation if block_given?
212
- result
229
+ catch :response do
230
+ yield result, operation if block_given?
231
+ result
232
+ end
213
233
  end
214
234
 
215
235
  ##
@@ -238,16 +258,18 @@ module Google
238
258
 
239
259
  response = @client_stub.make_http_request(
240
260
  verb,
241
- uri: uri,
242
- body: body || "",
243
- params: query_string_params,
261
+ uri: uri,
262
+ body: body || "",
263
+ params: query_string_params,
264
+ method_name: "delete_policy",
244
265
  options: options
245
266
  )
246
267
  operation = ::Gapic::Rest::TransportOperation.new response
247
268
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
248
-
249
- yield result, operation if block_given?
250
- result
269
+ catch :response do
270
+ yield result, operation if block_given?
271
+ result
272
+ end
251
273
  end
252
274
 
253
275
  ##
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Iam
22
22
  module V2
23
- VERSION = "0.6.2"
23
+ VERSION = "0.8.0"
24
24
  end
25
25
  end
26
26
  end
@@ -40,6 +40,8 @@ module Google
40
40
  # @!attribute [rw] error
41
41
  # @return [::Google::Rpc::Status]
42
42
  # The error result of the operation in case of failure or cancellation.
43
+ #
44
+ # Note: The following fields are mutually exclusive: `error`, `response`. If a field in that set is populated, all other fields in the set will automatically be cleared.
43
45
  # @!attribute [rw] response
44
46
  # @return [::Google::Protobuf::Any]
45
47
  # The normal, successful response of the operation. If the original
@@ -50,6 +52,8 @@ module Google
50
52
  # is the original method name. For example, if the original method name
51
53
  # is `TakeSnapshot()`, the inferred response type is
52
54
  # `TakeSnapshotResponse`.
55
+ #
56
+ # Note: The following fields are mutually exclusive: `response`, `error`. If a field in that set is populated, all other fields in the set will automatically be cleared.
53
57
  class Operation
54
58
  include ::Google::Protobuf::MessageExts
55
59
  extend ::Google::Protobuf::MessageExts::ClassMethods
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-iam-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: gapic-common
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 0.21.1
18
+ version: 0.25.0
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 2.a
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: 0.21.1
28
+ version: 0.25.0
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: 2.a
@@ -90,7 +89,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
90
89
  licenses:
91
90
  - Apache-2.0
92
91
  metadata: {}
93
- post_install_message:
94
92
  rdoc_options: []
95
93
  require_paths:
96
94
  - lib
@@ -98,15 +96,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
96
  requirements:
99
97
  - - ">="
100
98
  - !ruby/object:Gem::Version
101
- version: '2.7'
99
+ version: '3.0'
102
100
  required_rubygems_version: !ruby/object:Gem::Requirement
103
101
  requirements:
104
102
  - - ">="
105
103
  - !ruby/object:Gem::Version
106
104
  version: '0'
107
105
  requirements: []
108
- rubygems_version: 3.5.23
109
- signing_key:
106
+ rubygems_version: 3.6.2
110
107
  specification_version: 4
111
108
  summary: Manages identity and access control for Google Cloud Platform resources,
112
109
  including the creation of service accounts, which you can use to authenticate to