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