google-cloud-workstations-v1 0.1.3 → 0.3.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: acf7fafc78d065ee69126881bbb66739e67b6e69ed74b286967e58cfab1d4ba1
4
- data.tar.gz: 4a61fd59d9401da073c825a504cda162b15548ea161a54bacb2412748f99b187
3
+ metadata.gz: af9ffa4cf34453b631775de0c183b3eda6c7e45536e916d4863a281012834dd5
4
+ data.tar.gz: e2b902ec55468f953edb3fdf2665dcfee6a36c8a564628279e5ab14a464f3b99
5
5
  SHA512:
6
- metadata.gz: '046191f582bfb09cebc88f6f4e31d812a7050c9b4409afdf913110cc13100b16ea855e99bf25fef56469455ea08c7c381b677d59878e9d84062fb3f43db050c7'
7
- data.tar.gz: 542de951309a575d33ee768e90c596d0860bce99045b5faf798c8bc37d70cb5083a88968f08fce2146b946170847b0d083f1c7772c9e1e8b0ff884b4f4c3b7d8
6
+ metadata.gz: 9e510fa7dc3cd74a9a3feb976a5e9a7bbc08fb0fd1e4706926e6008b0a1e0d097ee730bc239ead7d1dedc1855c7a30f890619c001b6d6dae2444715e92afe0da
7
+ data.tar.gz: ea1a0f696bec3d3549b7bcf0e90ca3ac87f3985c78f4abae78b23415ef7ecaa972fd96335b4ef27eb89163c93211270a94d9986bf5573e57b9b7cca35123e094
data/README.md CHANGED
@@ -42,40 +42,50 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/workstations/docs)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- 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)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/workstations/v1"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::Workstations::V1::Workstations::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
75
85
 
76
86
  ## Supported Ruby Versions
77
87
 
78
- This library is supported on Ruby 2.7+.
88
+ This library is supported on Ruby 3.0+.
79
89
 
80
90
  Google provides official support for Ruby versions that are actively supported
81
91
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Workstations
23
23
  module V1
24
- VERSION = "0.1.3"
24
+ VERSION = "0.3.0"
25
25
  end
26
26
  end
27
27
  end
@@ -233,14 +233,26 @@ module Google
233
233
  universe_domain: @config.universe_domain,
234
234
  channel_args: @config.channel_args,
235
235
  interceptors: @config.interceptors,
236
- channel_pool_config: @config.channel_pool
236
+ channel_pool_config: @config.channel_pool,
237
+ logger: @config.logger
237
238
  )
238
239
 
240
+ @workstations_stub.stub_logger&.info do |entry|
241
+ entry.set_system_name
242
+ entry.set_service
243
+ entry.message = "Created client for #{entry.service}"
244
+ entry.set_credentials_fields credentials
245
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
246
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
247
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
248
+ end
249
+
239
250
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
240
251
  config.credentials = credentials
241
252
  config.quota_project = @quota_project_id
242
253
  config.endpoint = @workstations_stub.endpoint
243
254
  config.universe_domain = @workstations_stub.universe_domain
255
+ config.logger = @workstations_stub.logger if config.respond_to? :logger=
244
256
  end
245
257
 
246
258
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -248,6 +260,7 @@ module Google
248
260
  config.quota_project = @quota_project_id
249
261
  config.endpoint = @workstations_stub.endpoint
250
262
  config.universe_domain = @workstations_stub.universe_domain
263
+ config.logger = @workstations_stub.logger if config.respond_to? :logger=
251
264
  end
252
265
  end
253
266
 
@@ -272,6 +285,15 @@ module Google
272
285
  #
273
286
  attr_reader :iam_policy_client
274
287
 
288
+ ##
289
+ # The logger used for request/response debug logging.
290
+ #
291
+ # @return [Logger]
292
+ #
293
+ def logger
294
+ @workstations_stub.logger
295
+ end
296
+
275
297
  # Service calls
276
298
 
277
299
  ##
@@ -354,7 +376,6 @@ module Google
354
376
 
355
377
  @workstations_stub.call_rpc :get_workstation_cluster, request, options: options do |response, operation|
356
378
  yield response, operation if block_given?
357
- return response
358
379
  end
359
380
  rescue ::GRPC::BadStatus => e
360
381
  raise ::Google::Cloud::Error.from_error(e)
@@ -450,7 +471,7 @@ module Google
450
471
  @workstations_stub.call_rpc :list_workstation_clusters, request, options: options do |response, operation|
451
472
  response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_workstation_clusters, request, response, operation, options
452
473
  yield response, operation if block_given?
453
- return response
474
+ throw :response, response
454
475
  end
455
476
  rescue ::GRPC::BadStatus => e
456
477
  raise ::Google::Cloud::Error.from_error(e)
@@ -551,7 +572,7 @@ module Google
551
572
  @workstations_stub.call_rpc :create_workstation_cluster, request, options: options do |response, operation|
552
573
  response = ::Gapic::Operation.new response, @operations_client, options: options
553
574
  yield response, operation if block_given?
554
- return response
575
+ throw :response, response
555
576
  end
556
577
  rescue ::GRPC::BadStatus => e
557
578
  raise ::Google::Cloud::Error.from_error(e)
@@ -655,7 +676,7 @@ module Google
655
676
  @workstations_stub.call_rpc :update_workstation_cluster, request, options: options do |response, operation|
656
677
  response = ::Gapic::Operation.new response, @operations_client, options: options
657
678
  yield response, operation if block_given?
658
- return response
679
+ throw :response, response
659
680
  end
660
681
  rescue ::GRPC::BadStatus => e
661
682
  raise ::Google::Cloud::Error.from_error(e)
@@ -759,7 +780,7 @@ module Google
759
780
  @workstations_stub.call_rpc :delete_workstation_cluster, request, options: options do |response, operation|
760
781
  response = ::Gapic::Operation.new response, @operations_client, options: options
761
782
  yield response, operation if block_given?
762
- return response
783
+ throw :response, response
763
784
  end
764
785
  rescue ::GRPC::BadStatus => e
765
786
  raise ::Google::Cloud::Error.from_error(e)
@@ -845,7 +866,6 @@ module Google
845
866
 
846
867
  @workstations_stub.call_rpc :get_workstation_config, request, options: options do |response, operation|
847
868
  yield response, operation if block_given?
848
- return response
849
869
  end
850
870
  rescue ::GRPC::BadStatus => e
851
871
  raise ::Google::Cloud::Error.from_error(e)
@@ -941,7 +961,7 @@ module Google
941
961
  @workstations_stub.call_rpc :list_workstation_configs, request, options: options do |response, operation|
942
962
  response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_workstation_configs, request, response, operation, options
943
963
  yield response, operation if block_given?
944
- return response
964
+ throw :response, response
945
965
  end
946
966
  rescue ::GRPC::BadStatus => e
947
967
  raise ::Google::Cloud::Error.from_error(e)
@@ -1038,7 +1058,7 @@ module Google
1038
1058
  @workstations_stub.call_rpc :list_usable_workstation_configs, request, options: options do |response, operation|
1039
1059
  response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_usable_workstation_configs, request, response, operation, options
1040
1060
  yield response, operation if block_given?
1041
- return response
1061
+ throw :response, response
1042
1062
  end
1043
1063
  rescue ::GRPC::BadStatus => e
1044
1064
  raise ::Google::Cloud::Error.from_error(e)
@@ -1139,7 +1159,7 @@ module Google
1139
1159
  @workstations_stub.call_rpc :create_workstation_config, request, options: options do |response, operation|
1140
1160
  response = ::Gapic::Operation.new response, @operations_client, options: options
1141
1161
  yield response, operation if block_given?
1142
- return response
1162
+ throw :response, response
1143
1163
  end
1144
1164
  rescue ::GRPC::BadStatus => e
1145
1165
  raise ::Google::Cloud::Error.from_error(e)
@@ -1243,7 +1263,7 @@ module Google
1243
1263
  @workstations_stub.call_rpc :update_workstation_config, request, options: options do |response, operation|
1244
1264
  response = ::Gapic::Operation.new response, @operations_client, options: options
1245
1265
  yield response, operation if block_given?
1246
- return response
1266
+ throw :response, response
1247
1267
  end
1248
1268
  rescue ::GRPC::BadStatus => e
1249
1269
  raise ::Google::Cloud::Error.from_error(e)
@@ -1347,7 +1367,7 @@ module Google
1347
1367
  @workstations_stub.call_rpc :delete_workstation_config, request, options: options do |response, operation|
1348
1368
  response = ::Gapic::Operation.new response, @operations_client, options: options
1349
1369
  yield response, operation if block_given?
1350
- return response
1370
+ throw :response, response
1351
1371
  end
1352
1372
  rescue ::GRPC::BadStatus => e
1353
1373
  raise ::Google::Cloud::Error.from_error(e)
@@ -1433,7 +1453,6 @@ module Google
1433
1453
 
1434
1454
  @workstations_stub.call_rpc :get_workstation, request, options: options do |response, operation|
1435
1455
  yield response, operation if block_given?
1436
- return response
1437
1456
  end
1438
1457
  rescue ::GRPC::BadStatus => e
1439
1458
  raise ::Google::Cloud::Error.from_error(e)
@@ -1529,7 +1548,7 @@ module Google
1529
1548
  @workstations_stub.call_rpc :list_workstations, request, options: options do |response, operation|
1530
1549
  response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_workstations, request, response, operation, options
1531
1550
  yield response, operation if block_given?
1532
- return response
1551
+ throw :response, response
1533
1552
  end
1534
1553
  rescue ::GRPC::BadStatus => e
1535
1554
  raise ::Google::Cloud::Error.from_error(e)
@@ -1626,7 +1645,7 @@ module Google
1626
1645
  @workstations_stub.call_rpc :list_usable_workstations, request, options: options do |response, operation|
1627
1646
  response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_usable_workstations, request, response, operation, options
1628
1647
  yield response, operation if block_given?
1629
- return response
1648
+ throw :response, response
1630
1649
  end
1631
1650
  rescue ::GRPC::BadStatus => e
1632
1651
  raise ::Google::Cloud::Error.from_error(e)
@@ -1727,7 +1746,7 @@ module Google
1727
1746
  @workstations_stub.call_rpc :create_workstation, request, options: options do |response, operation|
1728
1747
  response = ::Gapic::Operation.new response, @operations_client, options: options
1729
1748
  yield response, operation if block_given?
1730
- return response
1749
+ throw :response, response
1731
1750
  end
1732
1751
  rescue ::GRPC::BadStatus => e
1733
1752
  raise ::Google::Cloud::Error.from_error(e)
@@ -1831,7 +1850,7 @@ module Google
1831
1850
  @workstations_stub.call_rpc :update_workstation, request, options: options do |response, operation|
1832
1851
  response = ::Gapic::Operation.new response, @operations_client, options: options
1833
1852
  yield response, operation if block_given?
1834
- return response
1853
+ throw :response, response
1835
1854
  end
1836
1855
  rescue ::GRPC::BadStatus => e
1837
1856
  raise ::Google::Cloud::Error.from_error(e)
@@ -1931,7 +1950,7 @@ module Google
1931
1950
  @workstations_stub.call_rpc :delete_workstation, request, options: options do |response, operation|
1932
1951
  response = ::Gapic::Operation.new response, @operations_client, options: options
1933
1952
  yield response, operation if block_given?
1934
- return response
1953
+ throw :response, response
1935
1954
  end
1936
1955
  rescue ::GRPC::BadStatus => e
1937
1956
  raise ::Google::Cloud::Error.from_error(e)
@@ -2031,7 +2050,7 @@ module Google
2031
2050
  @workstations_stub.call_rpc :start_workstation, request, options: options do |response, operation|
2032
2051
  response = ::Gapic::Operation.new response, @operations_client, options: options
2033
2052
  yield response, operation if block_given?
2034
- return response
2053
+ throw :response, response
2035
2054
  end
2036
2055
  rescue ::GRPC::BadStatus => e
2037
2056
  raise ::Google::Cloud::Error.from_error(e)
@@ -2131,7 +2150,7 @@ module Google
2131
2150
  @workstations_stub.call_rpc :stop_workstation, request, options: options do |response, operation|
2132
2151
  response = ::Gapic::Operation.new response, @operations_client, options: options
2133
2152
  yield response, operation if block_given?
2134
- return response
2153
+ throw :response, response
2135
2154
  end
2136
2155
  rescue ::GRPC::BadStatus => e
2137
2156
  raise ::Google::Cloud::Error.from_error(e)
@@ -2161,10 +2180,14 @@ module Google
2161
2180
  # be at most 24 hours in the future. If a value is not specified, the
2162
2181
  # token's expiration time will be set to a default value of 1 hour in the
2163
2182
  # future.
2183
+ #
2184
+ # Note: The following fields are mutually exclusive: `expire_time`, `ttl`. If a field in that set is populated, all other fields in the set will automatically be cleared.
2164
2185
  # @param ttl [::Google::Protobuf::Duration, ::Hash]
2165
2186
  # Desired lifetime duration of the access token. This value must
2166
2187
  # be at most 24 hours. If a value is not specified, the token's lifetime
2167
2188
  # will be set to a default value of 1 hour.
2189
+ #
2190
+ # Note: The following fields are mutually exclusive: `ttl`, `expire_time`. If a field in that set is populated, all other fields in the set will automatically be cleared.
2168
2191
  # @param workstation [::String]
2169
2192
  # Required. Name of the workstation for which the access token should be
2170
2193
  # generated.
@@ -2228,7 +2251,6 @@ module Google
2228
2251
 
2229
2252
  @workstations_stub.call_rpc :generate_access_token, request, options: options do |response, operation|
2230
2253
  yield response, operation if block_given?
2231
- return response
2232
2254
  end
2233
2255
  rescue ::GRPC::BadStatus => e
2234
2256
  raise ::Google::Cloud::Error.from_error(e)
@@ -2278,6 +2300,13 @@ module Google
2278
2300
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2279
2301
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2280
2302
  # * (`nil`) indicating no credentials
2303
+ #
2304
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2305
+ # external source for authentication to Google Cloud, you must validate it before
2306
+ # providing it to a Google API client library. Providing an unvalidated credential
2307
+ # configuration to Google APIs can compromise the security of your systems and data.
2308
+ # For more information, refer to [Validate credential configurations from external
2309
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2281
2310
  # @return [::Object]
2282
2311
  # @!attribute [rw] scope
2283
2312
  # The OAuth scopes
@@ -2317,6 +2346,11 @@ module Google
2317
2346
  # default endpoint URL. The default value of nil uses the environment
2318
2347
  # universe (usually the default "googleapis.com" universe).
2319
2348
  # @return [::String,nil]
2349
+ # @!attribute [rw] logger
2350
+ # A custom logger to use for request/response debug logging, or the value
2351
+ # `:default` (the default) to construct a default logger, or `nil` to
2352
+ # explicitly disable logging.
2353
+ # @return [::Logger,:default,nil]
2320
2354
  #
2321
2355
  class Configuration
2322
2356
  extend ::Gapic::Config
@@ -2341,6 +2375,7 @@ module Google
2341
2375
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2342
2376
  config_attr :quota_project, nil, ::String, nil
2343
2377
  config_attr :universe_domain, nil, ::String, nil
2378
+ config_attr :logger, :default, ::Logger, nil, :default
2344
2379
 
2345
2380
  # @private
2346
2381
  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)
@@ -642,6 +640,13 @@ module Google
642
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
643
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
644
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).
645
650
  # @return [::Object]
646
651
  # @!attribute [rw] scope
647
652
  # The OAuth scopes
@@ -681,6 +686,11 @@ module Google
681
686
  # default endpoint URL. The default value of nil uses the environment
682
687
  # universe (usually the default "googleapis.com" universe).
683
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]
684
694
  #
685
695
  class Configuration
686
696
  extend ::Gapic::Config
@@ -705,6 +715,7 @@ module Google
705
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
716
  config_attr :quota_project, nil, ::String, nil
707
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
708
719
 
709
720
  # @private
710
721
  def initialize parent_config = nil