google-cloud-storage-control-v2 1.4.0 → 1.5.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.
@@ -0,0 +1,913 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/storage/control/v2/storage_control_pb"
21
+ require "google/cloud/storage/control/v2/storage_control/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Storage
26
+ module Control
27
+ module V2
28
+ module StorageControl
29
+ module Rest
30
+ ##
31
+ # REST client for the StorageControl service.
32
+ #
33
+ # StorageControl service includes selected control plane operations.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "storage.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :storage_control_stub
46
+
47
+ ##
48
+ # Configure the StorageControl Client class.
49
+ #
50
+ # See {::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all StorageControl clients
56
+ # ::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "Storage", "Control", "V2"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+
78
+ default_config.rpcs.get_project_intelligence_config.timeout = 60.0
79
+ default_config.rpcs.get_project_intelligence_config.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
81
+ }
82
+
83
+ default_config.rpcs.update_project_intelligence_config.timeout = 60.0
84
+ default_config.rpcs.update_project_intelligence_config.retry_policy = {
85
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
86
+ }
87
+
88
+ default_config.rpcs.get_folder_intelligence_config.timeout = 60.0
89
+ default_config.rpcs.get_folder_intelligence_config.retry_policy = {
90
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
91
+ }
92
+
93
+ default_config.rpcs.update_folder_intelligence_config.timeout = 60.0
94
+ default_config.rpcs.update_folder_intelligence_config.retry_policy = {
95
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
96
+ }
97
+
98
+ default_config.rpcs.get_organization_intelligence_config.timeout = 60.0
99
+ default_config.rpcs.get_organization_intelligence_config.retry_policy = {
100
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
101
+ }
102
+
103
+ default_config.rpcs.update_organization_intelligence_config.timeout = 60.0
104
+ default_config.rpcs.update_organization_intelligence_config.retry_policy = {
105
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
106
+ }
107
+
108
+ default_config
109
+ end
110
+ yield @configure if block_given?
111
+ @configure
112
+ end
113
+
114
+ ##
115
+ # Configure the StorageControl Client instance.
116
+ #
117
+ # The configuration is set to the derived mode, meaning that values can be changed,
118
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
119
+ # should be made on {Client.configure}.
120
+ #
121
+ # See {::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client::Configuration}
122
+ # for a description of the configuration fields.
123
+ #
124
+ # @yield [config] Configure the Client client.
125
+ # @yieldparam config [Client::Configuration]
126
+ #
127
+ # @return [Client::Configuration]
128
+ #
129
+ def configure
130
+ yield @config if block_given?
131
+ @config
132
+ end
133
+
134
+ ##
135
+ # The effective universe domain
136
+ #
137
+ # @return [String]
138
+ #
139
+ def universe_domain
140
+ @storage_control_stub.universe_domain
141
+ end
142
+
143
+ ##
144
+ # Create a new StorageControl REST client object.
145
+ #
146
+ # @example
147
+ #
148
+ # # Create a client using the default configuration
149
+ # client = ::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
150
+ #
151
+ # # Create a client using a custom configuration
152
+ # client = ::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new do |config|
153
+ # config.timeout = 10.0
154
+ # end
155
+ #
156
+ # @yield [config] Configure the StorageControl client.
157
+ # @yieldparam config [Client::Configuration]
158
+ #
159
+ def initialize
160
+ # Create the configuration object
161
+ @config = Configuration.new Client.configure
162
+
163
+ # Yield the configuration if needed
164
+ yield @config if block_given?
165
+
166
+ # Create credentials
167
+ credentials = @config.credentials
168
+ # Use self-signed JWT if the endpoint is unchanged from default,
169
+ # but only if the default endpoint does not have a region prefix.
170
+ enable_self_signed_jwt = @config.endpoint.nil? ||
171
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
172
+ !@config.endpoint.split(".").first.include?("-"))
173
+ credentials ||= Credentials.default scope: @config.scope,
174
+ enable_self_signed_jwt: enable_self_signed_jwt
175
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
176
+ credentials = Credentials.new credentials, scope: @config.scope
177
+ end
178
+
179
+ @quota_project_id = @config.quota_project
180
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
181
+
182
+ @storage_control_stub = ::Google::Cloud::Storage::Control::V2::StorageControl::Rest::ServiceStub.new(
183
+ endpoint: @config.endpoint,
184
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
185
+ universe_domain: @config.universe_domain,
186
+ credentials: credentials,
187
+ logger: @config.logger
188
+ )
189
+
190
+ @storage_control_stub.logger(stub: true)&.info do |entry|
191
+ entry.set_system_name
192
+ entry.set_service
193
+ entry.message = "Created client for #{entry.service}"
194
+ entry.set_credentials_fields credentials
195
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
196
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
197
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
198
+ end
199
+ end
200
+
201
+ ##
202
+ # The logger used for request/response debug logging.
203
+ #
204
+ # @return [Logger]
205
+ #
206
+ def logger
207
+ @storage_control_stub.logger
208
+ end
209
+
210
+ # Service calls
211
+
212
+ ##
213
+ # Returns the Project scoped singleton IntelligenceConfig resource.
214
+ #
215
+ # @overload get_project_intelligence_config(request, options = nil)
216
+ # Pass arguments to `get_project_intelligence_config` via a request object, either of type
217
+ # {::Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest} or an equivalent Hash.
218
+ #
219
+ # @param request [::Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest, ::Hash]
220
+ # A request object representing the call parameters. Required. To specify no
221
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
222
+ # @param options [::Gapic::CallOptions, ::Hash]
223
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
224
+ #
225
+ # @overload get_project_intelligence_config(name: nil)
226
+ # Pass arguments to `get_project_intelligence_config` via keyword arguments. Note that at
227
+ # least one keyword argument is required. To specify no parameters, or to keep all
228
+ # the default parameter values, pass an empty Hash as a request object (see above).
229
+ #
230
+ # @param name [::String]
231
+ # Required. The name of the `IntelligenceConfig` resource associated with
232
+ # your project.
233
+ #
234
+ # Format: `projects/{id}/locations/global/intelligenceConfig`
235
+ # @yield [result, operation] Access the result along with the TransportOperation object
236
+ # @yieldparam result [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
237
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
238
+ #
239
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
240
+ #
241
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
242
+ #
243
+ # @example Basic example
244
+ # require "google/cloud/storage/control/v2"
245
+ #
246
+ # # Create a client object. The client can be reused for multiple calls.
247
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
248
+ #
249
+ # # Create a request. To set request fields, pass in keyword arguments.
250
+ # request = Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest.new
251
+ #
252
+ # # Call the get_project_intelligence_config method.
253
+ # result = client.get_project_intelligence_config request
254
+ #
255
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
256
+ # p result
257
+ #
258
+ def get_project_intelligence_config request, options = nil
259
+ raise ::ArgumentError, "request must be provided" if request.nil?
260
+
261
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest
262
+
263
+ # Converts hash and nil to an options object
264
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
265
+
266
+ # Customize the options with defaults
267
+ call_metadata = @config.rpcs.get_project_intelligence_config.metadata.to_h
268
+
269
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
270
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
271
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
272
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION,
273
+ transports_version_send: [:rest]
274
+
275
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
276
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
277
+
278
+ options.apply_defaults timeout: @config.rpcs.get_project_intelligence_config.timeout,
279
+ metadata: call_metadata,
280
+ retry_policy: @config.rpcs.get_project_intelligence_config.retry_policy
281
+
282
+ options.apply_defaults timeout: @config.timeout,
283
+ metadata: @config.metadata,
284
+ retry_policy: @config.retry_policy
285
+
286
+ @storage_control_stub.get_project_intelligence_config request, options do |result, operation|
287
+ yield result, operation if block_given?
288
+ end
289
+ rescue ::Gapic::Rest::Error => e
290
+ raise ::Google::Cloud::Error.from_error(e)
291
+ end
292
+
293
+ ##
294
+ # Updates the Project scoped singleton IntelligenceConfig resource.
295
+ #
296
+ # @overload update_project_intelligence_config(request, options = nil)
297
+ # Pass arguments to `update_project_intelligence_config` via a request object, either of type
298
+ # {::Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest} or an equivalent Hash.
299
+ #
300
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest, ::Hash]
301
+ # A request object representing the call parameters. Required. To specify no
302
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
303
+ # @param options [::Gapic::CallOptions, ::Hash]
304
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
305
+ #
306
+ # @overload update_project_intelligence_config(intelligence_config: nil, update_mask: nil, request_id: nil)
307
+ # Pass arguments to `update_project_intelligence_config` via keyword arguments. Note that at
308
+ # least one keyword argument is required. To specify no parameters, or to keep all
309
+ # the default parameter values, pass an empty Hash as a request object (see above).
310
+ #
311
+ # @param intelligence_config [::Google::Cloud::Storage::Control::V2::IntelligenceConfig, ::Hash]
312
+ # Required. The `IntelligenceConfig` resource to be updated.
313
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
314
+ # Required. The `update_mask` that specifies the fields within the
315
+ # `IntelligenceConfig` resource that should be modified by this update. Only
316
+ # the listed fields are updated.
317
+ # @param request_id [::String]
318
+ # Optional. The ID that uniquely identifies the request, preventing duplicate
319
+ # processing.
320
+ # @yield [result, operation] Access the result along with the TransportOperation object
321
+ # @yieldparam result [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
322
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
323
+ #
324
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
325
+ #
326
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
327
+ #
328
+ # @example Basic example
329
+ # require "google/cloud/storage/control/v2"
330
+ #
331
+ # # Create a client object. The client can be reused for multiple calls.
332
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
333
+ #
334
+ # # Create a request. To set request fields, pass in keyword arguments.
335
+ # request = Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest.new
336
+ #
337
+ # # Call the update_project_intelligence_config method.
338
+ # result = client.update_project_intelligence_config request
339
+ #
340
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
341
+ # p result
342
+ #
343
+ def update_project_intelligence_config request, options = nil
344
+ raise ::ArgumentError, "request must be provided" if request.nil?
345
+
346
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest
347
+
348
+ # Converts hash and nil to an options object
349
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
350
+
351
+ # Customize the options with defaults
352
+ call_metadata = @config.rpcs.update_project_intelligence_config.metadata.to_h
353
+
354
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
355
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
356
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
357
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION,
358
+ transports_version_send: [:rest]
359
+
360
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
361
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
362
+
363
+ options.apply_defaults timeout: @config.rpcs.update_project_intelligence_config.timeout,
364
+ metadata: call_metadata,
365
+ retry_policy: @config.rpcs.update_project_intelligence_config.retry_policy
366
+
367
+ options.apply_defaults timeout: @config.timeout,
368
+ metadata: @config.metadata,
369
+ retry_policy: @config.retry_policy
370
+
371
+ @storage_control_stub.update_project_intelligence_config request, options do |result, operation|
372
+ yield result, operation if block_given?
373
+ end
374
+ rescue ::Gapic::Rest::Error => e
375
+ raise ::Google::Cloud::Error.from_error(e)
376
+ end
377
+
378
+ ##
379
+ # Returns the Folder scoped singleton IntelligenceConfig resource.
380
+ #
381
+ # @overload get_folder_intelligence_config(request, options = nil)
382
+ # Pass arguments to `get_folder_intelligence_config` via a request object, either of type
383
+ # {::Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest} or an equivalent Hash.
384
+ #
385
+ # @param request [::Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest, ::Hash]
386
+ # A request object representing the call parameters. Required. To specify no
387
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
388
+ # @param options [::Gapic::CallOptions, ::Hash]
389
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
390
+ #
391
+ # @overload get_folder_intelligence_config(name: nil)
392
+ # Pass arguments to `get_folder_intelligence_config` via keyword arguments. Note that at
393
+ # least one keyword argument is required. To specify no parameters, or to keep all
394
+ # the default parameter values, pass an empty Hash as a request object (see above).
395
+ #
396
+ # @param name [::String]
397
+ # Required. The name of the `IntelligenceConfig` resource associated with
398
+ # your folder.
399
+ #
400
+ # Format: `folders/{id}/locations/global/intelligenceConfig`
401
+ # @yield [result, operation] Access the result along with the TransportOperation object
402
+ # @yieldparam result [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
403
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
404
+ #
405
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
406
+ #
407
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
408
+ #
409
+ # @example Basic example
410
+ # require "google/cloud/storage/control/v2"
411
+ #
412
+ # # Create a client object. The client can be reused for multiple calls.
413
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
414
+ #
415
+ # # Create a request. To set request fields, pass in keyword arguments.
416
+ # request = Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest.new
417
+ #
418
+ # # Call the get_folder_intelligence_config method.
419
+ # result = client.get_folder_intelligence_config request
420
+ #
421
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
422
+ # p result
423
+ #
424
+ def get_folder_intelligence_config request, options = nil
425
+ raise ::ArgumentError, "request must be provided" if request.nil?
426
+
427
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest
428
+
429
+ # Converts hash and nil to an options object
430
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
431
+
432
+ # Customize the options with defaults
433
+ call_metadata = @config.rpcs.get_folder_intelligence_config.metadata.to_h
434
+
435
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
436
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
437
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
438
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION,
439
+ transports_version_send: [:rest]
440
+
441
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
442
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
443
+
444
+ options.apply_defaults timeout: @config.rpcs.get_folder_intelligence_config.timeout,
445
+ metadata: call_metadata,
446
+ retry_policy: @config.rpcs.get_folder_intelligence_config.retry_policy
447
+
448
+ options.apply_defaults timeout: @config.timeout,
449
+ metadata: @config.metadata,
450
+ retry_policy: @config.retry_policy
451
+
452
+ @storage_control_stub.get_folder_intelligence_config request, options do |result, operation|
453
+ yield result, operation if block_given?
454
+ end
455
+ rescue ::Gapic::Rest::Error => e
456
+ raise ::Google::Cloud::Error.from_error(e)
457
+ end
458
+
459
+ ##
460
+ # Updates the Folder scoped singleton IntelligenceConfig resource.
461
+ #
462
+ # @overload update_folder_intelligence_config(request, options = nil)
463
+ # Pass arguments to `update_folder_intelligence_config` via a request object, either of type
464
+ # {::Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest} or an equivalent Hash.
465
+ #
466
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest, ::Hash]
467
+ # A request object representing the call parameters. Required. To specify no
468
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
469
+ # @param options [::Gapic::CallOptions, ::Hash]
470
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
471
+ #
472
+ # @overload update_folder_intelligence_config(intelligence_config: nil, update_mask: nil, request_id: nil)
473
+ # Pass arguments to `update_folder_intelligence_config` via keyword arguments. Note that at
474
+ # least one keyword argument is required. To specify no parameters, or to keep all
475
+ # the default parameter values, pass an empty Hash as a request object (see above).
476
+ #
477
+ # @param intelligence_config [::Google::Cloud::Storage::Control::V2::IntelligenceConfig, ::Hash]
478
+ # Required. The `IntelligenceConfig` resource to be updated.
479
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
480
+ # Required. The `update_mask` that specifies the fields within the
481
+ # `IntelligenceConfig` resource that should be modified by this update. Only
482
+ # the listed fields are updated.
483
+ # @param request_id [::String]
484
+ # Optional. The ID that uniquely identifies the request, preventing duplicate
485
+ # processing.
486
+ # @yield [result, operation] Access the result along with the TransportOperation object
487
+ # @yieldparam result [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
488
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
489
+ #
490
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
491
+ #
492
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
493
+ #
494
+ # @example Basic example
495
+ # require "google/cloud/storage/control/v2"
496
+ #
497
+ # # Create a client object. The client can be reused for multiple calls.
498
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
499
+ #
500
+ # # Create a request. To set request fields, pass in keyword arguments.
501
+ # request = Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest.new
502
+ #
503
+ # # Call the update_folder_intelligence_config method.
504
+ # result = client.update_folder_intelligence_config request
505
+ #
506
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
507
+ # p result
508
+ #
509
+ def update_folder_intelligence_config request, options = nil
510
+ raise ::ArgumentError, "request must be provided" if request.nil?
511
+
512
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest
513
+
514
+ # Converts hash and nil to an options object
515
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
516
+
517
+ # Customize the options with defaults
518
+ call_metadata = @config.rpcs.update_folder_intelligence_config.metadata.to_h
519
+
520
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
521
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
522
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
523
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION,
524
+ transports_version_send: [:rest]
525
+
526
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
527
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
528
+
529
+ options.apply_defaults timeout: @config.rpcs.update_folder_intelligence_config.timeout,
530
+ metadata: call_metadata,
531
+ retry_policy: @config.rpcs.update_folder_intelligence_config.retry_policy
532
+
533
+ options.apply_defaults timeout: @config.timeout,
534
+ metadata: @config.metadata,
535
+ retry_policy: @config.retry_policy
536
+
537
+ @storage_control_stub.update_folder_intelligence_config request, options do |result, operation|
538
+ yield result, operation if block_given?
539
+ end
540
+ rescue ::Gapic::Rest::Error => e
541
+ raise ::Google::Cloud::Error.from_error(e)
542
+ end
543
+
544
+ ##
545
+ # Returns the Organization scoped singleton IntelligenceConfig resource.
546
+ #
547
+ # @overload get_organization_intelligence_config(request, options = nil)
548
+ # Pass arguments to `get_organization_intelligence_config` via a request object, either of type
549
+ # {::Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest} or an equivalent Hash.
550
+ #
551
+ # @param request [::Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest, ::Hash]
552
+ # A request object representing the call parameters. Required. To specify no
553
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
554
+ # @param options [::Gapic::CallOptions, ::Hash]
555
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
556
+ #
557
+ # @overload get_organization_intelligence_config(name: nil)
558
+ # Pass arguments to `get_organization_intelligence_config` via keyword arguments. Note that at
559
+ # least one keyword argument is required. To specify no parameters, or to keep all
560
+ # the default parameter values, pass an empty Hash as a request object (see above).
561
+ #
562
+ # @param name [::String]
563
+ # Required. The name of the `IntelligenceConfig` resource associated with
564
+ # your organization.
565
+ #
566
+ # Format: `organizations/{org_id}/locations/global/intelligenceConfig`
567
+ # @yield [result, operation] Access the result along with the TransportOperation object
568
+ # @yieldparam result [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
569
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
570
+ #
571
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
572
+ #
573
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
574
+ #
575
+ # @example Basic example
576
+ # require "google/cloud/storage/control/v2"
577
+ #
578
+ # # Create a client object. The client can be reused for multiple calls.
579
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
580
+ #
581
+ # # Create a request. To set request fields, pass in keyword arguments.
582
+ # request = Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest.new
583
+ #
584
+ # # Call the get_organization_intelligence_config method.
585
+ # result = client.get_organization_intelligence_config request
586
+ #
587
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
588
+ # p result
589
+ #
590
+ def get_organization_intelligence_config request, options = nil
591
+ raise ::ArgumentError, "request must be provided" if request.nil?
592
+
593
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest
594
+
595
+ # Converts hash and nil to an options object
596
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
597
+
598
+ # Customize the options with defaults
599
+ call_metadata = @config.rpcs.get_organization_intelligence_config.metadata.to_h
600
+
601
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
602
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
603
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
604
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION,
605
+ transports_version_send: [:rest]
606
+
607
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
608
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
609
+
610
+ options.apply_defaults timeout: @config.rpcs.get_organization_intelligence_config.timeout,
611
+ metadata: call_metadata,
612
+ retry_policy: @config.rpcs.get_organization_intelligence_config.retry_policy
613
+
614
+ options.apply_defaults timeout: @config.timeout,
615
+ metadata: @config.metadata,
616
+ retry_policy: @config.retry_policy
617
+
618
+ @storage_control_stub.get_organization_intelligence_config request, options do |result, operation|
619
+ yield result, operation if block_given?
620
+ end
621
+ rescue ::Gapic::Rest::Error => e
622
+ raise ::Google::Cloud::Error.from_error(e)
623
+ end
624
+
625
+ ##
626
+ # Updates the Organization scoped singleton IntelligenceConfig resource.
627
+ #
628
+ # @overload update_organization_intelligence_config(request, options = nil)
629
+ # Pass arguments to `update_organization_intelligence_config` via a request object, either of type
630
+ # {::Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest} or an equivalent Hash.
631
+ #
632
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest, ::Hash]
633
+ # A request object representing the call parameters. Required. To specify no
634
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
635
+ # @param options [::Gapic::CallOptions, ::Hash]
636
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
637
+ #
638
+ # @overload update_organization_intelligence_config(intelligence_config: nil, update_mask: nil, request_id: nil)
639
+ # Pass arguments to `update_organization_intelligence_config` via keyword arguments. Note that at
640
+ # least one keyword argument is required. To specify no parameters, or to keep all
641
+ # the default parameter values, pass an empty Hash as a request object (see above).
642
+ #
643
+ # @param intelligence_config [::Google::Cloud::Storage::Control::V2::IntelligenceConfig, ::Hash]
644
+ # Required. The `IntelligenceConfig` resource to be updated.
645
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
646
+ # Required. The `update_mask` that specifies the fields within the
647
+ # `IntelligenceConfig` resource that should be modified by this update. Only
648
+ # the listed fields are updated.
649
+ # @param request_id [::String]
650
+ # Optional. The ID that uniquely identifies the request, preventing duplicate
651
+ # processing.
652
+ # @yield [result, operation] Access the result along with the TransportOperation object
653
+ # @yieldparam result [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
654
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
655
+ #
656
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
657
+ #
658
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
659
+ #
660
+ # @example Basic example
661
+ # require "google/cloud/storage/control/v2"
662
+ #
663
+ # # Create a client object. The client can be reused for multiple calls.
664
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new
665
+ #
666
+ # # Create a request. To set request fields, pass in keyword arguments.
667
+ # request = Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest.new
668
+ #
669
+ # # Call the update_organization_intelligence_config method.
670
+ # result = client.update_organization_intelligence_config request
671
+ #
672
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
673
+ # p result
674
+ #
675
+ def update_organization_intelligence_config request, options = nil
676
+ raise ::ArgumentError, "request must be provided" if request.nil?
677
+
678
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest
679
+
680
+ # Converts hash and nil to an options object
681
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
682
+
683
+ # Customize the options with defaults
684
+ call_metadata = @config.rpcs.update_organization_intelligence_config.metadata.to_h
685
+
686
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
687
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
688
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
689
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION,
690
+ transports_version_send: [:rest]
691
+
692
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
693
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
694
+
695
+ options.apply_defaults timeout: @config.rpcs.update_organization_intelligence_config.timeout,
696
+ metadata: call_metadata,
697
+ retry_policy: @config.rpcs.update_organization_intelligence_config.retry_policy
698
+
699
+ options.apply_defaults timeout: @config.timeout,
700
+ metadata: @config.metadata,
701
+ retry_policy: @config.retry_policy
702
+
703
+ @storage_control_stub.update_organization_intelligence_config request, options do |result, operation|
704
+ yield result, operation if block_given?
705
+ end
706
+ rescue ::Gapic::Rest::Error => e
707
+ raise ::Google::Cloud::Error.from_error(e)
708
+ end
709
+
710
+ ##
711
+ # Configuration class for the StorageControl REST API.
712
+ #
713
+ # This class represents the configuration for StorageControl REST,
714
+ # providing control over timeouts, retry behavior, logging, transport
715
+ # parameters, and other low-level controls. Certain parameters can also be
716
+ # applied individually to specific RPCs. See
717
+ # {::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client::Configuration::Rpcs}
718
+ # for a list of RPCs that can be configured independently.
719
+ #
720
+ # Configuration can be applied globally to all clients, or to a single client
721
+ # on construction.
722
+ #
723
+ # @example
724
+ #
725
+ # # Modify the global config, setting the timeout for
726
+ # # get_project_intelligence_config to 20 seconds,
727
+ # # and all remaining timeouts to 10 seconds.
728
+ # ::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.configure do |config|
729
+ # config.timeout = 10.0
730
+ # config.rpcs.get_project_intelligence_config.timeout = 20.0
731
+ # end
732
+ #
733
+ # # Apply the above configuration only to a new client.
734
+ # client = ::Google::Cloud::Storage::Control::V2::StorageControl::Rest::Client.new do |config|
735
+ # config.timeout = 10.0
736
+ # config.rpcs.get_project_intelligence_config.timeout = 20.0
737
+ # end
738
+ #
739
+ # @!attribute [rw] endpoint
740
+ # A custom service endpoint, as a hostname or hostname:port. The default is
741
+ # nil, indicating to use the default endpoint in the current universe domain.
742
+ # @return [::String,nil]
743
+ # @!attribute [rw] credentials
744
+ # Credentials to send with calls. You may provide any of the following types:
745
+ # * (`String`) The path to a service account key file in JSON format
746
+ # * (`Hash`) A service account key as a Hash
747
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
748
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
749
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
750
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
751
+ # * (`nil`) indicating no credentials
752
+ #
753
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
754
+ # external source for authentication to Google Cloud, you must validate it before
755
+ # providing it to a Google API client library. Providing an unvalidated credential
756
+ # configuration to Google APIs can compromise the security of your systems and data.
757
+ # For more information, refer to [Validate credential configurations from external
758
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
759
+ # @return [::Object]
760
+ # @!attribute [rw] scope
761
+ # The OAuth scopes
762
+ # @return [::Array<::String>]
763
+ # @!attribute [rw] lib_name
764
+ # The library name as recorded in instrumentation and logging
765
+ # @return [::String]
766
+ # @!attribute [rw] lib_version
767
+ # The library version as recorded in instrumentation and logging
768
+ # @return [::String]
769
+ # @!attribute [rw] timeout
770
+ # The call timeout in seconds.
771
+ # @return [::Numeric]
772
+ # @!attribute [rw] metadata
773
+ # Additional headers to be sent with the call.
774
+ # @return [::Hash{::Symbol=>::String}]
775
+ # @!attribute [rw] retry_policy
776
+ # The retry policy. The value is a hash with the following keys:
777
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
778
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
779
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
780
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
781
+ # trigger a retry.
782
+ # @return [::Hash]
783
+ # @!attribute [rw] quota_project
784
+ # A separate project against which to charge quota.
785
+ # @return [::String]
786
+ # @!attribute [rw] universe_domain
787
+ # The universe domain within which to make requests. This determines the
788
+ # default endpoint URL. The default value of nil uses the environment
789
+ # universe (usually the default "googleapis.com" universe).
790
+ # @return [::String,nil]
791
+ # @!attribute [rw] logger
792
+ # A custom logger to use for request/response debug logging, or the value
793
+ # `:default` (the default) to construct a default logger, or `nil` to
794
+ # explicitly disable logging.
795
+ # @return [::Logger,:default,nil]
796
+ #
797
+ class Configuration
798
+ extend ::Gapic::Config
799
+
800
+ # @private
801
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
802
+ DEFAULT_ENDPOINT = "storage.googleapis.com"
803
+
804
+ config_attr :endpoint, nil, ::String, nil
805
+ config_attr :credentials, nil do |value|
806
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
807
+ allowed.any? { |klass| klass === value }
808
+ end
809
+ config_attr :scope, nil, ::String, ::Array, nil
810
+ config_attr :lib_name, nil, ::String, nil
811
+ config_attr :lib_version, nil, ::String, nil
812
+ config_attr :timeout, nil, ::Numeric, nil
813
+ config_attr :metadata, nil, ::Hash, nil
814
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
815
+ config_attr :quota_project, nil, ::String, nil
816
+ config_attr :universe_domain, nil, ::String, nil
817
+ config_attr :logger, :default, ::Logger, nil, :default
818
+
819
+ # @private
820
+ def initialize parent_config = nil
821
+ @parent_config = parent_config unless parent_config.nil?
822
+
823
+ yield self if block_given?
824
+ end
825
+
826
+ ##
827
+ # Configurations for individual RPCs
828
+ # @return [Rpcs]
829
+ #
830
+ def rpcs
831
+ @rpcs ||= begin
832
+ parent_rpcs = nil
833
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
834
+ Rpcs.new parent_rpcs
835
+ end
836
+ end
837
+
838
+ ##
839
+ # Configuration RPC class for the StorageControl API.
840
+ #
841
+ # Includes fields providing the configuration for each RPC in this service.
842
+ # Each configuration object is of type `Gapic::Config::Method` and includes
843
+ # the following configuration fields:
844
+ #
845
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
846
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
847
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
848
+ # include the following keys:
849
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
850
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
851
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
852
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
853
+ # trigger a retry.
854
+ #
855
+ class Rpcs
856
+ ##
857
+ # RPC-specific configuration for `get_project_intelligence_config`
858
+ # @return [::Gapic::Config::Method]
859
+ #
860
+ attr_reader :get_project_intelligence_config
861
+ ##
862
+ # RPC-specific configuration for `update_project_intelligence_config`
863
+ # @return [::Gapic::Config::Method]
864
+ #
865
+ attr_reader :update_project_intelligence_config
866
+ ##
867
+ # RPC-specific configuration for `get_folder_intelligence_config`
868
+ # @return [::Gapic::Config::Method]
869
+ #
870
+ attr_reader :get_folder_intelligence_config
871
+ ##
872
+ # RPC-specific configuration for `update_folder_intelligence_config`
873
+ # @return [::Gapic::Config::Method]
874
+ #
875
+ attr_reader :update_folder_intelligence_config
876
+ ##
877
+ # RPC-specific configuration for `get_organization_intelligence_config`
878
+ # @return [::Gapic::Config::Method]
879
+ #
880
+ attr_reader :get_organization_intelligence_config
881
+ ##
882
+ # RPC-specific configuration for `update_organization_intelligence_config`
883
+ # @return [::Gapic::Config::Method]
884
+ #
885
+ attr_reader :update_organization_intelligence_config
886
+
887
+ # @private
888
+ def initialize parent_rpcs = nil
889
+ get_project_intelligence_config_config = parent_rpcs.get_project_intelligence_config if parent_rpcs.respond_to? :get_project_intelligence_config
890
+ @get_project_intelligence_config = ::Gapic::Config::Method.new get_project_intelligence_config_config
891
+ update_project_intelligence_config_config = parent_rpcs.update_project_intelligence_config if parent_rpcs.respond_to? :update_project_intelligence_config
892
+ @update_project_intelligence_config = ::Gapic::Config::Method.new update_project_intelligence_config_config
893
+ get_folder_intelligence_config_config = parent_rpcs.get_folder_intelligence_config if parent_rpcs.respond_to? :get_folder_intelligence_config
894
+ @get_folder_intelligence_config = ::Gapic::Config::Method.new get_folder_intelligence_config_config
895
+ update_folder_intelligence_config_config = parent_rpcs.update_folder_intelligence_config if parent_rpcs.respond_to? :update_folder_intelligence_config
896
+ @update_folder_intelligence_config = ::Gapic::Config::Method.new update_folder_intelligence_config_config
897
+ get_organization_intelligence_config_config = parent_rpcs.get_organization_intelligence_config if parent_rpcs.respond_to? :get_organization_intelligence_config
898
+ @get_organization_intelligence_config = ::Gapic::Config::Method.new get_organization_intelligence_config_config
899
+ update_organization_intelligence_config_config = parent_rpcs.update_organization_intelligence_config if parent_rpcs.respond_to? :update_organization_intelligence_config
900
+ @update_organization_intelligence_config = ::Gapic::Config::Method.new update_organization_intelligence_config_config
901
+
902
+ yield self if block_given?
903
+ end
904
+ end
905
+ end
906
+ end
907
+ end
908
+ end
909
+ end
910
+ end
911
+ end
912
+ end
913
+ end