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