google-cloud-channel-v1 0.12.0 → 0.13.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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +7 -7
- data/README.md +3 -3
- data/lib/google/cloud/channel/v1/cloud_channel_reports_service/client.rb +685 -0
- data/lib/google/cloud/channel/v1/cloud_channel_reports_service/credentials.rb +51 -0
- data/lib/google/cloud/channel/v1/cloud_channel_reports_service/operations.rb +770 -0
- data/lib/google/cloud/channel/v1/cloud_channel_reports_service/paths.rb +67 -0
- data/lib/google/cloud/channel/v1/cloud_channel_reports_service.rb +53 -0
- data/lib/google/cloud/channel/v1/cloud_channel_service/client.rb +4 -3
- data/lib/google/cloud/channel/v1/reports_service_pb.rb +136 -0
- data/lib/google/cloud/channel/v1/reports_service_services_pb.rb +76 -0
- data/lib/google/cloud/channel/v1/service_services_pb.rb +2 -1
- data/lib/google/cloud/channel/v1/version.rb +1 -1
- data/lib/google/cloud/channel/v1.rb +2 -1
- data/proto_docs/google/cloud/channel/v1/reports_service.rb +375 -0
- data/proto_docs/google/cloud/channel/v1/service.rb +2 -2
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/type/datetime.rb +99 -0
- metadata +13 -4
@@ -0,0 +1,685 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/channel/v1/reports_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Channel
|
25
|
+
module V1
|
26
|
+
module CloudChannelReportsService
|
27
|
+
##
|
28
|
+
# Client for the CloudChannelReportsService service.
|
29
|
+
#
|
30
|
+
# CloudChannelReportsService lets Google Cloud resellers and
|
31
|
+
# distributors retrieve and combine a variety of data in Cloud Channel for
|
32
|
+
# multiple products (Google Cloud Platform (GCP), Google Voice, and
|
33
|
+
# Google Workspace.)
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :cloud_channel_reports_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the CloudChannelReportsService Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all CloudChannelReportsService clients
|
50
|
+
# ::Google::Cloud::Channel::V1::CloudChannelReportsService::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", "Channel", "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
|
71
|
+
end
|
72
|
+
yield @configure if block_given?
|
73
|
+
@configure
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Configure the CloudChannelReportsService Client instance.
|
78
|
+
#
|
79
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
80
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
81
|
+
# should be made on {Client.configure}.
|
82
|
+
#
|
83
|
+
# See {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client::Configuration}
|
84
|
+
# for a description of the configuration fields.
|
85
|
+
#
|
86
|
+
# @yield [config] Configure the Client client.
|
87
|
+
# @yieldparam config [Client::Configuration]
|
88
|
+
#
|
89
|
+
# @return [Client::Configuration]
|
90
|
+
#
|
91
|
+
def configure
|
92
|
+
yield @config if block_given?
|
93
|
+
@config
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Create a new CloudChannelReportsService client object.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
#
|
101
|
+
# # Create a client using the default configuration
|
102
|
+
# client = ::Google::Cloud::Channel::V1::CloudChannelReportsService::Client.new
|
103
|
+
#
|
104
|
+
# # Create a client using a custom configuration
|
105
|
+
# client = ::Google::Cloud::Channel::V1::CloudChannelReportsService::Client.new do |config|
|
106
|
+
# config.timeout = 10.0
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the CloudChannelReportsService client.
|
110
|
+
# @yieldparam config [Client::Configuration]
|
111
|
+
#
|
112
|
+
def initialize
|
113
|
+
# These require statements are intentionally placed here to initialize
|
114
|
+
# the gRPC module only when it's required.
|
115
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
116
|
+
require "gapic/grpc"
|
117
|
+
require "google/cloud/channel/v1/reports_service_services_pb"
|
118
|
+
|
119
|
+
# Create the configuration object
|
120
|
+
@config = Configuration.new Client.configure
|
121
|
+
|
122
|
+
# Yield the configuration if needed
|
123
|
+
yield @config if block_given?
|
124
|
+
|
125
|
+
# Create credentials
|
126
|
+
credentials = @config.credentials
|
127
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
128
|
+
# but only if the default endpoint does not have a region prefix.
|
129
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
130
|
+
!@config.endpoint.split(".").first.include?("-")
|
131
|
+
credentials ||= Credentials.default scope: @config.scope,
|
132
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
133
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
134
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
135
|
+
end
|
136
|
+
@quota_project_id = @config.quota_project
|
137
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
138
|
+
|
139
|
+
@operations_client = Operations.new do |config|
|
140
|
+
config.credentials = credentials
|
141
|
+
config.quota_project = @quota_project_id
|
142
|
+
config.endpoint = @config.endpoint
|
143
|
+
end
|
144
|
+
|
145
|
+
@cloud_channel_reports_service_stub = ::Gapic::ServiceStub.new(
|
146
|
+
::Google::Cloud::Channel::V1::CloudChannelReportsService::Stub,
|
147
|
+
credentials: credentials,
|
148
|
+
endpoint: @config.endpoint,
|
149
|
+
channel_args: @config.channel_args,
|
150
|
+
interceptors: @config.interceptors
|
151
|
+
)
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Get the associated client for long-running operations.
|
156
|
+
#
|
157
|
+
# @return [::Google::Cloud::Channel::V1::CloudChannelReportsService::Operations]
|
158
|
+
#
|
159
|
+
attr_reader :operations_client
|
160
|
+
|
161
|
+
# Service calls
|
162
|
+
|
163
|
+
##
|
164
|
+
# Begins generation of data for a given report. The report
|
165
|
+
# identifier is a UID (for example, `613bf59q`).
|
166
|
+
#
|
167
|
+
# Possible error codes:
|
168
|
+
#
|
169
|
+
# * PERMISSION_DENIED: The user doesn't have access to this report.
|
170
|
+
# * INVALID_ARGUMENT: Required request parameters are missing
|
171
|
+
# or invalid.
|
172
|
+
# * NOT_FOUND: The report identifier was not found.
|
173
|
+
# * INTERNAL: Any non-user error related to a technical issue
|
174
|
+
# in the backend. Contact Cloud Channel support.
|
175
|
+
# * UNKNOWN: Any non-user error related to a technical issue
|
176
|
+
# in the backend. Contact Cloud Channel support.
|
177
|
+
#
|
178
|
+
# Return value:
|
179
|
+
# The ID of a long-running operation.
|
180
|
+
#
|
181
|
+
# To get the results of the operation, call the GetOperation method of
|
182
|
+
# CloudChannelOperationsService. The Operation metadata contains an
|
183
|
+
# instance of {::Google::Cloud::Channel::V1::OperationMetadata OperationMetadata}.
|
184
|
+
#
|
185
|
+
# To get the results of report generation, call
|
186
|
+
# {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client#fetch_report_results CloudChannelReportsService.FetchReportResults} with the
|
187
|
+
# {::Google::Cloud::Channel::V1::RunReportJobResponse#report_job RunReportJobResponse.report_job}.
|
188
|
+
#
|
189
|
+
# @overload run_report_job(request, options = nil)
|
190
|
+
# Pass arguments to `run_report_job` via a request object, either of type
|
191
|
+
# {::Google::Cloud::Channel::V1::RunReportJobRequest} or an equivalent Hash.
|
192
|
+
#
|
193
|
+
# @param request [::Google::Cloud::Channel::V1::RunReportJobRequest, ::Hash]
|
194
|
+
# A request object representing the call parameters. Required. To specify no
|
195
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
196
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
197
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
198
|
+
#
|
199
|
+
# @overload run_report_job(name: nil, date_range: nil, filter: nil, language_code: nil)
|
200
|
+
# Pass arguments to `run_report_job` via keyword arguments. Note that at
|
201
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
202
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
203
|
+
#
|
204
|
+
# @param name [::String]
|
205
|
+
# Required. The report's resource name. Specifies the account and report used to
|
206
|
+
# generate report data. The report_id identifier is a UID (for example,
|
207
|
+
# `613bf59q`).
|
208
|
+
# Name uses the format:
|
209
|
+
# accounts/\\{account_id}/reports/\\{report_id}
|
210
|
+
# @param date_range [::Google::Cloud::Channel::V1::DateRange, ::Hash]
|
211
|
+
# Optional. The range of usage or invoice dates to include in the result.
|
212
|
+
# @param filter [::String]
|
213
|
+
# Optional. A structured string that defines conditions on dimension columns to
|
214
|
+
# restrict the report output.
|
215
|
+
#
|
216
|
+
# Filters support logical operators (AND, OR, NOT) and conditional operators
|
217
|
+
# (=, !=, <, >, <=, and >=) using `column_id` as keys.
|
218
|
+
#
|
219
|
+
# For example:
|
220
|
+
# `(customer:"accounts/C123abc/customers/S456def" OR
|
221
|
+
# customer:"accounts/C123abc/customers/S789ghi") AND
|
222
|
+
# invoice_start_date.year >= 2022`
|
223
|
+
# @param language_code [::String]
|
224
|
+
# Optional. The BCP-47 language code, such as "en-US". If specified, the
|
225
|
+
# response is localized to the corresponding language code if the
|
226
|
+
# original data sources support it.
|
227
|
+
# Default is "en-US".
|
228
|
+
#
|
229
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
230
|
+
# @yieldparam response [::Gapic::Operation]
|
231
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
232
|
+
#
|
233
|
+
# @return [::Gapic::Operation]
|
234
|
+
#
|
235
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
236
|
+
#
|
237
|
+
# @example Basic example
|
238
|
+
# require "google/cloud/channel/v1"
|
239
|
+
#
|
240
|
+
# # Create a client object. The client can be reused for multiple calls.
|
241
|
+
# client = Google::Cloud::Channel::V1::CloudChannelReportsService::Client.new
|
242
|
+
#
|
243
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
244
|
+
# request = Google::Cloud::Channel::V1::RunReportJobRequest.new
|
245
|
+
#
|
246
|
+
# # Call the run_report_job method.
|
247
|
+
# result = client.run_report_job request
|
248
|
+
#
|
249
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
250
|
+
# # object to check the status of an operation, cancel it, or wait
|
251
|
+
# # for results. Here is how to block until completion:
|
252
|
+
# result.wait_until_done! timeout: 60
|
253
|
+
# if result.response?
|
254
|
+
# p result.response
|
255
|
+
# else
|
256
|
+
# puts "Error!"
|
257
|
+
# end
|
258
|
+
#
|
259
|
+
def run_report_job request, options = nil
|
260
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
261
|
+
|
262
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Channel::V1::RunReportJobRequest
|
263
|
+
|
264
|
+
# Converts hash and nil to an options object
|
265
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
266
|
+
|
267
|
+
# Customize the options with defaults
|
268
|
+
metadata = @config.rpcs.run_report_job.metadata.to_h
|
269
|
+
|
270
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
271
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
272
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
273
|
+
gapic_version: ::Google::Cloud::Channel::V1::VERSION
|
274
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
275
|
+
|
276
|
+
header_params = {}
|
277
|
+
if request.name
|
278
|
+
header_params["name"] = request.name
|
279
|
+
end
|
280
|
+
|
281
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
282
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
283
|
+
|
284
|
+
options.apply_defaults timeout: @config.rpcs.run_report_job.timeout,
|
285
|
+
metadata: metadata,
|
286
|
+
retry_policy: @config.rpcs.run_report_job.retry_policy
|
287
|
+
|
288
|
+
options.apply_defaults timeout: @config.timeout,
|
289
|
+
metadata: @config.metadata,
|
290
|
+
retry_policy: @config.retry_policy
|
291
|
+
|
292
|
+
@cloud_channel_reports_service_stub.call_rpc :run_report_job, request, options: options do |response, operation|
|
293
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
294
|
+
yield response, operation if block_given?
|
295
|
+
return response
|
296
|
+
end
|
297
|
+
rescue ::GRPC::BadStatus => e
|
298
|
+
raise ::Google::Cloud::Error.from_error(e)
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# Retrieves data generated by {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client#run_report_job CloudChannelReportsService.RunReportJob}.
|
303
|
+
#
|
304
|
+
# @overload fetch_report_results(request, options = nil)
|
305
|
+
# Pass arguments to `fetch_report_results` via a request object, either of type
|
306
|
+
# {::Google::Cloud::Channel::V1::FetchReportResultsRequest} or an equivalent Hash.
|
307
|
+
#
|
308
|
+
# @param request [::Google::Cloud::Channel::V1::FetchReportResultsRequest, ::Hash]
|
309
|
+
# A request object representing the call parameters. Required. To specify no
|
310
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
311
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
312
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
313
|
+
#
|
314
|
+
# @overload fetch_report_results(report_job: nil, page_size: nil, page_token: nil)
|
315
|
+
# Pass arguments to `fetch_report_results` via keyword arguments. Note that at
|
316
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
317
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
318
|
+
#
|
319
|
+
# @param report_job [::String]
|
320
|
+
# Required. The report job created by {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client#run_report_job CloudChannelReportsService.RunReportJob}.
|
321
|
+
# Report_job uses the format:
|
322
|
+
# accounts/\\{account_id}/reportJobs/\\{report_job_id}
|
323
|
+
# @param page_size [::Integer]
|
324
|
+
# Optional. Requested page size of the report. The server may return fewer results than
|
325
|
+
# requested. If you don't specify a page size, the server uses a sensible
|
326
|
+
# default (may change over time).
|
327
|
+
#
|
328
|
+
# The maximum value is 30,000; the server will change larger values to
|
329
|
+
# 30,000.
|
330
|
+
# @param page_token [::String]
|
331
|
+
# Optional. A token that specifies a page of results beyond the first page.
|
332
|
+
# Obtained through
|
333
|
+
# {::Google::Cloud::Channel::V1::FetchReportResultsResponse#next_page_token FetchReportResultsResponse.next_page_token} of the previous
|
334
|
+
# {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client#fetch_report_results CloudChannelReportsService.FetchReportResults} call.
|
335
|
+
#
|
336
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
337
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Channel::V1::Row>]
|
338
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
339
|
+
#
|
340
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Channel::V1::Row>]
|
341
|
+
#
|
342
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
343
|
+
#
|
344
|
+
# @example Basic example
|
345
|
+
# require "google/cloud/channel/v1"
|
346
|
+
#
|
347
|
+
# # Create a client object. The client can be reused for multiple calls.
|
348
|
+
# client = Google::Cloud::Channel::V1::CloudChannelReportsService::Client.new
|
349
|
+
#
|
350
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
351
|
+
# request = Google::Cloud::Channel::V1::FetchReportResultsRequest.new
|
352
|
+
#
|
353
|
+
# # Call the fetch_report_results method.
|
354
|
+
# result = client.fetch_report_results request
|
355
|
+
#
|
356
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
357
|
+
# # iterate over all elements by calling #each, and the enumerable
|
358
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
359
|
+
# # methods are also available for managing paging directly.
|
360
|
+
# result.each do |response|
|
361
|
+
# # Each element is of type ::Google::Cloud::Channel::V1::Row.
|
362
|
+
# p response
|
363
|
+
# end
|
364
|
+
#
|
365
|
+
def fetch_report_results request, options = nil
|
366
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
367
|
+
|
368
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Channel::V1::FetchReportResultsRequest
|
369
|
+
|
370
|
+
# Converts hash and nil to an options object
|
371
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
372
|
+
|
373
|
+
# Customize the options with defaults
|
374
|
+
metadata = @config.rpcs.fetch_report_results.metadata.to_h
|
375
|
+
|
376
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
377
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
378
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
379
|
+
gapic_version: ::Google::Cloud::Channel::V1::VERSION
|
380
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
381
|
+
|
382
|
+
header_params = {}
|
383
|
+
if request.report_job
|
384
|
+
header_params["report_job"] = request.report_job
|
385
|
+
end
|
386
|
+
|
387
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
388
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.rpcs.fetch_report_results.timeout,
|
391
|
+
metadata: metadata,
|
392
|
+
retry_policy: @config.rpcs.fetch_report_results.retry_policy
|
393
|
+
|
394
|
+
options.apply_defaults timeout: @config.timeout,
|
395
|
+
metadata: @config.metadata,
|
396
|
+
retry_policy: @config.retry_policy
|
397
|
+
|
398
|
+
@cloud_channel_reports_service_stub.call_rpc :fetch_report_results, request, options: options do |response, operation|
|
399
|
+
response = ::Gapic::PagedEnumerable.new @cloud_channel_reports_service_stub, :fetch_report_results, request, response, operation, options
|
400
|
+
yield response, operation if block_given?
|
401
|
+
return response
|
402
|
+
end
|
403
|
+
rescue ::GRPC::BadStatus => e
|
404
|
+
raise ::Google::Cloud::Error.from_error(e)
|
405
|
+
end
|
406
|
+
|
407
|
+
##
|
408
|
+
# Lists the reports that RunReportJob can run. These reports include an ID,
|
409
|
+
# a description, and the list of columns that will be in the result.
|
410
|
+
#
|
411
|
+
# @overload list_reports(request, options = nil)
|
412
|
+
# Pass arguments to `list_reports` via a request object, either of type
|
413
|
+
# {::Google::Cloud::Channel::V1::ListReportsRequest} or an equivalent Hash.
|
414
|
+
#
|
415
|
+
# @param request [::Google::Cloud::Channel::V1::ListReportsRequest, ::Hash]
|
416
|
+
# A request object representing the call parameters. Required. To specify no
|
417
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
418
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
419
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
420
|
+
#
|
421
|
+
# @overload list_reports(parent: nil, page_size: nil, page_token: nil, language_code: nil)
|
422
|
+
# Pass arguments to `list_reports` via keyword arguments. Note that at
|
423
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
424
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
425
|
+
#
|
426
|
+
# @param parent [::String]
|
427
|
+
# Required. The resource name of the partner account to list available reports for.
|
428
|
+
# Parent uses the format:
|
429
|
+
# accounts/\\{account_id}
|
430
|
+
# @param page_size [::Integer]
|
431
|
+
# Optional. Requested page size of the report. The server might return fewer results
|
432
|
+
# than requested. If unspecified, returns 20 reports.
|
433
|
+
# The maximum value is 100.
|
434
|
+
# @param page_token [::String]
|
435
|
+
# Optional. A token that specifies a page of results beyond the first page.
|
436
|
+
# Obtained through
|
437
|
+
# {::Google::Cloud::Channel::V1::ListReportsResponse#next_page_token ListReportsResponse.next_page_token} of the previous
|
438
|
+
# {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client#list_reports CloudChannelReportsService.ListReports} call.
|
439
|
+
# @param language_code [::String]
|
440
|
+
# Optional. The BCP-47 language code, such as "en-US". If specified, the
|
441
|
+
# response is localized to the corresponding language code if the
|
442
|
+
# original data sources support it.
|
443
|
+
# Default is "en-US".
|
444
|
+
#
|
445
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
446
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Channel::V1::Report>]
|
447
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
448
|
+
#
|
449
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Channel::V1::Report>]
|
450
|
+
#
|
451
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
452
|
+
#
|
453
|
+
# @example Basic example
|
454
|
+
# require "google/cloud/channel/v1"
|
455
|
+
#
|
456
|
+
# # Create a client object. The client can be reused for multiple calls.
|
457
|
+
# client = Google::Cloud::Channel::V1::CloudChannelReportsService::Client.new
|
458
|
+
#
|
459
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
460
|
+
# request = Google::Cloud::Channel::V1::ListReportsRequest.new
|
461
|
+
#
|
462
|
+
# # Call the list_reports method.
|
463
|
+
# result = client.list_reports request
|
464
|
+
#
|
465
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
466
|
+
# # iterate over all elements by calling #each, and the enumerable
|
467
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
468
|
+
# # methods are also available for managing paging directly.
|
469
|
+
# result.each do |response|
|
470
|
+
# # Each element is of type ::Google::Cloud::Channel::V1::Report.
|
471
|
+
# p response
|
472
|
+
# end
|
473
|
+
#
|
474
|
+
def list_reports request, options = nil
|
475
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
476
|
+
|
477
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Channel::V1::ListReportsRequest
|
478
|
+
|
479
|
+
# Converts hash and nil to an options object
|
480
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
481
|
+
|
482
|
+
# Customize the options with defaults
|
483
|
+
metadata = @config.rpcs.list_reports.metadata.to_h
|
484
|
+
|
485
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
486
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
487
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
488
|
+
gapic_version: ::Google::Cloud::Channel::V1::VERSION
|
489
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
490
|
+
|
491
|
+
header_params = {}
|
492
|
+
if request.parent
|
493
|
+
header_params["parent"] = request.parent
|
494
|
+
end
|
495
|
+
|
496
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
497
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
498
|
+
|
499
|
+
options.apply_defaults timeout: @config.rpcs.list_reports.timeout,
|
500
|
+
metadata: metadata,
|
501
|
+
retry_policy: @config.rpcs.list_reports.retry_policy
|
502
|
+
|
503
|
+
options.apply_defaults timeout: @config.timeout,
|
504
|
+
metadata: @config.metadata,
|
505
|
+
retry_policy: @config.retry_policy
|
506
|
+
|
507
|
+
@cloud_channel_reports_service_stub.call_rpc :list_reports, request, options: options do |response, operation|
|
508
|
+
response = ::Gapic::PagedEnumerable.new @cloud_channel_reports_service_stub, :list_reports, request, response, operation, options
|
509
|
+
yield response, operation if block_given?
|
510
|
+
return response
|
511
|
+
end
|
512
|
+
rescue ::GRPC::BadStatus => e
|
513
|
+
raise ::Google::Cloud::Error.from_error(e)
|
514
|
+
end
|
515
|
+
|
516
|
+
##
|
517
|
+
# Configuration class for the CloudChannelReportsService API.
|
518
|
+
#
|
519
|
+
# This class represents the configuration for CloudChannelReportsService,
|
520
|
+
# providing control over timeouts, retry behavior, logging, transport
|
521
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
522
|
+
# applied individually to specific RPCs. See
|
523
|
+
# {::Google::Cloud::Channel::V1::CloudChannelReportsService::Client::Configuration::Rpcs}
|
524
|
+
# for a list of RPCs that can be configured independently.
|
525
|
+
#
|
526
|
+
# Configuration can be applied globally to all clients, or to a single client
|
527
|
+
# on construction.
|
528
|
+
#
|
529
|
+
# @example
|
530
|
+
#
|
531
|
+
# # Modify the global config, setting the timeout for
|
532
|
+
# # run_report_job to 20 seconds,
|
533
|
+
# # and all remaining timeouts to 10 seconds.
|
534
|
+
# ::Google::Cloud::Channel::V1::CloudChannelReportsService::Client.configure do |config|
|
535
|
+
# config.timeout = 10.0
|
536
|
+
# config.rpcs.run_report_job.timeout = 20.0
|
537
|
+
# end
|
538
|
+
#
|
539
|
+
# # Apply the above configuration only to a new client.
|
540
|
+
# client = ::Google::Cloud::Channel::V1::CloudChannelReportsService::Client.new do |config|
|
541
|
+
# config.timeout = 10.0
|
542
|
+
# config.rpcs.run_report_job.timeout = 20.0
|
543
|
+
# end
|
544
|
+
#
|
545
|
+
# @!attribute [rw] endpoint
|
546
|
+
# The hostname or hostname:port of the service endpoint.
|
547
|
+
# Defaults to `"cloudchannel.googleapis.com"`.
|
548
|
+
# @return [::String]
|
549
|
+
# @!attribute [rw] credentials
|
550
|
+
# Credentials to send with calls. You may provide any of the following types:
|
551
|
+
# * (`String`) The path to a service account key file in JSON format
|
552
|
+
# * (`Hash`) A service account key as a Hash
|
553
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
554
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
555
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
556
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
557
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
558
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
559
|
+
# * (`nil`) indicating no credentials
|
560
|
+
# @return [::Object]
|
561
|
+
# @!attribute [rw] scope
|
562
|
+
# The OAuth scopes
|
563
|
+
# @return [::Array<::String>]
|
564
|
+
# @!attribute [rw] lib_name
|
565
|
+
# The library name as recorded in instrumentation and logging
|
566
|
+
# @return [::String]
|
567
|
+
# @!attribute [rw] lib_version
|
568
|
+
# The library version as recorded in instrumentation and logging
|
569
|
+
# @return [::String]
|
570
|
+
# @!attribute [rw] channel_args
|
571
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
572
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
573
|
+
# @return [::Hash]
|
574
|
+
# @!attribute [rw] interceptors
|
575
|
+
# An array of interceptors that are run before calls are executed.
|
576
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
577
|
+
# @!attribute [rw] timeout
|
578
|
+
# The call timeout in seconds.
|
579
|
+
# @return [::Numeric]
|
580
|
+
# @!attribute [rw] metadata
|
581
|
+
# Additional gRPC headers to be sent with the call.
|
582
|
+
# @return [::Hash{::Symbol=>::String}]
|
583
|
+
# @!attribute [rw] retry_policy
|
584
|
+
# The retry policy. The value is a hash with the following keys:
|
585
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
586
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
587
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
588
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
589
|
+
# trigger a retry.
|
590
|
+
# @return [::Hash]
|
591
|
+
# @!attribute [rw] quota_project
|
592
|
+
# A separate project against which to charge quota.
|
593
|
+
# @return [::String]
|
594
|
+
#
|
595
|
+
class Configuration
|
596
|
+
extend ::Gapic::Config
|
597
|
+
|
598
|
+
config_attr :endpoint, "cloudchannel.googleapis.com", ::String
|
599
|
+
config_attr :credentials, nil do |value|
|
600
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
601
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
602
|
+
allowed.any? { |klass| klass === value }
|
603
|
+
end
|
604
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
605
|
+
config_attr :lib_name, nil, ::String, nil
|
606
|
+
config_attr :lib_version, nil, ::String, nil
|
607
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
608
|
+
config_attr :interceptors, nil, ::Array, nil
|
609
|
+
config_attr :timeout, nil, ::Numeric, nil
|
610
|
+
config_attr :metadata, nil, ::Hash, nil
|
611
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
612
|
+
config_attr :quota_project, nil, ::String, nil
|
613
|
+
|
614
|
+
# @private
|
615
|
+
def initialize parent_config = nil
|
616
|
+
@parent_config = parent_config unless parent_config.nil?
|
617
|
+
|
618
|
+
yield self if block_given?
|
619
|
+
end
|
620
|
+
|
621
|
+
##
|
622
|
+
# Configurations for individual RPCs
|
623
|
+
# @return [Rpcs]
|
624
|
+
#
|
625
|
+
def rpcs
|
626
|
+
@rpcs ||= begin
|
627
|
+
parent_rpcs = nil
|
628
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
629
|
+
Rpcs.new parent_rpcs
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
##
|
634
|
+
# Configuration RPC class for the CloudChannelReportsService API.
|
635
|
+
#
|
636
|
+
# Includes fields providing the configuration for each RPC in this service.
|
637
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
638
|
+
# the following configuration fields:
|
639
|
+
#
|
640
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
641
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
642
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
643
|
+
# include the following keys:
|
644
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
645
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
646
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
647
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
648
|
+
# trigger a retry.
|
649
|
+
#
|
650
|
+
class Rpcs
|
651
|
+
##
|
652
|
+
# RPC-specific configuration for `run_report_job`
|
653
|
+
# @return [::Gapic::Config::Method]
|
654
|
+
#
|
655
|
+
attr_reader :run_report_job
|
656
|
+
##
|
657
|
+
# RPC-specific configuration for `fetch_report_results`
|
658
|
+
# @return [::Gapic::Config::Method]
|
659
|
+
#
|
660
|
+
attr_reader :fetch_report_results
|
661
|
+
##
|
662
|
+
# RPC-specific configuration for `list_reports`
|
663
|
+
# @return [::Gapic::Config::Method]
|
664
|
+
#
|
665
|
+
attr_reader :list_reports
|
666
|
+
|
667
|
+
# @private
|
668
|
+
def initialize parent_rpcs = nil
|
669
|
+
run_report_job_config = parent_rpcs.run_report_job if parent_rpcs.respond_to? :run_report_job
|
670
|
+
@run_report_job = ::Gapic::Config::Method.new run_report_job_config
|
671
|
+
fetch_report_results_config = parent_rpcs.fetch_report_results if parent_rpcs.respond_to? :fetch_report_results
|
672
|
+
@fetch_report_results = ::Gapic::Config::Method.new fetch_report_results_config
|
673
|
+
list_reports_config = parent_rpcs.list_reports if parent_rpcs.respond_to? :list_reports
|
674
|
+
@list_reports = ::Gapic::Config::Method.new list_reports_config
|
675
|
+
|
676
|
+
yield self if block_given?
|
677
|
+
end
|
678
|
+
end
|
679
|
+
end
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
end
|
684
|
+
end
|
685
|
+
end
|