google-cloud-chronicle-v1 0.a → 0.1.0

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