google-cloud-storage_insights-v1 0.a → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/storage_insights/v1/bindings_override.rb +102 -0
  6. data/lib/google/cloud/storage_insights/v1/rest.rb +38 -0
  7. data/lib/google/cloud/storage_insights/v1/storage_insights/client.rb +1055 -0
  8. data/lib/google/cloud/storage_insights/v1/storage_insights/credentials.rb +47 -0
  9. data/lib/google/cloud/storage_insights/v1/storage_insights/paths.rb +90 -0
  10. data/lib/google/cloud/storage_insights/v1/storage_insights/rest/client.rb +872 -0
  11. data/lib/google/cloud/storage_insights/v1/storage_insights/rest/service_stub.rb +463 -0
  12. data/lib/google/cloud/storage_insights/v1/storage_insights/rest.rb +53 -0
  13. data/lib/google/cloud/storage_insights/v1/storage_insights.rb +55 -0
  14. data/lib/google/cloud/storage_insights/v1/version.rb +7 -2
  15. data/lib/google/cloud/storage_insights/v1.rb +45 -0
  16. data/lib/google/cloud/storageinsights/v1/storageinsights_pb.rb +77 -0
  17. data/lib/google/cloud/storageinsights/v1/storageinsights_services_pb.rb +57 -0
  18. data/lib/google-cloud-storage_insights-v1.rb +21 -0
  19. data/proto_docs/README.md +4 -0
  20. data/proto_docs/google/api/client.rb +381 -0
  21. data/proto_docs/google/api/field_behavior.rb +71 -0
  22. data/proto_docs/google/api/launch_stage.rb +71 -0
  23. data/proto_docs/google/api/resource.rb +222 -0
  24. data/proto_docs/google/cloud/storageinsights/v1/storageinsights.rb +431 -0
  25. data/proto_docs/google/protobuf/any.rb +144 -0
  26. data/proto_docs/google/protobuf/duration.rb +98 -0
  27. data/proto_docs/google/protobuf/empty.rb +34 -0
  28. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  29. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  30. data/proto_docs/google/rpc/status.rb +48 -0
  31. data/proto_docs/google/type/date.rb +53 -0
  32. data/proto_docs/google/type/datetime.rb +99 -0
  33. metadata +206 -12
@@ -0,0 +1,872 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/cloud/storageinsights/v1/storageinsights_pb"
21
+ require "google/cloud/storage_insights/v1/storage_insights/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module StorageInsights
27
+ module V1
28
+ module StorageInsights
29
+ module Rest
30
+ ##
31
+ # REST client for the StorageInsights service.
32
+ #
33
+ # Service describing handlers for resources
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :storage_insights_stub
40
+
41
+ ##
42
+ # Configure the StorageInsights Client class.
43
+ #
44
+ # See {::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all StorageInsights clients
50
+ # ::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "StorageInsights", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+
72
+ default_config.rpcs.list_report_configs.timeout = 60.0
73
+ default_config.rpcs.list_report_configs.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config.rpcs.get_report_config.timeout = 60.0
78
+ default_config.rpcs.get_report_config.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.list_report_details.timeout = 60.0
83
+ default_config.rpcs.list_report_details.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
85
+ }
86
+
87
+ default_config.rpcs.get_report_detail.timeout = 60.0
88
+ default_config.rpcs.get_report_detail.retry_policy = {
89
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
90
+ }
91
+
92
+ default_config
93
+ end
94
+ yield @configure if block_given?
95
+ @configure
96
+ end
97
+
98
+ ##
99
+ # Configure the StorageInsights Client instance.
100
+ #
101
+ # The configuration is set to the derived mode, meaning that values can be changed,
102
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
103
+ # should be made on {Client.configure}.
104
+ #
105
+ # See {::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client::Configuration}
106
+ # for a description of the configuration fields.
107
+ #
108
+ # @yield [config] Configure the Client client.
109
+ # @yieldparam config [Client::Configuration]
110
+ #
111
+ # @return [Client::Configuration]
112
+ #
113
+ def configure
114
+ yield @config if block_given?
115
+ @config
116
+ end
117
+
118
+ ##
119
+ # Create a new StorageInsights REST client object.
120
+ #
121
+ # @example
122
+ #
123
+ # # Create a client using the default configuration
124
+ # client = ::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client.new
125
+ #
126
+ # # Create a client using a custom configuration
127
+ # client = ::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client.new do |config|
128
+ # config.timeout = 10.0
129
+ # end
130
+ #
131
+ # @yield [config] Configure the StorageInsights client.
132
+ # @yieldparam config [Client::Configuration]
133
+ #
134
+ def initialize
135
+ # Create the configuration object
136
+ @config = Configuration.new Client.configure
137
+
138
+ # Yield the configuration if needed
139
+ yield @config if block_given?
140
+
141
+ # Create credentials
142
+ credentials = @config.credentials
143
+ # Use self-signed JWT if the endpoint is unchanged from default,
144
+ # but only if the default endpoint does not have a region prefix.
145
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
146
+ !@config.endpoint.split(".").first.include?("-")
147
+ credentials ||= Credentials.default scope: @config.scope,
148
+ enable_self_signed_jwt: enable_self_signed_jwt
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
150
+ credentials = Credentials.new credentials, scope: @config.scope
151
+ end
152
+
153
+ @quota_project_id = @config.quota_project
154
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
+
156
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
157
+ config.credentials = credentials
158
+ config.quota_project = @quota_project_id
159
+ config.endpoint = @config.endpoint
160
+ config.bindings_override = @config.bindings_override
161
+ end
162
+
163
+ @storage_insights_stub = ::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
164
+ end
165
+
166
+ ##
167
+ # Get the associated client for mix-in of the Locations.
168
+ #
169
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
170
+ #
171
+ attr_reader :location_client
172
+
173
+ # Service calls
174
+
175
+ ##
176
+ # Lists ReportConfigs in a given project and location.
177
+ #
178
+ # @overload list_report_configs(request, options = nil)
179
+ # Pass arguments to `list_report_configs` via a request object, either of type
180
+ # {::Google::Cloud::StorageInsights::V1::ListReportConfigsRequest} or an equivalent Hash.
181
+ #
182
+ # @param request [::Google::Cloud::StorageInsights::V1::ListReportConfigsRequest, ::Hash]
183
+ # A request object representing the call parameters. Required. To specify no
184
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
185
+ # @param options [::Gapic::CallOptions, ::Hash]
186
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
187
+ #
188
+ # @overload list_report_configs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
189
+ # Pass arguments to `list_report_configs` via keyword arguments. Note that at
190
+ # least one keyword argument is required. To specify no parameters, or to keep all
191
+ # the default parameter values, pass an empty Hash as a request object (see above).
192
+ #
193
+ # @param parent [::String]
194
+ # Required. Parent value for ListReportConfigsRequest
195
+ # @param page_size [::Integer]
196
+ # Requested page size. Server may return fewer items than requested.
197
+ # If unspecified, server will pick an appropriate default.
198
+ # @param page_token [::String]
199
+ # A token identifying a page of results the server should return.
200
+ # @param filter [::String]
201
+ # Filtering results
202
+ # @param order_by [::String]
203
+ # Hint for how to order the results
204
+ # @yield [result, operation] Access the result along with the TransportOperation object
205
+ # @yieldparam result [::Google::Cloud::StorageInsights::V1::ListReportConfigsResponse]
206
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
207
+ #
208
+ # @return [::Google::Cloud::StorageInsights::V1::ListReportConfigsResponse]
209
+ #
210
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
211
+ def list_report_configs request, options = nil
212
+ raise ::ArgumentError, "request must be provided" if request.nil?
213
+
214
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::ListReportConfigsRequest
215
+
216
+ # Converts hash and nil to an options object
217
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
218
+
219
+ # Customize the options with defaults
220
+ call_metadata = @config.rpcs.list_report_configs.metadata.to_h
221
+
222
+ # Set x-goog-api-client and x-goog-user-project headers
223
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
224
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
225
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
226
+ transports_version_send: [:rest]
227
+
228
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
229
+
230
+ options.apply_defaults timeout: @config.rpcs.list_report_configs.timeout,
231
+ metadata: call_metadata,
232
+ retry_policy: @config.rpcs.list_report_configs.retry_policy
233
+
234
+ options.apply_defaults timeout: @config.timeout,
235
+ metadata: @config.metadata,
236
+ retry_policy: @config.retry_policy
237
+
238
+ @storage_insights_stub.list_report_configs request, options do |result, operation|
239
+ yield result, operation if block_given?
240
+ return result
241
+ end
242
+ rescue ::Gapic::Rest::Error => e
243
+ raise ::Google::Cloud::Error.from_error(e)
244
+ end
245
+
246
+ ##
247
+ # Gets details of a single ReportConfig.
248
+ #
249
+ # @overload get_report_config(request, options = nil)
250
+ # Pass arguments to `get_report_config` via a request object, either of type
251
+ # {::Google::Cloud::StorageInsights::V1::GetReportConfigRequest} or an equivalent Hash.
252
+ #
253
+ # @param request [::Google::Cloud::StorageInsights::V1::GetReportConfigRequest, ::Hash]
254
+ # A request object representing the call parameters. Required. To specify no
255
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
256
+ # @param options [::Gapic::CallOptions, ::Hash]
257
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
258
+ #
259
+ # @overload get_report_config(name: nil)
260
+ # Pass arguments to `get_report_config` via keyword arguments. Note that at
261
+ # least one keyword argument is required. To specify no parameters, or to keep all
262
+ # the default parameter values, pass an empty Hash as a request object (see above).
263
+ #
264
+ # @param name [::String]
265
+ # Required. Name of the resource
266
+ # @yield [result, operation] Access the result along with the TransportOperation object
267
+ # @yieldparam result [::Google::Cloud::StorageInsights::V1::ReportConfig]
268
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
269
+ #
270
+ # @return [::Google::Cloud::StorageInsights::V1::ReportConfig]
271
+ #
272
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
273
+ def get_report_config request, options = nil
274
+ raise ::ArgumentError, "request must be provided" if request.nil?
275
+
276
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::GetReportConfigRequest
277
+
278
+ # Converts hash and nil to an options object
279
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
280
+
281
+ # Customize the options with defaults
282
+ call_metadata = @config.rpcs.get_report_config.metadata.to_h
283
+
284
+ # Set x-goog-api-client and x-goog-user-project headers
285
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
286
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
287
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
288
+ transports_version_send: [:rest]
289
+
290
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
291
+
292
+ options.apply_defaults timeout: @config.rpcs.get_report_config.timeout,
293
+ metadata: call_metadata,
294
+ retry_policy: @config.rpcs.get_report_config.retry_policy
295
+
296
+ options.apply_defaults timeout: @config.timeout,
297
+ metadata: @config.metadata,
298
+ retry_policy: @config.retry_policy
299
+
300
+ @storage_insights_stub.get_report_config request, options do |result, operation|
301
+ yield result, operation if block_given?
302
+ return result
303
+ end
304
+ rescue ::Gapic::Rest::Error => e
305
+ raise ::Google::Cloud::Error.from_error(e)
306
+ end
307
+
308
+ ##
309
+ # Creates a new ReportConfig in a given project and location.
310
+ #
311
+ # @overload create_report_config(request, options = nil)
312
+ # Pass arguments to `create_report_config` via a request object, either of type
313
+ # {::Google::Cloud::StorageInsights::V1::CreateReportConfigRequest} or an equivalent Hash.
314
+ #
315
+ # @param request [::Google::Cloud::StorageInsights::V1::CreateReportConfigRequest, ::Hash]
316
+ # A request object representing the call parameters. Required. To specify no
317
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
318
+ # @param options [::Gapic::CallOptions, ::Hash]
319
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
320
+ #
321
+ # @overload create_report_config(parent: nil, report_config: nil, request_id: nil)
322
+ # Pass arguments to `create_report_config` via keyword arguments. Note that at
323
+ # least one keyword argument is required. To specify no parameters, or to keep all
324
+ # the default parameter values, pass an empty Hash as a request object (see above).
325
+ #
326
+ # @param parent [::String]
327
+ # Required. Value for parent.
328
+ # @param report_config [::Google::Cloud::StorageInsights::V1::ReportConfig, ::Hash]
329
+ # Required. The resource being created
330
+ # @param request_id [::String]
331
+ # Optional. An optional request ID to identify requests. Specify a unique
332
+ # request ID so that if you must retry your request, the server will know to
333
+ # ignore the request if it has already been completed. The server will
334
+ # guarantee that for at least 60 minutes since the first request.
335
+ #
336
+ # For example, consider a situation where you make an initial request and
337
+ # the request times out. If you make the request again with the same request
338
+ # ID, the server can check if original operation with the same request ID
339
+ # was received, and if so, will ignore the second request. This prevents
340
+ # clients from accidentally creating duplicate commitments.
341
+ #
342
+ # The request ID must be a valid UUID with the exception that zero UUID is
343
+ # not supported (00000000-0000-0000-0000-000000000000).
344
+ # @yield [result, operation] Access the result along with the TransportOperation object
345
+ # @yieldparam result [::Google::Cloud::StorageInsights::V1::ReportConfig]
346
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
347
+ #
348
+ # @return [::Google::Cloud::StorageInsights::V1::ReportConfig]
349
+ #
350
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
351
+ def create_report_config request, options = nil
352
+ raise ::ArgumentError, "request must be provided" if request.nil?
353
+
354
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::CreateReportConfigRequest
355
+
356
+ # Converts hash and nil to an options object
357
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
358
+
359
+ # Customize the options with defaults
360
+ call_metadata = @config.rpcs.create_report_config.metadata.to_h
361
+
362
+ # Set x-goog-api-client and x-goog-user-project headers
363
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
364
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
365
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
366
+ transports_version_send: [:rest]
367
+
368
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
369
+
370
+ options.apply_defaults timeout: @config.rpcs.create_report_config.timeout,
371
+ metadata: call_metadata,
372
+ retry_policy: @config.rpcs.create_report_config.retry_policy
373
+
374
+ options.apply_defaults timeout: @config.timeout,
375
+ metadata: @config.metadata,
376
+ retry_policy: @config.retry_policy
377
+
378
+ @storage_insights_stub.create_report_config request, options do |result, operation|
379
+ yield result, operation if block_given?
380
+ return result
381
+ end
382
+ rescue ::Gapic::Rest::Error => e
383
+ raise ::Google::Cloud::Error.from_error(e)
384
+ end
385
+
386
+ ##
387
+ # Updates the parameters of a single ReportConfig.
388
+ #
389
+ # @overload update_report_config(request, options = nil)
390
+ # Pass arguments to `update_report_config` via a request object, either of type
391
+ # {::Google::Cloud::StorageInsights::V1::UpdateReportConfigRequest} or an equivalent Hash.
392
+ #
393
+ # @param request [::Google::Cloud::StorageInsights::V1::UpdateReportConfigRequest, ::Hash]
394
+ # A request object representing the call parameters. Required. To specify no
395
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
396
+ # @param options [::Gapic::CallOptions, ::Hash]
397
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
398
+ #
399
+ # @overload update_report_config(update_mask: nil, report_config: nil, request_id: nil)
400
+ # Pass arguments to `update_report_config` via keyword arguments. Note that at
401
+ # least one keyword argument is required. To specify no parameters, or to keep all
402
+ # the default parameter values, pass an empty Hash as a request object (see above).
403
+ #
404
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
405
+ # Required. Field mask is used to specify the fields to be overwritten in the
406
+ # ReportConfig resource by the update.
407
+ # The fields specified in the update_mask are relative to the resource, not
408
+ # the full request. A field will be overwritten if it is in the mask. If the
409
+ # user does not provide a mask then all fields will be overwritten.
410
+ # @param report_config [::Google::Cloud::StorageInsights::V1::ReportConfig, ::Hash]
411
+ # Required. The resource being updated
412
+ # @param request_id [::String]
413
+ # Optional. An optional request ID to identify requests. Specify a unique
414
+ # request ID so that if you must retry your request, the server will know to
415
+ # ignore the request if it has already been completed. The server will
416
+ # guarantee that for at least 60 minutes since the first request.
417
+ #
418
+ # For example, consider a situation where you make an initial request and
419
+ # the request times out. If you make the request again with the same request
420
+ # ID, the server can check if original operation with the same request ID
421
+ # was received, and if so, will ignore the second request. This prevents
422
+ # clients from accidentally creating duplicate commitments.
423
+ #
424
+ # The request ID must be a valid UUID with the exception that zero UUID is
425
+ # not supported (00000000-0000-0000-0000-000000000000).
426
+ # @yield [result, operation] Access the result along with the TransportOperation object
427
+ # @yieldparam result [::Google::Cloud::StorageInsights::V1::ReportConfig]
428
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
429
+ #
430
+ # @return [::Google::Cloud::StorageInsights::V1::ReportConfig]
431
+ #
432
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
433
+ def update_report_config request, options = nil
434
+ raise ::ArgumentError, "request must be provided" if request.nil?
435
+
436
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::UpdateReportConfigRequest
437
+
438
+ # Converts hash and nil to an options object
439
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
440
+
441
+ # Customize the options with defaults
442
+ call_metadata = @config.rpcs.update_report_config.metadata.to_h
443
+
444
+ # Set x-goog-api-client and x-goog-user-project headers
445
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
446
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
447
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
448
+ transports_version_send: [:rest]
449
+
450
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
451
+
452
+ options.apply_defaults timeout: @config.rpcs.update_report_config.timeout,
453
+ metadata: call_metadata,
454
+ retry_policy: @config.rpcs.update_report_config.retry_policy
455
+
456
+ options.apply_defaults timeout: @config.timeout,
457
+ metadata: @config.metadata,
458
+ retry_policy: @config.retry_policy
459
+
460
+ @storage_insights_stub.update_report_config request, options do |result, operation|
461
+ yield result, operation if block_given?
462
+ return result
463
+ end
464
+ rescue ::Gapic::Rest::Error => e
465
+ raise ::Google::Cloud::Error.from_error(e)
466
+ end
467
+
468
+ ##
469
+ # Deletes a single ReportConfig.
470
+ #
471
+ # @overload delete_report_config(request, options = nil)
472
+ # Pass arguments to `delete_report_config` via a request object, either of type
473
+ # {::Google::Cloud::StorageInsights::V1::DeleteReportConfigRequest} or an equivalent Hash.
474
+ #
475
+ # @param request [::Google::Cloud::StorageInsights::V1::DeleteReportConfigRequest, ::Hash]
476
+ # A request object representing the call parameters. Required. To specify no
477
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
478
+ # @param options [::Gapic::CallOptions, ::Hash]
479
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
480
+ #
481
+ # @overload delete_report_config(name: nil, force: nil, request_id: nil)
482
+ # Pass arguments to `delete_report_config` via keyword arguments. Note that at
483
+ # least one keyword argument is required. To specify no parameters, or to keep all
484
+ # the default parameter values, pass an empty Hash as a request object (see above).
485
+ #
486
+ # @param name [::String]
487
+ # Required. Name of the resource
488
+ # @param force [::Boolean]
489
+ # Optional. If set, all ReportDetails for this ReportConfig will be deleted.
490
+ # @param request_id [::String]
491
+ # Optional. An optional request ID to identify requests. Specify a unique
492
+ # request ID so that if you must retry your request, the server will know to
493
+ # ignore the request if it has already been completed. The server will
494
+ # guarantee that for at least 60 minutes after the first request.
495
+ #
496
+ # For example, consider a situation where you make an initial request and
497
+ # the request times out. If you make the request again with the same request
498
+ # ID, the server can check if original operation with the same request ID
499
+ # was received, and if so, will ignore the second request. This prevents
500
+ # clients from accidentally creating duplicate commitments.
501
+ #
502
+ # The request ID must be a valid UUID with the exception that zero UUID is
503
+ # not supported (00000000-0000-0000-0000-000000000000).
504
+ # @yield [result, operation] Access the result along with the TransportOperation object
505
+ # @yieldparam result [::Google::Protobuf::Empty]
506
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
507
+ #
508
+ # @return [::Google::Protobuf::Empty]
509
+ #
510
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
511
+ def delete_report_config request, options = nil
512
+ raise ::ArgumentError, "request must be provided" if request.nil?
513
+
514
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::DeleteReportConfigRequest
515
+
516
+ # Converts hash and nil to an options object
517
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
518
+
519
+ # Customize the options with defaults
520
+ call_metadata = @config.rpcs.delete_report_config.metadata.to_h
521
+
522
+ # Set x-goog-api-client and x-goog-user-project headers
523
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
524
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
525
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
526
+ transports_version_send: [:rest]
527
+
528
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
529
+
530
+ options.apply_defaults timeout: @config.rpcs.delete_report_config.timeout,
531
+ metadata: call_metadata,
532
+ retry_policy: @config.rpcs.delete_report_config.retry_policy
533
+
534
+ options.apply_defaults timeout: @config.timeout,
535
+ metadata: @config.metadata,
536
+ retry_policy: @config.retry_policy
537
+
538
+ @storage_insights_stub.delete_report_config request, options do |result, operation|
539
+ yield result, operation if block_given?
540
+ return result
541
+ end
542
+ rescue ::Gapic::Rest::Error => e
543
+ raise ::Google::Cloud::Error.from_error(e)
544
+ end
545
+
546
+ ##
547
+ # Lists ReportDetails in a given project and location.
548
+ #
549
+ # @overload list_report_details(request, options = nil)
550
+ # Pass arguments to `list_report_details` via a request object, either of type
551
+ # {::Google::Cloud::StorageInsights::V1::ListReportDetailsRequest} or an equivalent Hash.
552
+ #
553
+ # @param request [::Google::Cloud::StorageInsights::V1::ListReportDetailsRequest, ::Hash]
554
+ # A request object representing the call parameters. Required. To specify no
555
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
556
+ # @param options [::Gapic::CallOptions, ::Hash]
557
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
558
+ #
559
+ # @overload list_report_details(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
560
+ # Pass arguments to `list_report_details` via keyword arguments. Note that at
561
+ # least one keyword argument is required. To specify no parameters, or to keep all
562
+ # the default parameter values, pass an empty Hash as a request object (see above).
563
+ #
564
+ # @param parent [::String]
565
+ # Required. Parent value for ListReportDetailsRequest
566
+ # @param page_size [::Integer]
567
+ # Requested page size. Server may return fewer items than requested.
568
+ # If unspecified, server will pick an appropriate default.
569
+ # @param page_token [::String]
570
+ # A token identifying a page of results the server should return.
571
+ # @param filter [::String]
572
+ # Filtering results
573
+ # @param order_by [::String]
574
+ # Hint for how to order the results
575
+ # @yield [result, operation] Access the result along with the TransportOperation object
576
+ # @yieldparam result [::Google::Cloud::StorageInsights::V1::ListReportDetailsResponse]
577
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
578
+ #
579
+ # @return [::Google::Cloud::StorageInsights::V1::ListReportDetailsResponse]
580
+ #
581
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
582
+ def list_report_details request, options = nil
583
+ raise ::ArgumentError, "request must be provided" if request.nil?
584
+
585
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::ListReportDetailsRequest
586
+
587
+ # Converts hash and nil to an options object
588
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
589
+
590
+ # Customize the options with defaults
591
+ call_metadata = @config.rpcs.list_report_details.metadata.to_h
592
+
593
+ # Set x-goog-api-client and x-goog-user-project headers
594
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
595
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
596
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
597
+ transports_version_send: [:rest]
598
+
599
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
600
+
601
+ options.apply_defaults timeout: @config.rpcs.list_report_details.timeout,
602
+ metadata: call_metadata,
603
+ retry_policy: @config.rpcs.list_report_details.retry_policy
604
+
605
+ options.apply_defaults timeout: @config.timeout,
606
+ metadata: @config.metadata,
607
+ retry_policy: @config.retry_policy
608
+
609
+ @storage_insights_stub.list_report_details request, options do |result, operation|
610
+ yield result, operation if block_given?
611
+ return result
612
+ end
613
+ rescue ::Gapic::Rest::Error => e
614
+ raise ::Google::Cloud::Error.from_error(e)
615
+ end
616
+
617
+ ##
618
+ # Gets details of a single ReportDetail.
619
+ #
620
+ # @overload get_report_detail(request, options = nil)
621
+ # Pass arguments to `get_report_detail` via a request object, either of type
622
+ # {::Google::Cloud::StorageInsights::V1::GetReportDetailRequest} or an equivalent Hash.
623
+ #
624
+ # @param request [::Google::Cloud::StorageInsights::V1::GetReportDetailRequest, ::Hash]
625
+ # A request object representing the call parameters. Required. To specify no
626
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
627
+ # @param options [::Gapic::CallOptions, ::Hash]
628
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
629
+ #
630
+ # @overload get_report_detail(name: nil)
631
+ # Pass arguments to `get_report_detail` via keyword arguments. Note that at
632
+ # least one keyword argument is required. To specify no parameters, or to keep all
633
+ # the default parameter values, pass an empty Hash as a request object (see above).
634
+ #
635
+ # @param name [::String]
636
+ # Required. Name of the resource
637
+ # @yield [result, operation] Access the result along with the TransportOperation object
638
+ # @yieldparam result [::Google::Cloud::StorageInsights::V1::ReportDetail]
639
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
640
+ #
641
+ # @return [::Google::Cloud::StorageInsights::V1::ReportDetail]
642
+ #
643
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
644
+ def get_report_detail request, options = nil
645
+ raise ::ArgumentError, "request must be provided" if request.nil?
646
+
647
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageInsights::V1::GetReportDetailRequest
648
+
649
+ # Converts hash and nil to an options object
650
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
651
+
652
+ # Customize the options with defaults
653
+ call_metadata = @config.rpcs.get_report_detail.metadata.to_h
654
+
655
+ # Set x-goog-api-client and x-goog-user-project headers
656
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
657
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
658
+ gapic_version: ::Google::Cloud::StorageInsights::V1::VERSION,
659
+ transports_version_send: [:rest]
660
+
661
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
662
+
663
+ options.apply_defaults timeout: @config.rpcs.get_report_detail.timeout,
664
+ metadata: call_metadata,
665
+ retry_policy: @config.rpcs.get_report_detail.retry_policy
666
+
667
+ options.apply_defaults timeout: @config.timeout,
668
+ metadata: @config.metadata,
669
+ retry_policy: @config.retry_policy
670
+
671
+ @storage_insights_stub.get_report_detail request, options do |result, operation|
672
+ yield result, operation if block_given?
673
+ return result
674
+ end
675
+ rescue ::Gapic::Rest::Error => e
676
+ raise ::Google::Cloud::Error.from_error(e)
677
+ end
678
+
679
+ ##
680
+ # Configuration class for the StorageInsights REST API.
681
+ #
682
+ # This class represents the configuration for StorageInsights REST,
683
+ # providing control over timeouts, retry behavior, logging, transport
684
+ # parameters, and other low-level controls. Certain parameters can also be
685
+ # applied individually to specific RPCs. See
686
+ # {::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client::Configuration::Rpcs}
687
+ # for a list of RPCs that can be configured independently.
688
+ #
689
+ # Configuration can be applied globally to all clients, or to a single client
690
+ # on construction.
691
+ #
692
+ # @example
693
+ #
694
+ # # Modify the global config, setting the timeout for
695
+ # # list_report_configs to 20 seconds,
696
+ # # and all remaining timeouts to 10 seconds.
697
+ # ::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client.configure do |config|
698
+ # config.timeout = 10.0
699
+ # config.rpcs.list_report_configs.timeout = 20.0
700
+ # end
701
+ #
702
+ # # Apply the above configuration only to a new client.
703
+ # client = ::Google::Cloud::StorageInsights::V1::StorageInsights::Rest::Client.new do |config|
704
+ # config.timeout = 10.0
705
+ # config.rpcs.list_report_configs.timeout = 20.0
706
+ # end
707
+ #
708
+ # @!attribute [rw] endpoint
709
+ # The hostname or hostname:port of the service endpoint.
710
+ # Defaults to `"storageinsights.googleapis.com"`.
711
+ # @return [::String]
712
+ # @!attribute [rw] credentials
713
+ # Credentials to send with calls. You may provide any of the following types:
714
+ # * (`String`) The path to a service account key file in JSON format
715
+ # * (`Hash`) A service account key as a Hash
716
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
717
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
718
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
719
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
720
+ # * (`nil`) indicating no credentials
721
+ # @return [::Object]
722
+ # @!attribute [rw] scope
723
+ # The OAuth scopes
724
+ # @return [::Array<::String>]
725
+ # @!attribute [rw] lib_name
726
+ # The library name as recorded in instrumentation and logging
727
+ # @return [::String]
728
+ # @!attribute [rw] lib_version
729
+ # The library version as recorded in instrumentation and logging
730
+ # @return [::String]
731
+ # @!attribute [rw] timeout
732
+ # The call timeout in seconds.
733
+ # @return [::Numeric]
734
+ # @!attribute [rw] metadata
735
+ # Additional headers to be sent with the call.
736
+ # @return [::Hash{::Symbol=>::String}]
737
+ # @!attribute [rw] retry_policy
738
+ # The retry policy. The value is a hash with the following keys:
739
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
740
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
741
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
742
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
743
+ # trigger a retry.
744
+ # @return [::Hash]
745
+ # @!attribute [rw] quota_project
746
+ # A separate project against which to charge quota.
747
+ # @return [::String]
748
+ #
749
+ class Configuration
750
+ extend ::Gapic::Config
751
+
752
+ config_attr :endpoint, "storageinsights.googleapis.com", ::String
753
+ config_attr :credentials, nil do |value|
754
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
755
+ allowed.any? { |klass| klass === value }
756
+ end
757
+ config_attr :scope, nil, ::String, ::Array, nil
758
+ config_attr :lib_name, nil, ::String, nil
759
+ config_attr :lib_version, nil, ::String, nil
760
+ config_attr :timeout, nil, ::Numeric, nil
761
+ config_attr :metadata, nil, ::Hash, nil
762
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
763
+ config_attr :quota_project, nil, ::String, nil
764
+
765
+ # @private
766
+ # Overrides for http bindings for the RPCs of this service
767
+ # are only used when this service is used as mixin, and only
768
+ # by the host service.
769
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
770
+ config_attr :bindings_override, {}, ::Hash, nil
771
+
772
+ # @private
773
+ def initialize parent_config = nil
774
+ @parent_config = parent_config unless parent_config.nil?
775
+
776
+ yield self if block_given?
777
+ end
778
+
779
+ ##
780
+ # Configurations for individual RPCs
781
+ # @return [Rpcs]
782
+ #
783
+ def rpcs
784
+ @rpcs ||= begin
785
+ parent_rpcs = nil
786
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
787
+ Rpcs.new parent_rpcs
788
+ end
789
+ end
790
+
791
+ ##
792
+ # Configuration RPC class for the StorageInsights API.
793
+ #
794
+ # Includes fields providing the configuration for each RPC in this service.
795
+ # Each configuration object is of type `Gapic::Config::Method` and includes
796
+ # the following configuration fields:
797
+ #
798
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
799
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
800
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
801
+ # include the following keys:
802
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
803
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
804
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
805
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
806
+ # trigger a retry.
807
+ #
808
+ class Rpcs
809
+ ##
810
+ # RPC-specific configuration for `list_report_configs`
811
+ # @return [::Gapic::Config::Method]
812
+ #
813
+ attr_reader :list_report_configs
814
+ ##
815
+ # RPC-specific configuration for `get_report_config`
816
+ # @return [::Gapic::Config::Method]
817
+ #
818
+ attr_reader :get_report_config
819
+ ##
820
+ # RPC-specific configuration for `create_report_config`
821
+ # @return [::Gapic::Config::Method]
822
+ #
823
+ attr_reader :create_report_config
824
+ ##
825
+ # RPC-specific configuration for `update_report_config`
826
+ # @return [::Gapic::Config::Method]
827
+ #
828
+ attr_reader :update_report_config
829
+ ##
830
+ # RPC-specific configuration for `delete_report_config`
831
+ # @return [::Gapic::Config::Method]
832
+ #
833
+ attr_reader :delete_report_config
834
+ ##
835
+ # RPC-specific configuration for `list_report_details`
836
+ # @return [::Gapic::Config::Method]
837
+ #
838
+ attr_reader :list_report_details
839
+ ##
840
+ # RPC-specific configuration for `get_report_detail`
841
+ # @return [::Gapic::Config::Method]
842
+ #
843
+ attr_reader :get_report_detail
844
+
845
+ # @private
846
+ def initialize parent_rpcs = nil
847
+ list_report_configs_config = parent_rpcs.list_report_configs if parent_rpcs.respond_to? :list_report_configs
848
+ @list_report_configs = ::Gapic::Config::Method.new list_report_configs_config
849
+ get_report_config_config = parent_rpcs.get_report_config if parent_rpcs.respond_to? :get_report_config
850
+ @get_report_config = ::Gapic::Config::Method.new get_report_config_config
851
+ create_report_config_config = parent_rpcs.create_report_config if parent_rpcs.respond_to? :create_report_config
852
+ @create_report_config = ::Gapic::Config::Method.new create_report_config_config
853
+ update_report_config_config = parent_rpcs.update_report_config if parent_rpcs.respond_to? :update_report_config
854
+ @update_report_config = ::Gapic::Config::Method.new update_report_config_config
855
+ delete_report_config_config = parent_rpcs.delete_report_config if parent_rpcs.respond_to? :delete_report_config
856
+ @delete_report_config = ::Gapic::Config::Method.new delete_report_config_config
857
+ list_report_details_config = parent_rpcs.list_report_details if parent_rpcs.respond_to? :list_report_details
858
+ @list_report_details = ::Gapic::Config::Method.new list_report_details_config
859
+ get_report_detail_config = parent_rpcs.get_report_detail if parent_rpcs.respond_to? :get_report_detail
860
+ @get_report_detail = ::Gapic::Config::Method.new get_report_detail_config
861
+
862
+ yield self if block_given?
863
+ end
864
+ end
865
+ end
866
+ end
867
+ end
868
+ end
869
+ end
870
+ end
871
+ end
872
+ end