google-cloud-chronicle-v1 0.4.0 → 0.6.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +6 -6
  4. data/lib/google/cloud/chronicle/v1/big_query_export_pb.rb +34 -0
  5. data/lib/google/cloud/chronicle/v1/big_query_export_service/client.rb +682 -0
  6. data/lib/google/cloud/chronicle/v1/big_query_export_service/credentials.rb +49 -0
  7. data/lib/google/cloud/chronicle/v1/big_query_export_service/paths.rb +71 -0
  8. data/lib/google/cloud/chronicle/v1/big_query_export_service/rest/client.rb +618 -0
  9. data/lib/google/cloud/chronicle/v1/big_query_export_service/rest/service_stub.rb +266 -0
  10. data/lib/google/cloud/chronicle/v1/big_query_export_service/rest.rb +52 -0
  11. data/lib/google/cloud/chronicle/v1/big_query_export_service.rb +55 -0
  12. data/lib/google/cloud/chronicle/v1/big_query_export_services_pb.rb +51 -0
  13. data/lib/google/cloud/chronicle/v1/dashboard_chart_pb.rb +83 -0
  14. data/lib/google/cloud/chronicle/v1/dashboard_chart_service/client.rb +584 -0
  15. data/lib/google/cloud/chronicle/v1/dashboard_chart_service/credentials.rb +49 -0
  16. data/lib/google/cloud/chronicle/v1/dashboard_chart_service/paths.rb +73 -0
  17. data/lib/google/cloud/chronicle/v1/dashboard_chart_service/rest/client.rb +527 -0
  18. data/lib/google/cloud/chronicle/v1/dashboard_chart_service/rest/service_stub.rb +203 -0
  19. data/lib/google/cloud/chronicle/v1/dashboard_chart_service/rest.rb +52 -0
  20. data/lib/google/cloud/chronicle/v1/dashboard_chart_service.rb +55 -0
  21. data/lib/google/cloud/chronicle/v1/dashboard_chart_services_pb.rb +47 -0
  22. data/lib/google/cloud/chronicle/v1/dashboard_query_pb.rb +58 -0
  23. data/lib/google/cloud/chronicle/v1/dashboard_query_service/client.rb +589 -0
  24. data/lib/google/cloud/chronicle/v1/dashboard_query_service/credentials.rb +49 -0
  25. data/lib/google/cloud/chronicle/v1/dashboard_query_service/paths.rb +94 -0
  26. data/lib/google/cloud/chronicle/v1/dashboard_query_service/rest/client.rb +532 -0
  27. data/lib/google/cloud/chronicle/v1/dashboard_query_service/rest/service_stub.rb +204 -0
  28. data/lib/google/cloud/chronicle/v1/dashboard_query_service/rest.rb +52 -0
  29. data/lib/google/cloud/chronicle/v1/dashboard_query_service.rb +55 -0
  30. data/lib/google/cloud/chronicle/v1/dashboard_query_services_pb.rb +47 -0
  31. data/lib/google/cloud/chronicle/v1/data_table_pb.rb +57 -0
  32. data/lib/google/cloud/chronicle/v1/data_table_service/client.rb +1915 -0
  33. data/lib/google/cloud/chronicle/v1/data_table_service/credentials.rb +49 -0
  34. data/lib/google/cloud/chronicle/v1/data_table_service/paths.rb +138 -0
  35. data/lib/google/cloud/chronicle/v1/data_table_service/rest/client.rb +1767 -0
  36. data/lib/google/cloud/chronicle/v1/data_table_service/rest/service_stub.rb +1004 -0
  37. data/lib/google/cloud/chronicle/v1/data_table_service/rest.rb +52 -0
  38. data/lib/google/cloud/chronicle/v1/data_table_service.rb +55 -0
  39. data/lib/google/cloud/chronicle/v1/data_table_services_pb.rb +73 -0
  40. data/lib/google/cloud/chronicle/v1/featured_content_metadata_pb.rb +25 -0
  41. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_pb.rb +33 -0
  42. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/client.rb +717 -0
  43. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/credentials.rb +49 -0
  44. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/paths.rb +136 -0
  45. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/rest/client.rb +653 -0
  46. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/rest/service_stub.rb +265 -0
  47. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/rest.rb +53 -0
  48. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service.rb +56 -0
  49. data/lib/google/cloud/chronicle/v1/featured_content_native_dashboard_services_pb.rb +50 -0
  50. data/lib/google/cloud/chronicle/v1/native_dashboard_pb.rb +61 -0
  51. data/lib/google/cloud/chronicle/v1/native_dashboard_service/client.rb +1611 -0
  52. data/lib/google/cloud/chronicle/v1/native_dashboard_service/credentials.rb +49 -0
  53. data/lib/google/cloud/chronicle/v1/native_dashboard_service/paths.rb +115 -0
  54. data/lib/google/cloud/chronicle/v1/native_dashboard_service/rest/client.rb +1484 -0
  55. data/lib/google/cloud/chronicle/v1/native_dashboard_service/rest/service_stub.rb +822 -0
  56. data/lib/google/cloud/chronicle/v1/native_dashboard_service/rest.rb +52 -0
  57. data/lib/google/cloud/chronicle/v1/native_dashboard_service.rb +55 -0
  58. data/lib/google/cloud/chronicle/v1/native_dashboard_services_pb.rb +67 -0
  59. data/lib/google/cloud/chronicle/v1/rest.rb +7 -1
  60. data/lib/google/cloud/chronicle/v1/version.rb +1 -1
  61. data/lib/google/cloud/chronicle/v1.rb +8 -2
  62. data/proto_docs/google/api/client.rb +149 -29
  63. data/proto_docs/google/cloud/chronicle/v1/big_query_export.rb +142 -0
  64. data/proto_docs/google/cloud/chronicle/v1/dashboard_chart.rb +923 -0
  65. data/proto_docs/google/cloud/chronicle/v1/dashboard_query.rb +653 -0
  66. data/proto_docs/google/cloud/chronicle/v1/data_table.rb +512 -0
  67. data/proto_docs/google/cloud/chronicle/v1/featured_content_metadata.rb +82 -0
  68. data/proto_docs/google/cloud/chronicle/v1/featured_content_native_dashboard.rb +141 -0
  69. data/proto_docs/google/cloud/chronicle/v1/native_dashboard.rb +502 -0
  70. data/proto_docs/google/type/date.rb +56 -0
  71. metadata +71 -9
@@ -0,0 +1,94 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Chronicle
23
+ module V1
24
+ module DashboardQueryService
25
+ # Path helper methods for the DashboardQueryService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified DashboardChart resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/instances/{instance}/dashboardCharts/{chart}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param instance [String]
37
+ # @param chart [String]
38
+ #
39
+ # @return [::String]
40
+ def dashboard_chart_path project:, location:, instance:, chart:
41
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
42
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
43
+ raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/"
44
+
45
+ "projects/#{project}/locations/#{location}/instances/#{instance}/dashboardCharts/#{chart}"
46
+ end
47
+
48
+ ##
49
+ # Create a fully-qualified DashboardQuery resource string.
50
+ #
51
+ # The resource will be in the following format:
52
+ #
53
+ # `projects/{project}/locations/{location}/instances/{instance}/dashboardQueries/{query}`
54
+ #
55
+ # @param project [String]
56
+ # @param location [String]
57
+ # @param instance [String]
58
+ # @param query [String]
59
+ #
60
+ # @return [::String]
61
+ def dashboard_query_path project:, location:, instance:, query:
62
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
63
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
64
+ raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/"
65
+
66
+ "projects/#{project}/locations/#{location}/instances/#{instance}/dashboardQueries/#{query}"
67
+ end
68
+
69
+ ##
70
+ # Create a fully-qualified Instance resource string.
71
+ #
72
+ # The resource will be in the following format:
73
+ #
74
+ # `projects/{project}/locations/{location}/instances/{instance}`
75
+ #
76
+ # @param project [String]
77
+ # @param location [String]
78
+ # @param instance [String]
79
+ #
80
+ # @return [::String]
81
+ def instance_path project:, location:, instance:
82
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
83
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
84
+
85
+ "projects/#{project}/locations/#{location}/instances/#{instance}"
86
+ end
87
+
88
+ extend self
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,532 @@
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/chronicle/v1/dashboard_query_pb"
21
+ require "google/cloud/chronicle/v1/dashboard_query_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Chronicle
26
+ module V1
27
+ module DashboardQueryService
28
+ module Rest
29
+ ##
30
+ # REST client for the DashboardQueryService service.
31
+ #
32
+ # A service providing functionality for managing dashboards' queries.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "chronicle.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :dashboard_query_service_stub
45
+
46
+ ##
47
+ # Configure the DashboardQueryService Client class.
48
+ #
49
+ # See {::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all DashboardQueryService clients
55
+ # ::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "Chronicle", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.rpcs.get_dashboard_query.timeout = 60.0
76
+ default_config.rpcs.get_dashboard_query.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.execute_dashboard_query.timeout = 1800.0
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the DashboardQueryService Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # The effective universe domain
110
+ #
111
+ # @return [String]
112
+ #
113
+ def universe_domain
114
+ @dashboard_query_service_stub.universe_domain
115
+ end
116
+
117
+ ##
118
+ # Create a new DashboardQueryService REST client object.
119
+ #
120
+ # @example
121
+ #
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.new
124
+ #
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
129
+ #
130
+ # @yield [config] Configure the DashboardQueryService client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ def initialize
134
+ # Create the configuration object
135
+ @config = Configuration.new Client.configure
136
+
137
+ # Yield the configuration if needed
138
+ yield @config if block_given?
139
+
140
+ # Create credentials
141
+ credentials = @config.credentials
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
143
+ # but only if the default endpoint does not have a region prefix.
144
+ enable_self_signed_jwt = @config.endpoint.nil? ||
145
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
+ !@config.endpoint.split(".").first.include?("-"))
147
+ credentials ||= Credentials.default scope: @config.scope,
148
+ enable_self_signed_jwt: enable_self_signed_jwt
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
150
+ credentials = Credentials.new credentials, scope: @config.scope
151
+ end
152
+
153
+ @quota_project_id = @config.quota_project
154
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
+
156
+ @dashboard_query_service_stub = ::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::ServiceStub.new(
157
+ endpoint: @config.endpoint,
158
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
+ universe_domain: @config.universe_domain,
160
+ credentials: credentials,
161
+ logger: @config.logger
162
+ )
163
+
164
+ @dashboard_query_service_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @dashboard_query_service_stub.logger
182
+ end
183
+
184
+ # Service calls
185
+
186
+ ##
187
+ # Get a dashboard query.
188
+ #
189
+ # @overload get_dashboard_query(request, options = nil)
190
+ # Pass arguments to `get_dashboard_query` via a request object, either of type
191
+ # {::Google::Cloud::Chronicle::V1::GetDashboardQueryRequest} or an equivalent Hash.
192
+ #
193
+ # @param request [::Google::Cloud::Chronicle::V1::GetDashboardQueryRequest, ::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 get_dashboard_query(name: nil)
200
+ # Pass arguments to `get_dashboard_query` 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 name of the dashboardQuery to retrieve.
206
+ # Format:
207
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}/dashboardQueries/\\{query}
208
+ # @yield [result, operation] Access the result along with the TransportOperation object
209
+ # @yieldparam result [::Google::Cloud::Chronicle::V1::DashboardQuery]
210
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
211
+ #
212
+ # @return [::Google::Cloud::Chronicle::V1::DashboardQuery]
213
+ #
214
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
215
+ #
216
+ # @example Basic example
217
+ # require "google/cloud/chronicle/v1"
218
+ #
219
+ # # Create a client object. The client can be reused for multiple calls.
220
+ # client = Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.new
221
+ #
222
+ # # Create a request. To set request fields, pass in keyword arguments.
223
+ # request = Google::Cloud::Chronicle::V1::GetDashboardQueryRequest.new
224
+ #
225
+ # # Call the get_dashboard_query method.
226
+ # result = client.get_dashboard_query request
227
+ #
228
+ # # The returned object is of type Google::Cloud::Chronicle::V1::DashboardQuery.
229
+ # p result
230
+ #
231
+ def get_dashboard_query request, options = nil
232
+ raise ::ArgumentError, "request must be provided" if request.nil?
233
+
234
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::GetDashboardQueryRequest
235
+
236
+ # Converts hash and nil to an options object
237
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
238
+
239
+ # Customize the options with defaults
240
+ call_metadata = @config.rpcs.get_dashboard_query.metadata.to_h
241
+
242
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
243
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
244
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
245
+ gapic_version: ::Google::Cloud::Chronicle::V1::VERSION,
246
+ transports_version_send: [:rest]
247
+
248
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
249
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
250
+
251
+ options.apply_defaults timeout: @config.rpcs.get_dashboard_query.timeout,
252
+ metadata: call_metadata,
253
+ retry_policy: @config.rpcs.get_dashboard_query.retry_policy
254
+
255
+ options.apply_defaults timeout: @config.timeout,
256
+ metadata: @config.metadata,
257
+ retry_policy: @config.retry_policy
258
+
259
+ @dashboard_query_service_stub.get_dashboard_query request, options do |result, operation|
260
+ yield result, operation if block_given?
261
+ end
262
+ rescue ::Gapic::Rest::Error => e
263
+ raise ::Google::Cloud::Error.from_error(e)
264
+ end
265
+
266
+ ##
267
+ # Execute a query and return the data.
268
+ #
269
+ # @overload execute_dashboard_query(request, options = nil)
270
+ # Pass arguments to `execute_dashboard_query` via a request object, either of type
271
+ # {::Google::Cloud::Chronicle::V1::ExecuteDashboardQueryRequest} or an equivalent Hash.
272
+ #
273
+ # @param request [::Google::Cloud::Chronicle::V1::ExecuteDashboardQueryRequest, ::Hash]
274
+ # A request object representing the call parameters. Required. To specify no
275
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
276
+ # @param options [::Gapic::CallOptions, ::Hash]
277
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
278
+ #
279
+ # @overload execute_dashboard_query(parent: nil, query: nil, filters: nil, clear_cache: nil, use_previous_time_range: nil)
280
+ # Pass arguments to `execute_dashboard_query` via keyword arguments. Note that at
281
+ # least one keyword argument is required. To specify no parameters, or to keep all
282
+ # the default parameter values, pass an empty Hash as a request object (see above).
283
+ #
284
+ # @param parent [::String]
285
+ # Required. The parent, under which to run this dashboardQuery.
286
+ # Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
287
+ # @param query [::Google::Cloud::Chronicle::V1::DashboardQuery, ::Hash]
288
+ # Required. The query to execute and get results back for.
289
+ # QueryID or 'query', 'input.time_window' fields will be used. Use
290
+ # 'native_dashboard' and 'dashboard_chart' fields if it is an in-dashboard
291
+ # query.
292
+ # @param filters [::Array<::Google::Cloud::Chronicle::V1::DashboardFilter, ::Hash>]
293
+ # Optional. Dashboard level filters other than query string.
294
+ # @param clear_cache [::Boolean]
295
+ # Optional. When true, the backend would read from the database, rather than
296
+ # fetching data directly from the cache.
297
+ # @param use_previous_time_range [::Boolean]
298
+ # Optional. When true, the backend will execute the query against the
299
+ # previous time range of the query.
300
+ # @yield [result, operation] Access the result along with the TransportOperation object
301
+ # @yieldparam result [::Google::Cloud::Chronicle::V1::ExecuteDashboardQueryResponse]
302
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
303
+ #
304
+ # @return [::Google::Cloud::Chronicle::V1::ExecuteDashboardQueryResponse]
305
+ #
306
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
307
+ #
308
+ # @example Basic example
309
+ # require "google/cloud/chronicle/v1"
310
+ #
311
+ # # Create a client object. The client can be reused for multiple calls.
312
+ # client = Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.new
313
+ #
314
+ # # Create a request. To set request fields, pass in keyword arguments.
315
+ # request = Google::Cloud::Chronicle::V1::ExecuteDashboardQueryRequest.new
316
+ #
317
+ # # Call the execute_dashboard_query method.
318
+ # result = client.execute_dashboard_query request
319
+ #
320
+ # # The returned object is of type Google::Cloud::Chronicle::V1::ExecuteDashboardQueryResponse.
321
+ # p result
322
+ #
323
+ def execute_dashboard_query request, options = nil
324
+ raise ::ArgumentError, "request must be provided" if request.nil?
325
+
326
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ExecuteDashboardQueryRequest
327
+
328
+ # Converts hash and nil to an options object
329
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
330
+
331
+ # Customize the options with defaults
332
+ call_metadata = @config.rpcs.execute_dashboard_query.metadata.to_h
333
+
334
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
335
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
336
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
337
+ gapic_version: ::Google::Cloud::Chronicle::V1::VERSION,
338
+ transports_version_send: [:rest]
339
+
340
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
341
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
342
+
343
+ options.apply_defaults timeout: @config.rpcs.execute_dashboard_query.timeout,
344
+ metadata: call_metadata,
345
+ retry_policy: @config.rpcs.execute_dashboard_query.retry_policy
346
+
347
+ options.apply_defaults timeout: @config.timeout,
348
+ metadata: @config.metadata,
349
+ retry_policy: @config.retry_policy
350
+
351
+ @dashboard_query_service_stub.execute_dashboard_query request, options do |result, operation|
352
+ yield result, operation if block_given?
353
+ end
354
+ rescue ::Gapic::Rest::Error => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Configuration class for the DashboardQueryService REST API.
360
+ #
361
+ # This class represents the configuration for DashboardQueryService REST,
362
+ # providing control over timeouts, retry behavior, logging, transport
363
+ # parameters, and other low-level controls. Certain parameters can also be
364
+ # applied individually to specific RPCs. See
365
+ # {::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client::Configuration::Rpcs}
366
+ # for a list of RPCs that can be configured independently.
367
+ #
368
+ # Configuration can be applied globally to all clients, or to a single client
369
+ # on construction.
370
+ #
371
+ # @example
372
+ #
373
+ # # Modify the global config, setting the timeout for
374
+ # # get_dashboard_query to 20 seconds,
375
+ # # and all remaining timeouts to 10 seconds.
376
+ # ::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.configure do |config|
377
+ # config.timeout = 10.0
378
+ # config.rpcs.get_dashboard_query.timeout = 20.0
379
+ # end
380
+ #
381
+ # # Apply the above configuration only to a new client.
382
+ # client = ::Google::Cloud::Chronicle::V1::DashboardQueryService::Rest::Client.new do |config|
383
+ # config.timeout = 10.0
384
+ # config.rpcs.get_dashboard_query.timeout = 20.0
385
+ # end
386
+ #
387
+ # @!attribute [rw] endpoint
388
+ # A custom service endpoint, as a hostname or hostname:port. The default is
389
+ # nil, indicating to use the default endpoint in the current universe domain.
390
+ # @return [::String,nil]
391
+ # @!attribute [rw] credentials
392
+ # Credentials to send with calls. You may provide any of the following types:
393
+ # * (`String`) The path to a service account key file in JSON format
394
+ # * (`Hash`) A service account key as a Hash
395
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
396
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
397
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
398
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
399
+ # * (`nil`) indicating no credentials
400
+ #
401
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
402
+ # external source for authentication to Google Cloud, you must validate it before
403
+ # providing it to a Google API client library. Providing an unvalidated credential
404
+ # configuration to Google APIs can compromise the security of your systems and data.
405
+ # For more information, refer to [Validate credential configurations from external
406
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
407
+ # @return [::Object]
408
+ # @!attribute [rw] scope
409
+ # The OAuth scopes
410
+ # @return [::Array<::String>]
411
+ # @!attribute [rw] lib_name
412
+ # The library name as recorded in instrumentation and logging
413
+ # @return [::String]
414
+ # @!attribute [rw] lib_version
415
+ # The library version as recorded in instrumentation and logging
416
+ # @return [::String]
417
+ # @!attribute [rw] timeout
418
+ # The call timeout in seconds.
419
+ # @return [::Numeric]
420
+ # @!attribute [rw] metadata
421
+ # Additional headers to be sent with the call.
422
+ # @return [::Hash{::Symbol=>::String}]
423
+ # @!attribute [rw] retry_policy
424
+ # The retry policy. The value is a hash with the following keys:
425
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
426
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
427
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
428
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
429
+ # trigger a retry.
430
+ # @return [::Hash]
431
+ # @!attribute [rw] quota_project
432
+ # A separate project against which to charge quota.
433
+ # @return [::String]
434
+ # @!attribute [rw] universe_domain
435
+ # The universe domain within which to make requests. This determines the
436
+ # default endpoint URL. The default value of nil uses the environment
437
+ # universe (usually the default "googleapis.com" universe).
438
+ # @return [::String,nil]
439
+ # @!attribute [rw] logger
440
+ # A custom logger to use for request/response debug logging, or the value
441
+ # `:default` (the default) to construct a default logger, or `nil` to
442
+ # explicitly disable logging.
443
+ # @return [::Logger,:default,nil]
444
+ #
445
+ class Configuration
446
+ extend ::Gapic::Config
447
+
448
+ # @private
449
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
450
+ DEFAULT_ENDPOINT = "chronicle.googleapis.com"
451
+
452
+ config_attr :endpoint, nil, ::String, nil
453
+ config_attr :credentials, nil do |value|
454
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
455
+ allowed.any? { |klass| klass === value }
456
+ end
457
+ config_attr :scope, nil, ::String, ::Array, nil
458
+ config_attr :lib_name, nil, ::String, nil
459
+ config_attr :lib_version, nil, ::String, nil
460
+ config_attr :timeout, nil, ::Numeric, nil
461
+ config_attr :metadata, nil, ::Hash, nil
462
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
463
+ config_attr :quota_project, nil, ::String, nil
464
+ config_attr :universe_domain, nil, ::String, nil
465
+ config_attr :logger, :default, ::Logger, nil, :default
466
+
467
+ # @private
468
+ def initialize parent_config = nil
469
+ @parent_config = parent_config unless parent_config.nil?
470
+
471
+ yield self if block_given?
472
+ end
473
+
474
+ ##
475
+ # Configurations for individual RPCs
476
+ # @return [Rpcs]
477
+ #
478
+ def rpcs
479
+ @rpcs ||= begin
480
+ parent_rpcs = nil
481
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
482
+ Rpcs.new parent_rpcs
483
+ end
484
+ end
485
+
486
+ ##
487
+ # Configuration RPC class for the DashboardQueryService API.
488
+ #
489
+ # Includes fields providing the configuration for each RPC in this service.
490
+ # Each configuration object is of type `Gapic::Config::Method` and includes
491
+ # the following configuration fields:
492
+ #
493
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
494
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
495
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
496
+ # include the following keys:
497
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
498
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
499
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
500
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
501
+ # trigger a retry.
502
+ #
503
+ class Rpcs
504
+ ##
505
+ # RPC-specific configuration for `get_dashboard_query`
506
+ # @return [::Gapic::Config::Method]
507
+ #
508
+ attr_reader :get_dashboard_query
509
+ ##
510
+ # RPC-specific configuration for `execute_dashboard_query`
511
+ # @return [::Gapic::Config::Method]
512
+ #
513
+ attr_reader :execute_dashboard_query
514
+
515
+ # @private
516
+ def initialize parent_rpcs = nil
517
+ get_dashboard_query_config = parent_rpcs.get_dashboard_query if parent_rpcs.respond_to? :get_dashboard_query
518
+ @get_dashboard_query = ::Gapic::Config::Method.new get_dashboard_query_config
519
+ execute_dashboard_query_config = parent_rpcs.execute_dashboard_query if parent_rpcs.respond_to? :execute_dashboard_query
520
+ @execute_dashboard_query = ::Gapic::Config::Method.new execute_dashboard_query_config
521
+
522
+ yield self if block_given?
523
+ end
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end
531
+ end
532
+ end