google-cloud-privileged_access_manager-v1 0.1.2 → 0.3.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: 5af72b67ce278f858409b499027af9be8eeee753196db1cdc218acfdf4aa5a6f
4
- data.tar.gz: d6f449b023b816f464687d9b03d26b9e7ce5cb0de7ac8830af7d8bfdd8bb91e2
3
+ metadata.gz: b6b4a7c9721c4ec29adc3d13b03ee1d6f74fca63a325ce7878b22ef952be72e3
4
+ data.tar.gz: f84277d39f036ab8b2dd3d21b03c507383f8ee4910c312e66591b892734d9f58
5
5
  SHA512:
6
- metadata.gz: 7e8c911e5f22d342557815414f878295bd4b65ba7e4e662063531bdc2052a5a63b5cb4a6bddff6907f0ede96e05cee79a597fffd09231a96a559060d3e1e40f5
7
- data.tar.gz: 24eef800756105ae0c93d91a5154650824ae7501b9d986adcd87ce16c0a1fe7791bf3d0eea71330bdf8b11d3cf29ac6718d8314e8ce986c4aabff276733d3888
6
+ metadata.gz: de9bdf2d05a956bb2d0950f497c5d08fe20425c9b3053c2088a7ba92e4854b8f50b69b7852b4707338749fa65f47e168e380f602c6ac5fc0f6dcce08b771ca65
7
+ data.tar.gz: 06ddd6e3c5585cb3867b818e66b003fde8a033c9b1bd3cf87d30290bb142d30791562228bd4a6174e1954c8d8b7ec6ca39dbfe19336be24fe41d9b4343decf99
data/README.md CHANGED
@@ -90,40 +90,50 @@ for class and method documentation.
90
90
  See also the [Product Documentation](https://cloud.google.com/iam/docs/pam-overview)
91
91
  for general usage information.
92
92
 
93
- ## Enabling Logging
94
-
95
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
96
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
97
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
98
- 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)
99
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
100
-
101
- Configuring a Ruby stdlib logger:
93
+ ## Debug Logging
94
+
95
+ This library comes with opt-in Debug Logging that can help you troubleshoot
96
+ your application's integration with the API. When logging is activated, key
97
+ events such as requests and responses, along with data payloads and metadata
98
+ such as headers and client configuration, are logged to the standard error
99
+ stream.
100
+
101
+ **WARNING:** Client Library Debug Logging includes your data payloads in
102
+ plaintext, which could include sensitive data such as PII for yourself or your
103
+ customers, private keys, or other security data that could be compromising if
104
+ leaked. Always practice good data hygiene with your application logs, and follow
105
+ the principle of least access. Google also recommends that Client Library Debug
106
+ Logging be enabled only temporarily during active debugging, and not used
107
+ permanently in production.
108
+
109
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
110
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
111
+ list of client library gem names. This will select the default logging behavior,
112
+ which writes logs to the standard error stream. On a local workstation, this may
113
+ result in logs appearing on the console. When running on a Google Cloud hosting
114
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
115
+ results in logs appearing alongside your application logs in the
116
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
117
+
118
+ You can customize logging by modifying the `logger` configuration when
119
+ constructing a client object. For example:
102
120
 
103
121
  ```ruby
122
+ require "google/cloud/privileged_access_manager/v1"
104
123
  require "logger"
105
124
 
106
- module MyLogger
107
- LOGGER = Logger.new $stderr, level: Logger::WARN
108
- def logger
109
- LOGGER
110
- end
111
- end
112
-
113
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
114
- module GRPC
115
- extend MyLogger
125
+ client = ::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new do |config|
126
+ config.logger = Logger.new "my-app.log"
116
127
  end
117
128
  ```
118
129
 
119
-
120
130
  ## Google Cloud Samples
121
131
 
122
132
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
123
133
 
124
134
  ## Supported Ruby Versions
125
135
 
126
- This library is supported on Ruby 2.7+.
136
+ This library is supported on Ruby 3.0+.
127
137
 
128
138
  Google provides official support for Ruby versions that are actively supported
129
139
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -184,14 +184,26 @@ module Google
184
184
  universe_domain: @config.universe_domain,
185
185
  channel_args: @config.channel_args,
186
186
  interceptors: @config.interceptors,
187
- channel_pool_config: @config.channel_pool
187
+ channel_pool_config: @config.channel_pool,
188
+ logger: @config.logger
188
189
  )
189
190
 
191
+ @privileged_access_manager_stub.stub_logger&.info do |entry|
192
+ entry.set_system_name
193
+ entry.set_service
194
+ entry.message = "Created client for #{entry.service}"
195
+ entry.set_credentials_fields credentials
196
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
197
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
198
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
199
+ end
200
+
190
201
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
191
202
  config.credentials = credentials
192
203
  config.quota_project = @quota_project_id
193
204
  config.endpoint = @privileged_access_manager_stub.endpoint
194
205
  config.universe_domain = @privileged_access_manager_stub.universe_domain
206
+ config.logger = @privileged_access_manager_stub.logger if config.respond_to? :logger=
195
207
  end
196
208
  end
197
209
 
@@ -209,10 +221,19 @@ module Google
209
221
  #
210
222
  attr_reader :location_client
211
223
 
224
+ ##
225
+ # The logger used for request/response debug logging.
226
+ #
227
+ # @return [Logger]
228
+ #
229
+ def logger
230
+ @privileged_access_manager_stub.logger
231
+ end
232
+
212
233
  # Service calls
213
234
 
214
235
  ##
215
- # CheckOnboardingStatus reports the onboarding status for a
236
+ # `CheckOnboardingStatus` reports the onboarding status for a
216
237
  # project/folder/organization. Any findings reported by this API need to be
217
238
  # fixed before PAM can be used on the resource.
218
239
  #
@@ -298,7 +319,6 @@ module Google
298
319
 
299
320
  @privileged_access_manager_stub.call_rpc :check_onboarding_status, request, options: options do |response, operation|
300
321
  yield response, operation if block_given?
301
- return response
302
322
  end
303
323
  rescue ::GRPC::BadStatus => e
304
324
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +418,7 @@ module Google
398
418
  @privileged_access_manager_stub.call_rpc :list_entitlements, request, options: options do |response, operation|
399
419
  response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :list_entitlements, request, response, operation, options
400
420
  yield response, operation if block_given?
401
- return response
421
+ throw :response, response
402
422
  end
403
423
  rescue ::GRPC::BadStatus => e
404
424
  raise ::Google::Cloud::Error.from_error(e)
@@ -501,7 +521,7 @@ module Google
501
521
  @privileged_access_manager_stub.call_rpc :search_entitlements, request, options: options do |response, operation|
502
522
  response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :search_entitlements, request, response, operation, options
503
523
  yield response, operation if block_given?
504
- return response
524
+ throw :response, response
505
525
  end
506
526
  rescue ::GRPC::BadStatus => e
507
527
  raise ::Google::Cloud::Error.from_error(e)
@@ -587,7 +607,6 @@ module Google
587
607
 
588
608
  @privileged_access_manager_stub.call_rpc :get_entitlement, request, options: options do |response, operation|
589
609
  yield response, operation if block_given?
590
- return response
591
610
  end
592
611
  rescue ::GRPC::BadStatus => e
593
612
  raise ::Google::Cloud::Error.from_error(e)
@@ -641,7 +660,7 @@ module Google
641
660
  # ID, the server can check if original operation with the same request ID
642
661
  # was received, and if so, ignores the second request and returns the
643
662
  # previous operation's response. This prevents clients from accidentally
644
- # creating duplicate commitments.
663
+ # creating duplicate entitlements.
645
664
  #
646
665
  # The request ID must be a valid UUID with the exception that zero UUID is
647
666
  # not supported (00000000-0000-0000-0000-000000000000).
@@ -713,7 +732,7 @@ module Google
713
732
  @privileged_access_manager_stub.call_rpc :create_entitlement, request, options: options do |response, operation|
714
733
  response = ::Gapic::Operation.new response, @operations_client, options: options
715
734
  yield response, operation if block_given?
716
- return response
735
+ throw :response, response
717
736
  end
718
737
  rescue ::GRPC::BadStatus => e
719
738
  raise ::Google::Cloud::Error.from_error(e)
@@ -721,7 +740,7 @@ module Google
721
740
 
722
741
  ##
723
742
  # Deletes a single entitlement. This method can only be called when there
724
- # are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the
743
+ # are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the
725
744
  # entitlement.
726
745
  #
727
746
  # @overload delete_entitlement(request, options = nil)
@@ -750,8 +769,7 @@ module Google
750
769
  # For example, consider a situation where you make an initial request and the
751
770
  # request times out. If you make the request again with the same request
752
771
  # ID, the server can check if original operation with the same request ID
753
- # was received, and if so, ignores the second request. This prevents
754
- # clients from accidentally creating duplicate commitments.
772
+ # was received, and if so, ignores the second request.
755
773
  #
756
774
  # The request ID must be a valid UUID with the exception that zero UUID is
757
775
  # not supported (00000000-0000-0000-0000-000000000000).
@@ -827,7 +845,7 @@ module Google
827
845
  @privileged_access_manager_stub.call_rpc :delete_entitlement, request, options: options do |response, operation|
828
846
  response = ::Gapic::Operation.new response, @operations_client, options: options
829
847
  yield response, operation if block_given?
830
- return response
848
+ throw :response, response
831
849
  end
832
850
  rescue ::GRPC::BadStatus => e
833
851
  raise ::Google::Cloud::Error.from_error(e)
@@ -950,7 +968,7 @@ module Google
950
968
  @privileged_access_manager_stub.call_rpc :update_entitlement, request, options: options do |response, operation|
951
969
  response = ::Gapic::Operation.new response, @operations_client, options: options
952
970
  yield response, operation if block_given?
953
- return response
971
+ throw :response, response
954
972
  end
955
973
  rescue ::GRPC::BadStatus => e
956
974
  raise ::Google::Cloud::Error.from_error(e)
@@ -1050,7 +1068,7 @@ module Google
1050
1068
  @privileged_access_manager_stub.call_rpc :list_grants, request, options: options do |response, operation|
1051
1069
  response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :list_grants, request, response, operation, options
1052
1070
  yield response, operation if block_given?
1053
- return response
1071
+ throw :response, response
1054
1072
  end
1055
1073
  rescue ::GRPC::BadStatus => e
1056
1074
  raise ::Google::Cloud::Error.from_error(e)
@@ -1152,7 +1170,7 @@ module Google
1152
1170
  @privileged_access_manager_stub.call_rpc :search_grants, request, options: options do |response, operation|
1153
1171
  response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :search_grants, request, response, operation, options
1154
1172
  yield response, operation if block_given?
1155
- return response
1173
+ throw :response, response
1156
1174
  end
1157
1175
  rescue ::GRPC::BadStatus => e
1158
1176
  raise ::Google::Cloud::Error.from_error(e)
@@ -1238,14 +1256,14 @@ module Google
1238
1256
 
1239
1257
  @privileged_access_manager_stub.call_rpc :get_grant, request, options: options do |response, operation|
1240
1258
  yield response, operation if block_given?
1241
- return response
1242
1259
  end
1243
1260
  rescue ::GRPC::BadStatus => e
1244
1261
  raise ::Google::Cloud::Error.from_error(e)
1245
1262
  end
1246
1263
 
1247
1264
  ##
1248
- # Creates a new grant in a given project and location.
1265
+ # Creates a new grant in a given project/folder/organization and
1266
+ # location.
1249
1267
  #
1250
1268
  # @overload create_grant(request, options = nil)
1251
1269
  # Pass arguments to `create_grant` via a request object, either of type
@@ -1277,7 +1295,7 @@ module Google
1277
1295
  # request times out. If you make the request again with the same request
1278
1296
  # ID, the server can check if original operation with the same request ID
1279
1297
  # was received, and if so, ignores the second request. This prevents
1280
- # clients from accidentally creating duplicate commitments.
1298
+ # clients from accidentally creating duplicate grants.
1281
1299
  #
1282
1300
  # The request ID must be a valid UUID with the exception that zero UUID is
1283
1301
  # not supported (00000000-0000-0000-0000-000000000000).
@@ -1341,7 +1359,6 @@ module Google
1341
1359
 
1342
1360
  @privileged_access_manager_stub.call_rpc :create_grant, request, options: options do |response, operation|
1343
1361
  yield response, operation if block_given?
1344
- return response
1345
1362
  end
1346
1363
  rescue ::GRPC::BadStatus => e
1347
1364
  raise ::Google::Cloud::Error.from_error(e)
@@ -1433,7 +1450,6 @@ module Google
1433
1450
 
1434
1451
  @privileged_access_manager_stub.call_rpc :approve_grant, request, options: options do |response, operation|
1435
1452
  yield response, operation if block_given?
1436
- return response
1437
1453
  end
1438
1454
  rescue ::GRPC::BadStatus => e
1439
1455
  raise ::Google::Cloud::Error.from_error(e)
@@ -1525,7 +1541,6 @@ module Google
1525
1541
 
1526
1542
  @privileged_access_manager_stub.call_rpc :deny_grant, request, options: options do |response, operation|
1527
1543
  yield response, operation if block_given?
1528
- return response
1529
1544
  end
1530
1545
  rescue ::GRPC::BadStatus => e
1531
1546
  raise ::Google::Cloud::Error.from_error(e)
@@ -1622,7 +1637,7 @@ module Google
1622
1637
  @privileged_access_manager_stub.call_rpc :revoke_grant, request, options: options do |response, operation|
1623
1638
  response = ::Gapic::Operation.new response, @operations_client, options: options
1624
1639
  yield response, operation if block_given?
1625
- return response
1640
+ throw :response, response
1626
1641
  end
1627
1642
  rescue ::GRPC::BadStatus => e
1628
1643
  raise ::Google::Cloud::Error.from_error(e)
@@ -1672,6 +1687,13 @@ module Google
1672
1687
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1673
1688
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1674
1689
  # * (`nil`) indicating no credentials
1690
+ #
1691
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1692
+ # external source for authentication to Google Cloud, you must validate it before
1693
+ # providing it to a Google API client library. Providing an unvalidated credential
1694
+ # configuration to Google APIs can compromise the security of your systems and data.
1695
+ # For more information, refer to [Validate credential configurations from external
1696
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1675
1697
  # @return [::Object]
1676
1698
  # @!attribute [rw] scope
1677
1699
  # The OAuth scopes
@@ -1711,6 +1733,11 @@ module Google
1711
1733
  # default endpoint URL. The default value of nil uses the environment
1712
1734
  # universe (usually the default "googleapis.com" universe).
1713
1735
  # @return [::String,nil]
1736
+ # @!attribute [rw] logger
1737
+ # A custom logger to use for request/response debug logging, or the value
1738
+ # `:default` (the default) to construct a default logger, or `nil` to
1739
+ # explicitly disable logging.
1740
+ # @return [::Logger,:default,nil]
1714
1741
  #
1715
1742
  class Configuration
1716
1743
  extend ::Gapic::Config
@@ -1735,6 +1762,7 @@ module Google
1735
1762
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1736
1763
  config_attr :quota_project, nil, ::String, nil
1737
1764
  config_attr :universe_domain, nil, ::String, nil
1765
+ config_attr :logger, :default, ::Logger, nil, :default
1738
1766
 
1739
1767
  # @private
1740
1768
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -649,6 +640,13 @@ module Google
649
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
650
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
651
642
  # * (`nil`) indicating no credentials
643
+ #
644
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
645
+ # external source for authentication to Google Cloud, you must validate it before
646
+ # providing it to a Google API client library. Providing an unvalidated credential
647
+ # configuration to Google APIs can compromise the security of your systems and data.
648
+ # For more information, refer to [Validate credential configurations from external
649
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
652
650
  # @return [::Object]
653
651
  # @!attribute [rw] scope
654
652
  # The OAuth scopes
@@ -688,6 +686,11 @@ module Google
688
686
  # default endpoint URL. The default value of nil uses the environment
689
687
  # universe (usually the default "googleapis.com" universe).
690
688
  # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
691
694
  #
692
695
  class Configuration
693
696
  extend ::Gapic::Config
@@ -712,6 +715,7 @@ module Google
712
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
716
  config_attr :quota_project, nil, ::String, nil
714
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
715
719
 
716
720
  # @private
717
721
  def initialize parent_config = nil