google-cloud-chronicle-v1 1.3.0 → 1.4.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/lib/google/cloud/chronicle/v1/entity_pb.rb +6 -1
- data/lib/google/cloud/chronicle/v1/event_pb.rb +24 -0
- data/lib/google/cloud/chronicle/v1/rest.rb +1 -0
- data/lib/google/cloud/chronicle/v1/search_pb.rb +64 -0
- data/lib/google/cloud/chronicle/v1/search_service/client.rb +643 -0
- data/lib/google/cloud/chronicle/v1/search_service/credentials.rb +49 -0
- data/lib/google/cloud/chronicle/v1/search_service/operations.rb +843 -0
- data/lib/google/cloud/chronicle/v1/search_service/paths.rb +94 -0
- data/lib/google/cloud/chronicle/v1/search_service/rest/client.rb +586 -0
- data/lib/google/cloud/chronicle/v1/search_service/rest/operations.rb +927 -0
- data/lib/google/cloud/chronicle/v1/search_service/rest/service_stub.rb +204 -0
- data/lib/google/cloud/chronicle/v1/search_service/rest.rb +53 -0
- data/lib/google/cloud/chronicle/v1/search_service.rb +56 -0
- data/lib/google/cloud/chronicle/v1/search_services_pb.rb +47 -0
- data/lib/google/cloud/chronicle/v1/simulated_data_pb.rb +21 -0
- data/lib/google/cloud/chronicle/v1/version.rb +1 -1
- data/lib/google/cloud/chronicle/v1.rb +1 -0
- data/proto_docs/backstory/collection.rb +371 -0
- data/proto_docs/backstory/data_access.rb +59 -0
- data/proto_docs/backstory/entity.rb +639 -0
- data/proto_docs/backstory/entity_risk.rb +98 -0
- data/proto_docs/backstory/id.rb +73 -0
- data/proto_docs/backstory/udm.rb +7008 -0
- data/proto_docs/google/cloud/chronicle/v1/entity.rb +38 -0
- data/proto_docs/google/cloud/chronicle/v1/event.rb +42 -0
- data/proto_docs/google/cloud/chronicle/v1/search.rb +593 -0
- data/proto_docs/google/cloud/chronicle/v1/simulated_data.rb +40 -0
- data/proto_docs/google/protobuf/struct.rb +108 -0
- data/proto_docs/google/type/latlng.rb +38 -0
- metadata +45 -1
|
@@ -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 SearchService
|
|
25
|
+
# Path helper methods for the SearchService API.
|
|
26
|
+
module Paths
|
|
27
|
+
##
|
|
28
|
+
# Create a fully-qualified DataAccessScope resource string.
|
|
29
|
+
#
|
|
30
|
+
# The resource will be in the following format:
|
|
31
|
+
#
|
|
32
|
+
# `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
|
|
33
|
+
#
|
|
34
|
+
# @param project [String]
|
|
35
|
+
# @param location [String]
|
|
36
|
+
# @param instance [String]
|
|
37
|
+
# @param data_access_scope [String]
|
|
38
|
+
#
|
|
39
|
+
# @return [::String]
|
|
40
|
+
def data_access_scope_path project:, location:, instance:, data_access_scope:
|
|
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}/dataAccessScopes/#{data_access_scope}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# Create a fully-qualified Instance resource string.
|
|
50
|
+
#
|
|
51
|
+
# The resource will be in the following format:
|
|
52
|
+
#
|
|
53
|
+
# `projects/{project}/locations/{location}/instances/{instance}`
|
|
54
|
+
#
|
|
55
|
+
# @param project [String]
|
|
56
|
+
# @param location [String]
|
|
57
|
+
# @param instance [String]
|
|
58
|
+
#
|
|
59
|
+
# @return [::String]
|
|
60
|
+
def instance_path project:, location:, instance:
|
|
61
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
|
62
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
|
63
|
+
|
|
64
|
+
"projects/#{project}/locations/#{location}/instances/#{instance}"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
##
|
|
68
|
+
# Create a fully-qualified SearchSession resource string.
|
|
69
|
+
#
|
|
70
|
+
# The resource will be in the following format:
|
|
71
|
+
#
|
|
72
|
+
# `projects/{project}/locations/{location}/instances/{instance}/searchSessions/{search_session}`
|
|
73
|
+
#
|
|
74
|
+
# @param project [String]
|
|
75
|
+
# @param location [String]
|
|
76
|
+
# @param instance [String]
|
|
77
|
+
# @param search_session [String]
|
|
78
|
+
#
|
|
79
|
+
# @return [::String]
|
|
80
|
+
def search_session_path project:, location:, instance:, search_session:
|
|
81
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
|
82
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
|
83
|
+
raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/"
|
|
84
|
+
|
|
85
|
+
"projects/#{project}/locations/#{location}/instances/#{instance}/searchSessions/#{search_session}"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
extend self
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,586 @@
|
|
|
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/search_pb"
|
|
21
|
+
require "google/cloud/chronicle/v1/search_service/rest/service_stub"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module Chronicle
|
|
26
|
+
module V1
|
|
27
|
+
module SearchService
|
|
28
|
+
module Rest
|
|
29
|
+
##
|
|
30
|
+
# REST client for the SearchService service.
|
|
31
|
+
#
|
|
32
|
+
# SearchService provides methods for searching data in Chronicle.
|
|
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 :search_service_stub
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Configure the SearchService Client class.
|
|
48
|
+
#
|
|
49
|
+
# See {::Google::Cloud::Chronicle::V1::SearchService::Rest::Client::Configuration}
|
|
50
|
+
# for a description of the configuration fields.
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
#
|
|
54
|
+
# # Modify the configuration for all SearchService clients
|
|
55
|
+
# ::Google::Cloud::Chronicle::V1::SearchService::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.search.timeout = 60.0
|
|
76
|
+
|
|
77
|
+
default_config.rpcs.list_searched_results.timeout = 600.0
|
|
78
|
+
default_config.rpcs.list_searched_results.retry_policy = {
|
|
79
|
+
initial_delay: 1.0, max_delay: 600.0, multiplier: 1.3, retry_codes: [14]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
default_config
|
|
83
|
+
end
|
|
84
|
+
yield @configure if block_given?
|
|
85
|
+
@configure
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
##
|
|
89
|
+
# Configure the SearchService 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::SearchService::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
|
+
@search_service_stub.universe_domain
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
##
|
|
118
|
+
# Create a new SearchService REST client object.
|
|
119
|
+
#
|
|
120
|
+
# @example
|
|
121
|
+
#
|
|
122
|
+
# # Create a client using the default configuration
|
|
123
|
+
# client = ::Google::Cloud::Chronicle::V1::SearchService::Rest::Client.new
|
|
124
|
+
#
|
|
125
|
+
# # Create a client using a custom configuration
|
|
126
|
+
# client = ::Google::Cloud::Chronicle::V1::SearchService::Rest::Client.new do |config|
|
|
127
|
+
# config.timeout = 10.0
|
|
128
|
+
# end
|
|
129
|
+
#
|
|
130
|
+
# @yield [config] Configure the SearchService 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
|
+
@operations_client = ::Google::Cloud::Chronicle::V1::SearchService::Rest::Operations.new do |config|
|
|
157
|
+
config.credentials = credentials
|
|
158
|
+
config.quota_project = @quota_project_id
|
|
159
|
+
config.endpoint = @config.endpoint
|
|
160
|
+
config.universe_domain = @config.universe_domain
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
@search_service_stub = ::Google::Cloud::Chronicle::V1::SearchService::Rest::ServiceStub.new(
|
|
164
|
+
endpoint: @config.endpoint,
|
|
165
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
166
|
+
universe_domain: @config.universe_domain,
|
|
167
|
+
credentials: credentials,
|
|
168
|
+
logger: @config.logger
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
@search_service_stub.logger(stub: true)&.info do |entry|
|
|
172
|
+
entry.set_system_name
|
|
173
|
+
entry.set_service
|
|
174
|
+
entry.message = "Created client for #{entry.service}"
|
|
175
|
+
entry.set_credentials_fields credentials
|
|
176
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
177
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
178
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
##
|
|
183
|
+
# Get the associated client for long-running operations.
|
|
184
|
+
#
|
|
185
|
+
# @return [::Google::Cloud::Chronicle::V1::SearchService::Rest::Operations]
|
|
186
|
+
#
|
|
187
|
+
attr_reader :operations_client
|
|
188
|
+
|
|
189
|
+
##
|
|
190
|
+
# The logger used for request/response debug logging.
|
|
191
|
+
#
|
|
192
|
+
# @return [Logger]
|
|
193
|
+
#
|
|
194
|
+
def logger
|
|
195
|
+
@search_service_stub.logger
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Service calls
|
|
199
|
+
|
|
200
|
+
##
|
|
201
|
+
# Initiates a long-running search operation.
|
|
202
|
+
#
|
|
203
|
+
# @overload search(request, options = nil)
|
|
204
|
+
# Pass arguments to `search` via a request object, either of type
|
|
205
|
+
# {::Google::Cloud::Chronicle::V1::SearchRequest} or an equivalent Hash.
|
|
206
|
+
#
|
|
207
|
+
# @param request [::Google::Cloud::Chronicle::V1::SearchRequest, ::Hash]
|
|
208
|
+
# A request object representing the call parameters. Required. To specify no
|
|
209
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
210
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
211
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
212
|
+
#
|
|
213
|
+
# @overload search(parent: nil, query: nil, time_range: nil, dialect: nil, draft_data_access_scope: nil, result_limit: nil, simulated_data_visibility: nil)
|
|
214
|
+
# Pass arguments to `search` via keyword arguments. Note that at
|
|
215
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
216
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
217
|
+
#
|
|
218
|
+
# @param parent [::String]
|
|
219
|
+
# Required. The resource name of the instance on which to perform the search.
|
|
220
|
+
# Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
|
|
221
|
+
# @param query [::String]
|
|
222
|
+
# Required. The search query, in the dialect set in `dialect`.
|
|
223
|
+
# Example: 'ip=/172.*/ AND metadata.event_type!="NETWORK_CONNECTION" AND (
|
|
224
|
+
# target.ip = "3.225.179.73" OR target.ip = "23.47.48.70")'
|
|
225
|
+
# @param time_range [::Google::Type::Interval, ::Hash]
|
|
226
|
+
# Required. Time range to search for [Inclusive start time, exclusive end
|
|
227
|
+
# time).
|
|
228
|
+
# @param dialect [::Google::Cloud::Chronicle::V1::QueryDialect]
|
|
229
|
+
# Optional. Specifies the dialect the Search Query is written in. If not
|
|
230
|
+
# specified, the query will be parsed as YL2.
|
|
231
|
+
# @param draft_data_access_scope [::Google::Cloud::Chronicle::V1::DataAccessScope, ::Hash]
|
|
232
|
+
# Optional. Data access scope used to filter events. This is intended to be
|
|
233
|
+
# used by admins to preview in-development scopes. Should only be called by
|
|
234
|
+
# users with global access. If the caller does not have global access, the
|
|
235
|
+
# request will fail.
|
|
236
|
+
# @param result_limit [::Integer]
|
|
237
|
+
# Optional. Requested maximum number of rows to materialize. The service may
|
|
238
|
+
# return fewer. If unspecified, a server-side default of 10,000 is used. The
|
|
239
|
+
# maximum value is 1,000,000. Some dialects have a lower maximum; see
|
|
240
|
+
# `QueryDialect`.
|
|
241
|
+
# @param simulated_data_visibility [::Google::Cloud::Chronicle::V1::SimulatedDataVisibility]
|
|
242
|
+
# Optional. Specifies visibility of simulated data to include in search
|
|
243
|
+
# results.
|
|
244
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
245
|
+
# @yieldparam result [::Gapic::Operation]
|
|
246
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
247
|
+
#
|
|
248
|
+
# @return [::Gapic::Operation]
|
|
249
|
+
#
|
|
250
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
251
|
+
#
|
|
252
|
+
# @example Basic example
|
|
253
|
+
# require "google/cloud/chronicle/v1"
|
|
254
|
+
#
|
|
255
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
256
|
+
# client = Google::Cloud::Chronicle::V1::SearchService::Rest::Client.new
|
|
257
|
+
#
|
|
258
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
259
|
+
# request = Google::Cloud::Chronicle::V1::SearchRequest.new
|
|
260
|
+
#
|
|
261
|
+
# # Call the search method.
|
|
262
|
+
# result = client.search request
|
|
263
|
+
#
|
|
264
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
265
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
266
|
+
# # Here is how to wait for a response.
|
|
267
|
+
# result.wait_until_done! timeout: 60
|
|
268
|
+
# if result.response?
|
|
269
|
+
# p result.response
|
|
270
|
+
# else
|
|
271
|
+
# puts "No response received."
|
|
272
|
+
# end
|
|
273
|
+
#
|
|
274
|
+
def search request, options = nil
|
|
275
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
276
|
+
|
|
277
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::SearchRequest
|
|
278
|
+
|
|
279
|
+
# Converts hash and nil to an options object
|
|
280
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
281
|
+
|
|
282
|
+
# Customize the options with defaults
|
|
283
|
+
call_metadata = @config.rpcs.search.metadata.to_h
|
|
284
|
+
|
|
285
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
286
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
287
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
288
|
+
gapic_version: ::Google::Cloud::Chronicle::V1::VERSION,
|
|
289
|
+
transports_version_send: [:rest]
|
|
290
|
+
|
|
291
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
292
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
293
|
+
|
|
294
|
+
options.apply_defaults timeout: @config.rpcs.search.timeout,
|
|
295
|
+
metadata: call_metadata,
|
|
296
|
+
retry_policy: @config.rpcs.search.retry_policy
|
|
297
|
+
|
|
298
|
+
options.apply_defaults timeout: @config.timeout,
|
|
299
|
+
metadata: @config.metadata,
|
|
300
|
+
retry_policy: @config.retry_policy
|
|
301
|
+
|
|
302
|
+
@search_service_stub.search request, options do |result, operation|
|
|
303
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
304
|
+
yield result, operation if block_given?
|
|
305
|
+
throw :response, result
|
|
306
|
+
end
|
|
307
|
+
rescue ::Gapic::Rest::Error => e
|
|
308
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
##
|
|
312
|
+
# Retrieves results from a completed Search operation.
|
|
313
|
+
#
|
|
314
|
+
# @overload list_searched_results(request, options = nil)
|
|
315
|
+
# Pass arguments to `list_searched_results` via a request object, either of type
|
|
316
|
+
# {::Google::Cloud::Chronicle::V1::ListSearchedResultsRequest} or an equivalent Hash.
|
|
317
|
+
#
|
|
318
|
+
# @param request [::Google::Cloud::Chronicle::V1::ListSearchedResultsRequest, ::Hash]
|
|
319
|
+
# A request object representing the call parameters. Required. To specify no
|
|
320
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
321
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
322
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
323
|
+
#
|
|
324
|
+
# @overload list_searched_results(parent: nil, page_size: nil, page_token: nil, order_by: nil, skip: nil)
|
|
325
|
+
# Pass arguments to `list_searched_results` via keyword arguments. Note that at
|
|
326
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
327
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
328
|
+
#
|
|
329
|
+
# @param parent [::String]
|
|
330
|
+
# Required. The parent SearchSession resource name.
|
|
331
|
+
# Format:
|
|
332
|
+
# projects/\\{project}/locations/\\{location}/instances/\\{instance}/searchSessions/\\{search_session}
|
|
333
|
+
# @param page_size [::Integer]
|
|
334
|
+
# Optional. The maximum number of results to return. The service may return
|
|
335
|
+
# fewer. If unspecified, at most 100 results will be returned. The maximum
|
|
336
|
+
# value is 1000.
|
|
337
|
+
# @param page_token [::String]
|
|
338
|
+
# Optional. A page token, received from a previous `ListSearchedResults`
|
|
339
|
+
# call. Provide this to retrieve the subsequent page.
|
|
340
|
+
# @param order_by [::String]
|
|
341
|
+
# Optional. The column to sort the results on. Example: "event_timestamp
|
|
342
|
+
# desc", "principal.hostname asc". Multi-columnar sorting is not supported.
|
|
343
|
+
# @param skip [::Integer]
|
|
344
|
+
# Optional. The number of results to skip before starting to return results.
|
|
345
|
+
# This field should not be used in conjunction with page_token.
|
|
346
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
347
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Chronicle::V1::SearchedResult>]
|
|
348
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
349
|
+
#
|
|
350
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Chronicle::V1::SearchedResult>]
|
|
351
|
+
#
|
|
352
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
353
|
+
#
|
|
354
|
+
# @example Basic example
|
|
355
|
+
# require "google/cloud/chronicle/v1"
|
|
356
|
+
#
|
|
357
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
358
|
+
# client = Google::Cloud::Chronicle::V1::SearchService::Rest::Client.new
|
|
359
|
+
#
|
|
360
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
361
|
+
# request = Google::Cloud::Chronicle::V1::ListSearchedResultsRequest.new
|
|
362
|
+
#
|
|
363
|
+
# # Call the list_searched_results method.
|
|
364
|
+
# result = client.list_searched_results request
|
|
365
|
+
#
|
|
366
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
367
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
368
|
+
# result.each do |item|
|
|
369
|
+
# # Each element is of type ::Google::Cloud::Chronicle::V1::SearchedResult.
|
|
370
|
+
# p item
|
|
371
|
+
# end
|
|
372
|
+
#
|
|
373
|
+
def list_searched_results request, options = nil
|
|
374
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
375
|
+
|
|
376
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ListSearchedResultsRequest
|
|
377
|
+
|
|
378
|
+
# Converts hash and nil to an options object
|
|
379
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
380
|
+
|
|
381
|
+
# Customize the options with defaults
|
|
382
|
+
call_metadata = @config.rpcs.list_searched_results.metadata.to_h
|
|
383
|
+
|
|
384
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
385
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
386
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
387
|
+
gapic_version: ::Google::Cloud::Chronicle::V1::VERSION,
|
|
388
|
+
transports_version_send: [:rest]
|
|
389
|
+
|
|
390
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
391
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
392
|
+
|
|
393
|
+
options.apply_defaults timeout: @config.rpcs.list_searched_results.timeout,
|
|
394
|
+
metadata: call_metadata,
|
|
395
|
+
retry_policy: @config.rpcs.list_searched_results.retry_policy
|
|
396
|
+
|
|
397
|
+
options.apply_defaults timeout: @config.timeout,
|
|
398
|
+
metadata: @config.metadata,
|
|
399
|
+
retry_policy: @config.retry_policy
|
|
400
|
+
|
|
401
|
+
@search_service_stub.list_searched_results request, options do |result, operation|
|
|
402
|
+
result = ::Gapic::Rest::PagedEnumerable.new @search_service_stub, :list_searched_results, "searched_results", request, result, options
|
|
403
|
+
yield result, operation if block_given?
|
|
404
|
+
throw :response, result
|
|
405
|
+
end
|
|
406
|
+
rescue ::Gapic::Rest::Error => e
|
|
407
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
##
|
|
411
|
+
# Configuration class for the SearchService REST API.
|
|
412
|
+
#
|
|
413
|
+
# This class represents the configuration for SearchService REST,
|
|
414
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
415
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
416
|
+
# applied individually to specific RPCs. See
|
|
417
|
+
# {::Google::Cloud::Chronicle::V1::SearchService::Rest::Client::Configuration::Rpcs}
|
|
418
|
+
# for a list of RPCs that can be configured independently.
|
|
419
|
+
#
|
|
420
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
421
|
+
# on construction.
|
|
422
|
+
#
|
|
423
|
+
# @example
|
|
424
|
+
#
|
|
425
|
+
# # Modify the global config, setting the timeout for
|
|
426
|
+
# # search to 20 seconds,
|
|
427
|
+
# # and all remaining timeouts to 10 seconds.
|
|
428
|
+
# ::Google::Cloud::Chronicle::V1::SearchService::Rest::Client.configure do |config|
|
|
429
|
+
# config.timeout = 10.0
|
|
430
|
+
# config.rpcs.search.timeout = 20.0
|
|
431
|
+
# end
|
|
432
|
+
#
|
|
433
|
+
# # Apply the above configuration only to a new client.
|
|
434
|
+
# client = ::Google::Cloud::Chronicle::V1::SearchService::Rest::Client.new do |config|
|
|
435
|
+
# config.timeout = 10.0
|
|
436
|
+
# config.rpcs.search.timeout = 20.0
|
|
437
|
+
# end
|
|
438
|
+
#
|
|
439
|
+
# @!attribute [rw] endpoint
|
|
440
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
441
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
442
|
+
# @return [::String,nil]
|
|
443
|
+
# @!attribute [rw] credentials
|
|
444
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
445
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
446
|
+
# * (`Hash`) A service account key as a Hash
|
|
447
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
448
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
449
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
450
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
451
|
+
# * (`nil`) indicating no credentials
|
|
452
|
+
#
|
|
453
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
454
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
455
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
456
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
457
|
+
# For more information, refer to [Validate credential configurations from external
|
|
458
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
459
|
+
# @return [::Object]
|
|
460
|
+
# @!attribute [rw] scope
|
|
461
|
+
# The OAuth scopes
|
|
462
|
+
# @return [::Array<::String>]
|
|
463
|
+
# @!attribute [rw] lib_name
|
|
464
|
+
# The library name as recorded in instrumentation and logging
|
|
465
|
+
# @return [::String]
|
|
466
|
+
# @!attribute [rw] lib_version
|
|
467
|
+
# The library version as recorded in instrumentation and logging
|
|
468
|
+
# @return [::String]
|
|
469
|
+
# @!attribute [rw] timeout
|
|
470
|
+
# The call timeout in seconds.
|
|
471
|
+
# @return [::Numeric]
|
|
472
|
+
# @!attribute [rw] metadata
|
|
473
|
+
# Additional headers to be sent with the call.
|
|
474
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
475
|
+
# @!attribute [rw] retry_policy
|
|
476
|
+
# The retry policy. The value is a hash with the following keys:
|
|
477
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
478
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
479
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
480
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
481
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
482
|
+
# trigger a retry.
|
|
483
|
+
# @return [::Hash]
|
|
484
|
+
# @!attribute [rw] quota_project
|
|
485
|
+
# A separate project against which to charge quota.
|
|
486
|
+
# @return [::String]
|
|
487
|
+
# @!attribute [rw] universe_domain
|
|
488
|
+
# The universe domain within which to make requests. This determines the
|
|
489
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
490
|
+
# universe (usually the default "googleapis.com" universe).
|
|
491
|
+
# @return [::String,nil]
|
|
492
|
+
# @!attribute [rw] logger
|
|
493
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
494
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
495
|
+
# explicitly disable logging.
|
|
496
|
+
# @return [::Logger,:default,nil]
|
|
497
|
+
#
|
|
498
|
+
class Configuration
|
|
499
|
+
extend ::Gapic::Config
|
|
500
|
+
|
|
501
|
+
# @private
|
|
502
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
503
|
+
DEFAULT_ENDPOINT = "chronicle.googleapis.com"
|
|
504
|
+
|
|
505
|
+
config_attr :endpoint, nil, ::String, nil
|
|
506
|
+
config_attr :credentials, nil do |value|
|
|
507
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
508
|
+
allowed.any? { |klass| klass === value }
|
|
509
|
+
end
|
|
510
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
511
|
+
config_attr :lib_name, nil, ::String, nil
|
|
512
|
+
config_attr :lib_version, nil, ::String, nil
|
|
513
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
514
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
515
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
516
|
+
config_attr :quota_project, nil, ::String, nil
|
|
517
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
518
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
519
|
+
|
|
520
|
+
# @private
|
|
521
|
+
def initialize parent_config = nil
|
|
522
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
523
|
+
|
|
524
|
+
yield self if block_given?
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
##
|
|
528
|
+
# Configurations for individual RPCs
|
|
529
|
+
# @return [Rpcs]
|
|
530
|
+
#
|
|
531
|
+
def rpcs
|
|
532
|
+
@rpcs ||= begin
|
|
533
|
+
parent_rpcs = nil
|
|
534
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
535
|
+
Rpcs.new parent_rpcs
|
|
536
|
+
end
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
##
|
|
540
|
+
# Configuration RPC class for the SearchService API.
|
|
541
|
+
#
|
|
542
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
543
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
544
|
+
# the following configuration fields:
|
|
545
|
+
#
|
|
546
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
547
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
548
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
549
|
+
# include the following keys:
|
|
550
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
551
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
552
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
553
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
554
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
555
|
+
# trigger a retry.
|
|
556
|
+
#
|
|
557
|
+
class Rpcs
|
|
558
|
+
##
|
|
559
|
+
# RPC-specific configuration for `search`
|
|
560
|
+
# @return [::Gapic::Config::Method]
|
|
561
|
+
#
|
|
562
|
+
attr_reader :search
|
|
563
|
+
##
|
|
564
|
+
# RPC-specific configuration for `list_searched_results`
|
|
565
|
+
# @return [::Gapic::Config::Method]
|
|
566
|
+
#
|
|
567
|
+
attr_reader :list_searched_results
|
|
568
|
+
|
|
569
|
+
# @private
|
|
570
|
+
def initialize parent_rpcs = nil
|
|
571
|
+
search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
|
|
572
|
+
@search = ::Gapic::Config::Method.new search_config
|
|
573
|
+
list_searched_results_config = parent_rpcs.list_searched_results if parent_rpcs.respond_to? :list_searched_results
|
|
574
|
+
@list_searched_results = ::Gapic::Config::Method.new list_searched_results_config
|
|
575
|
+
|
|
576
|
+
yield self if block_given?
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
end
|
|
580
|
+
end
|
|
581
|
+
end
|
|
582
|
+
end
|
|
583
|
+
end
|
|
584
|
+
end
|
|
585
|
+
end
|
|
586
|
+
end
|