google-cloud-security_center-v1p1beta1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +71 -0
  6. data/lib/google-cloud-security_center-v1p1beta1.rb +21 -0
  7. data/lib/google/cloud/common_resources_pb.rb +15 -0
  8. data/lib/google/cloud/security_center/v1p1beta1.rb +35 -0
  9. data/lib/google/cloud/security_center/v1p1beta1/security_center.rb +50 -0
  10. data/lib/google/cloud/security_center/v1p1beta1/security_center/client.rb +2680 -0
  11. data/lib/google/cloud/security_center/v1p1beta1/security_center/credentials.rb +51 -0
  12. data/lib/google/cloud/security_center/v1p1beta1/security_center/operations.rb +564 -0
  13. data/lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb +172 -0
  14. data/lib/google/cloud/security_center/v1p1beta1/version.rb +28 -0
  15. data/lib/google/cloud/securitycenter/v1p1beta1/asset_pb.rb +48 -0
  16. data/lib/google/cloud/securitycenter/v1p1beta1/finding_pb.rb +43 -0
  17. data/lib/google/cloud/securitycenter/v1p1beta1/notification_config_pb.rb +41 -0
  18. data/lib/google/cloud/securitycenter/v1p1beta1/notification_message_pb.rb +28 -0
  19. data/lib/google/cloud/securitycenter/v1p1beta1/organization_settings_pb.rb +37 -0
  20. data/lib/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response_pb.rb +32 -0
  21. data/lib/google/cloud/securitycenter/v1p1beta1/security_marks_pb.rb +25 -0
  22. data/lib/google/cloud/securitycenter/v1p1beta1/securitycenter_service_pb.rb +241 -0
  23. data/lib/google/cloud/securitycenter/v1p1beta1/securitycenter_service_services_pb.rb +108 -0
  24. data/lib/google/cloud/securitycenter/v1p1beta1/source_pb.rb +26 -0
  25. data/proto_docs/README.md +4 -0
  26. data/proto_docs/google/api/field_behavior.rb +59 -0
  27. data/proto_docs/google/api/resource.rb +247 -0
  28. data/proto_docs/google/cloud/securitycenter/v1p1beta1/asset.rb +127 -0
  29. data/proto_docs/google/cloud/securitycenter/v1p1beta1/finding.rb +112 -0
  30. data/proto_docs/google/cloud/securitycenter/v1p1beta1/notification_config.rb +97 -0
  31. data/proto_docs/google/cloud/securitycenter/v1p1beta1/notification_message.rb +39 -0
  32. data/proto_docs/google/cloud/securitycenter/v1p1beta1/organization_settings.rb +82 -0
  33. data/proto_docs/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.rb +54 -0
  34. data/proto_docs/google/cloud/securitycenter/v1p1beta1/security_marks.rb +61 -0
  35. data/proto_docs/google/cloud/securitycenter/v1p1beta1/securitycenter_service.rb +1026 -0
  36. data/proto_docs/google/cloud/securitycenter/v1p1beta1/source.rb +56 -0
  37. data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
  38. data/proto_docs/google/iam/v1/options.rb +40 -0
  39. data/proto_docs/google/iam/v1/policy.rb +248 -0
  40. data/proto_docs/google/longrunning/operations.rb +150 -0
  41. data/proto_docs/google/protobuf/any.rb +138 -0
  42. data/proto_docs/google/protobuf/duration.rb +98 -0
  43. data/proto_docs/google/protobuf/empty.rb +36 -0
  44. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  45. data/proto_docs/google/protobuf/struct.rb +96 -0
  46. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  47. data/proto_docs/google/rpc/status.rb +46 -0
  48. data/proto_docs/google/type/expr.rb +52 -0
  49. metadata +222 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/security_center/v1p1beta1"
@@ -0,0 +1,15 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/common_resources.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/resource_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_file("google/cloud/common_resources.proto", :syntax => :proto3) do
9
+ end
10
+ end
11
+
12
+ module Google
13
+ module Cloud
14
+ end
15
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/security_center/v1p1beta1/security_center"
20
+ require "google/cloud/security_center/v1p1beta1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module SecurityCenter
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/security_center/v1p1beta1"
29
+ # client = Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.new
30
+ #
31
+ module V1p1beta1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/security_center/v1p1beta1/version"
24
+
25
+ require "google/cloud/security_center/v1p1beta1/security_center/credentials"
26
+ require "google/cloud/security_center/v1p1beta1/security_center/paths"
27
+ require "google/cloud/security_center/v1p1beta1/security_center/operations"
28
+ require "google/cloud/security_center/v1p1beta1/security_center/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module SecurityCenter
33
+ module V1p1beta1
34
+ ##
35
+ # V1p1Beta1 APIs for Security Center service.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/security_center/v1p1beta1/security_center"
40
+ # client = Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.new
41
+ #
42
+ module SecurityCenter
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "security_center", "helpers.rb"
50
+ require "google/cloud/security_center/v1p1beta1/security_center/helpers" if ::File.file? helper_path
@@ -0,0 +1,2680 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/securitycenter/v1p1beta1/securitycenter_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module SecurityCenter
25
+ module V1p1beta1
26
+ module SecurityCenter
27
+ ##
28
+ # Client for the SecurityCenter service.
29
+ #
30
+ # V1p1Beta1 APIs for Security Center service.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :security_center_stub
37
+
38
+ ##
39
+ # Configure the SecurityCenter Client class.
40
+ #
41
+ # See {Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all SecurityCenter clients:
47
+ #
48
+ # Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.configure do |config|
49
+ # config.timeout = 10_000
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "SecurityCenter", "V1p1beta1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const&.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.create_source.timeout = 60.0
69
+
70
+ default_config.rpcs.create_finding.timeout = 60.0
71
+
72
+ default_config.rpcs.create_notification_config.timeout = 60.0
73
+
74
+ default_config.rpcs.delete_notification_config.timeout = 60.0
75
+
76
+ default_config.rpcs.get_iam_policy.timeout = 60.0
77
+ default_config.rpcs.get_iam_policy.retry_policy = {
78
+ initial_delay: 0.1,
79
+ max_delay: 60.0,
80
+ multiplier: 1.3,
81
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
82
+ }
83
+
84
+ default_config.rpcs.get_notification_config.timeout = 60.0
85
+ default_config.rpcs.get_notification_config.retry_policy = {
86
+ initial_delay: 0.1,
87
+ max_delay: 60.0,
88
+ multiplier: 1.3,
89
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
90
+ }
91
+
92
+ default_config.rpcs.get_organization_settings.timeout = 60.0
93
+ default_config.rpcs.get_organization_settings.retry_policy = {
94
+ initial_delay: 0.1,
95
+ max_delay: 60.0,
96
+ multiplier: 1.3,
97
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
98
+ }
99
+
100
+ default_config.rpcs.get_source.timeout = 60.0
101
+ default_config.rpcs.get_source.retry_policy = {
102
+ initial_delay: 0.1,
103
+ max_delay: 60.0,
104
+ multiplier: 1.3,
105
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
106
+ }
107
+
108
+ default_config.rpcs.group_assets.timeout = 60.0
109
+ default_config.rpcs.group_assets.retry_policy = {
110
+ initial_delay: 0.1,
111
+ max_delay: 60.0,
112
+ multiplier: 1.3,
113
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
114
+ }
115
+
116
+ default_config.rpcs.group_findings.timeout = 60.0
117
+ default_config.rpcs.group_findings.retry_policy = {
118
+ initial_delay: 0.1,
119
+ max_delay: 60.0,
120
+ multiplier: 1.3,
121
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
122
+ }
123
+
124
+ default_config.rpcs.list_assets.timeout = 60.0
125
+ default_config.rpcs.list_assets.retry_policy = {
126
+ initial_delay: 0.1,
127
+ max_delay: 60.0,
128
+ multiplier: 1.3,
129
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
130
+ }
131
+
132
+ default_config.rpcs.list_findings.timeout = 60.0
133
+ default_config.rpcs.list_findings.retry_policy = {
134
+ initial_delay: 0.1,
135
+ max_delay: 60.0,
136
+ multiplier: 1.3,
137
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
138
+ }
139
+
140
+ default_config.rpcs.list_notification_configs.timeout = 60.0
141
+ default_config.rpcs.list_notification_configs.retry_policy = {
142
+ initial_delay: 0.1,
143
+ max_delay: 60.0,
144
+ multiplier: 1.3,
145
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
146
+ }
147
+
148
+ default_config.rpcs.list_sources.timeout = 60.0
149
+ default_config.rpcs.list_sources.retry_policy = {
150
+ initial_delay: 0.1,
151
+ max_delay: 60.0,
152
+ multiplier: 1.3,
153
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
154
+ }
155
+
156
+ default_config.rpcs.run_asset_discovery.timeout = 60.0
157
+
158
+ default_config.rpcs.set_finding_state.timeout = 60.0
159
+
160
+ default_config.rpcs.set_iam_policy.timeout = 60.0
161
+
162
+ default_config.rpcs.test_iam_permissions.timeout = 60.0
163
+ default_config.rpcs.test_iam_permissions.retry_policy = {
164
+ initial_delay: 0.1,
165
+ max_delay: 60.0,
166
+ multiplier: 1.3,
167
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
168
+ }
169
+
170
+ default_config.rpcs.update_finding.timeout = 60.0
171
+
172
+ default_config.rpcs.update_notification_config.timeout = 60.0
173
+
174
+ default_config.rpcs.update_organization_settings.timeout = 60.0
175
+
176
+ default_config.rpcs.update_source.timeout = 60.0
177
+
178
+ default_config.rpcs.update_security_marks.timeout = 60.0
179
+
180
+ default_config
181
+ end
182
+ yield @configure if block_given?
183
+ @configure
184
+ end
185
+
186
+ ##
187
+ # Configure the SecurityCenter Client instance.
188
+ #
189
+ # The configuration is set to the derived mode, meaning that values can be changed,
190
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
191
+ # should be made on {Client.configure}.
192
+ #
193
+ # See {Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client::Configuration}
194
+ # for a description of the configuration fields.
195
+ #
196
+ # @yield [config] Configure the Client client.
197
+ # @yieldparam config [Client::Configuration]
198
+ #
199
+ # @return [Client::Configuration]
200
+ #
201
+ def configure
202
+ yield @config if block_given?
203
+ @config
204
+ end
205
+
206
+ ##
207
+ # Create a new SecurityCenter client object.
208
+ #
209
+ # ## Examples
210
+ #
211
+ # To create a new SecurityCenter client with the default
212
+ # configuration:
213
+ #
214
+ # client = Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.new
215
+ #
216
+ # To create a new SecurityCenter client with a custom
217
+ # configuration:
218
+ #
219
+ # client = Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.new do |config|
220
+ # config.timeout = 10_000
221
+ # end
222
+ #
223
+ # @yield [config] Configure the SecurityCenter client.
224
+ # @yieldparam config [Client::Configuration]
225
+ #
226
+ def initialize
227
+ # These require statements are intentionally placed here to initialize
228
+ # the gRPC module only when it's required.
229
+ # See https://github.com/googleapis/toolkit/issues/446
230
+ require "gapic/grpc"
231
+ require "google/cloud/securitycenter/v1p1beta1/securitycenter_service_services_pb"
232
+
233
+ # Create the configuration object
234
+ @config = Configuration.new Client.configure
235
+
236
+ # Yield the configuration if needed
237
+ yield @config if block_given?
238
+
239
+ # Create credentials
240
+ credentials = @config.credentials
241
+ credentials ||= Credentials.default scope: @config.scope
242
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
243
+ credentials = Credentials.new credentials, scope: @config.scope
244
+ end
245
+ @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
246
+
247
+ @operations_client = Operations.new do |config|
248
+ config.credentials = credentials
249
+ config.endpoint = @config.endpoint
250
+ end
251
+
252
+ @security_center_stub = Gapic::ServiceStub.new(
253
+ Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Stub,
254
+ credentials: credentials,
255
+ endpoint: @config.endpoint,
256
+ channel_args: @config.channel_args,
257
+ interceptors: @config.interceptors
258
+ )
259
+ end
260
+
261
+ ##
262
+ # Get the associated client for long-running operations.
263
+ #
264
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Operations]
265
+ #
266
+ attr_reader :operations_client
267
+
268
+ # Service calls
269
+
270
+ ##
271
+ # Creates a source.
272
+ #
273
+ # @overload create_source(request, options = nil)
274
+ # Pass arguments to `create_source` via a request object, either of type
275
+ # {Google::Cloud::SecurityCenter::V1p1beta1::CreateSourceRequest} or an equivalent Hash.
276
+ #
277
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::CreateSourceRequest, Hash]
278
+ # A request object representing the call parameters. Required. To specify no
279
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
280
+ # @param options [Gapic::CallOptions, Hash]
281
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
282
+ #
283
+ # @overload create_source(parent: nil, source: nil)
284
+ # Pass arguments to `create_source` via keyword arguments. Note that at
285
+ # least one keyword argument is required. To specify no parameters, or to keep all
286
+ # the default parameter values, pass an empty Hash as a request object (see above).
287
+ #
288
+ # @param parent [String]
289
+ # Required. Resource name of the new source's parent. Its format should be
290
+ # "organizations/[organization_id]".
291
+ # @param source [Google::Cloud::SecurityCenter::V1p1beta1::Source, Hash]
292
+ # Required. The Source being created, only the display_name and description
293
+ # will be used. All other fields will be ignored.
294
+ #
295
+ # @yield [response, operation] Access the result along with the RPC operation
296
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::Source]
297
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
298
+ #
299
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::Source]
300
+ #
301
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
302
+ #
303
+ def create_source request, options = nil
304
+ raise ArgumentError, "request must be provided" if request.nil?
305
+
306
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::CreateSourceRequest
307
+
308
+ # Converts hash and nil to an options object
309
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
310
+
311
+ # Customize the options with defaults
312
+ metadata = @config.rpcs.create_source.metadata.to_h
313
+
314
+ # Set x-goog-api-client and x-goog-user-project headers
315
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
316
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
317
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
318
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
319
+
320
+ header_params = {
321
+ "parent" => request.parent
322
+ }
323
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
324
+ metadata[:"x-goog-request-params"] ||= request_params_header
325
+
326
+ options.apply_defaults timeout: @config.rpcs.create_source.timeout,
327
+ metadata: metadata,
328
+ retry_policy: @config.rpcs.create_source.retry_policy
329
+ options.apply_defaults metadata: @config.metadata,
330
+ retry_policy: @config.retry_policy
331
+
332
+ @security_center_stub.call_rpc :create_source, request, options: options do |response, operation|
333
+ yield response, operation if block_given?
334
+ return response
335
+ end
336
+ rescue GRPC::BadStatus => e
337
+ raise Google::Cloud::Error.from_error(e)
338
+ end
339
+
340
+ ##
341
+ # Creates a finding. The corresponding source must exist for finding
342
+ # creation to succeed.
343
+ #
344
+ # @overload create_finding(request, options = nil)
345
+ # Pass arguments to `create_finding` via a request object, either of type
346
+ # {Google::Cloud::SecurityCenter::V1p1beta1::CreateFindingRequest} or an equivalent Hash.
347
+ #
348
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::CreateFindingRequest, Hash]
349
+ # A request object representing the call parameters. Required. To specify no
350
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
351
+ # @param options [Gapic::CallOptions, Hash]
352
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
353
+ #
354
+ # @overload create_finding(parent: nil, finding_id: nil, finding: nil)
355
+ # Pass arguments to `create_finding` via keyword arguments. Note that at
356
+ # least one keyword argument is required. To specify no parameters, or to keep all
357
+ # the default parameter values, pass an empty Hash as a request object (see above).
358
+ #
359
+ # @param parent [String]
360
+ # Required. Resource name of the new finding's parent. Its format should be
361
+ # "organizations/[organization_id]/sources/[source_id]".
362
+ # @param finding_id [String]
363
+ # Required. Unique identifier provided by the client within the parent scope.
364
+ # It must be alphanumeric and less than or equal to 32 characters and
365
+ # greater than 0 characters in length.
366
+ # @param finding [Google::Cloud::SecurityCenter::V1p1beta1::Finding, Hash]
367
+ # Required. The Finding being created. The name and security_marks will be
368
+ # ignored as they are both output only fields on this resource.
369
+ #
370
+ # @yield [response, operation] Access the result along with the RPC operation
371
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::Finding]
372
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
373
+ #
374
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::Finding]
375
+ #
376
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
377
+ #
378
+ def create_finding request, options = nil
379
+ raise ArgumentError, "request must be provided" if request.nil?
380
+
381
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::CreateFindingRequest
382
+
383
+ # Converts hash and nil to an options object
384
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
385
+
386
+ # Customize the options with defaults
387
+ metadata = @config.rpcs.create_finding.metadata.to_h
388
+
389
+ # Set x-goog-api-client and x-goog-user-project headers
390
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
391
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
392
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
393
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
394
+
395
+ header_params = {
396
+ "parent" => request.parent
397
+ }
398
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
399
+ metadata[:"x-goog-request-params"] ||= request_params_header
400
+
401
+ options.apply_defaults timeout: @config.rpcs.create_finding.timeout,
402
+ metadata: metadata,
403
+ retry_policy: @config.rpcs.create_finding.retry_policy
404
+ options.apply_defaults metadata: @config.metadata,
405
+ retry_policy: @config.retry_policy
406
+
407
+ @security_center_stub.call_rpc :create_finding, request, options: options do |response, operation|
408
+ yield response, operation if block_given?
409
+ return response
410
+ end
411
+ rescue GRPC::BadStatus => e
412
+ raise Google::Cloud::Error.from_error(e)
413
+ end
414
+
415
+ ##
416
+ # Creates a notification config.
417
+ #
418
+ # @overload create_notification_config(request, options = nil)
419
+ # Pass arguments to `create_notification_config` via a request object, either of type
420
+ # {Google::Cloud::SecurityCenter::V1p1beta1::CreateNotificationConfigRequest} or an equivalent Hash.
421
+ #
422
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::CreateNotificationConfigRequest, Hash]
423
+ # A request object representing the call parameters. Required. To specify no
424
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
425
+ # @param options [Gapic::CallOptions, Hash]
426
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
427
+ #
428
+ # @overload create_notification_config(parent: nil, config_id: nil, notification_config: nil)
429
+ # Pass arguments to `create_notification_config` via keyword arguments. Note that at
430
+ # least one keyword argument is required. To specify no parameters, or to keep all
431
+ # the default parameter values, pass an empty Hash as a request object (see above).
432
+ #
433
+ # @param parent [String]
434
+ # Required. Resource name of the new notification config's parent. Its format
435
+ # is "organizations/[organization_id]".
436
+ # @param config_id [String]
437
+ # Required.
438
+ # Unique identifier provided by the client within the parent scope.
439
+ # It must be between 1 and 128 characters, and contains alphanumeric
440
+ # characters, underscores or hyphens only.
441
+ # @param notification_config [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig, Hash]
442
+ # Required. The notification config being created. The name and the service
443
+ # account will be ignored as they are both output only fields on this
444
+ # resource.
445
+ #
446
+ # @yield [response, operation] Access the result along with the RPC operation
447
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig]
448
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
449
+ #
450
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig]
451
+ #
452
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
453
+ #
454
+ def create_notification_config request, options = nil
455
+ raise ArgumentError, "request must be provided" if request.nil?
456
+
457
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::CreateNotificationConfigRequest
458
+
459
+ # Converts hash and nil to an options object
460
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
461
+
462
+ # Customize the options with defaults
463
+ metadata = @config.rpcs.create_notification_config.metadata.to_h
464
+
465
+ # Set x-goog-api-client and x-goog-user-project headers
466
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
467
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
468
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
469
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
470
+
471
+ header_params = {
472
+ "parent" => request.parent
473
+ }
474
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
475
+ metadata[:"x-goog-request-params"] ||= request_params_header
476
+
477
+ options.apply_defaults timeout: @config.rpcs.create_notification_config.timeout,
478
+ metadata: metadata,
479
+ retry_policy: @config.rpcs.create_notification_config.retry_policy
480
+ options.apply_defaults metadata: @config.metadata,
481
+ retry_policy: @config.retry_policy
482
+
483
+ @security_center_stub.call_rpc :create_notification_config, request, options: options do |response, operation|
484
+ yield response, operation if block_given?
485
+ return response
486
+ end
487
+ rescue GRPC::BadStatus => e
488
+ raise Google::Cloud::Error.from_error(e)
489
+ end
490
+
491
+ ##
492
+ # Deletes a notification config.
493
+ #
494
+ # @overload delete_notification_config(request, options = nil)
495
+ # Pass arguments to `delete_notification_config` via a request object, either of type
496
+ # {Google::Cloud::SecurityCenter::V1p1beta1::DeleteNotificationConfigRequest} or an equivalent Hash.
497
+ #
498
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::DeleteNotificationConfigRequest, Hash]
499
+ # A request object representing the call parameters. Required. To specify no
500
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
501
+ # @param options [Gapic::CallOptions, Hash]
502
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
503
+ #
504
+ # @overload delete_notification_config(name: nil)
505
+ # Pass arguments to `delete_notification_config` via keyword arguments. Note that at
506
+ # least one keyword argument is required. To specify no parameters, or to keep all
507
+ # the default parameter values, pass an empty Hash as a request object (see above).
508
+ #
509
+ # @param name [String]
510
+ # Required. Name of the notification config to delete. Its format is
511
+ # "organizations/[organization_id]/notificationConfigs/[config_id]".
512
+ #
513
+ # @yield [response, operation] Access the result along with the RPC operation
514
+ # @yieldparam response [Google::Protobuf::Empty]
515
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
516
+ #
517
+ # @return [Google::Protobuf::Empty]
518
+ #
519
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
520
+ #
521
+ def delete_notification_config request, options = nil
522
+ raise ArgumentError, "request must be provided" if request.nil?
523
+
524
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::DeleteNotificationConfigRequest
525
+
526
+ # Converts hash and nil to an options object
527
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
528
+
529
+ # Customize the options with defaults
530
+ metadata = @config.rpcs.delete_notification_config.metadata.to_h
531
+
532
+ # Set x-goog-api-client and x-goog-user-project headers
533
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
534
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
535
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
536
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
537
+
538
+ header_params = {
539
+ "name" => request.name
540
+ }
541
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
542
+ metadata[:"x-goog-request-params"] ||= request_params_header
543
+
544
+ options.apply_defaults timeout: @config.rpcs.delete_notification_config.timeout,
545
+ metadata: metadata,
546
+ retry_policy: @config.rpcs.delete_notification_config.retry_policy
547
+ options.apply_defaults metadata: @config.metadata,
548
+ retry_policy: @config.retry_policy
549
+
550
+ @security_center_stub.call_rpc :delete_notification_config, request, options: options do |response, operation|
551
+ yield response, operation if block_given?
552
+ return response
553
+ end
554
+ rescue GRPC::BadStatus => e
555
+ raise Google::Cloud::Error.from_error(e)
556
+ end
557
+
558
+ ##
559
+ # Gets the access control policy on the specified Source.
560
+ #
561
+ # @overload get_iam_policy(request, options = nil)
562
+ # Pass arguments to `get_iam_policy` via a request object, either of type
563
+ # {Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
564
+ #
565
+ # @param request [Google::Iam::V1::GetIamPolicyRequest, Hash]
566
+ # A request object representing the call parameters. Required. To specify no
567
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
568
+ # @param options [Gapic::CallOptions, Hash]
569
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
570
+ #
571
+ # @overload get_iam_policy(resource: nil, options: nil)
572
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
573
+ # least one keyword argument is required. To specify no parameters, or to keep all
574
+ # the default parameter values, pass an empty Hash as a request object (see above).
575
+ #
576
+ # @param resource [String]
577
+ # REQUIRED: The resource for which the policy is being requested.
578
+ # See the operation documentation for the appropriate value for this field.
579
+ # @param options [Google::Iam::V1::GetPolicyOptions, Hash]
580
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
581
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
582
+ #
583
+ # @yield [response, operation] Access the result along with the RPC operation
584
+ # @yieldparam response [Google::Iam::V1::Policy]
585
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
586
+ #
587
+ # @return [Google::Iam::V1::Policy]
588
+ #
589
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
590
+ #
591
+ def get_iam_policy request, options = nil
592
+ raise ArgumentError, "request must be provided" if request.nil?
593
+
594
+ request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::GetIamPolicyRequest
595
+
596
+ # Converts hash and nil to an options object
597
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
598
+
599
+ # Customize the options with defaults
600
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
601
+
602
+ # Set x-goog-api-client and x-goog-user-project headers
603
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
604
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
605
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
606
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
607
+
608
+ header_params = {
609
+ "resource" => request.resource
610
+ }
611
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
612
+ metadata[:"x-goog-request-params"] ||= request_params_header
613
+
614
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
615
+ metadata: metadata,
616
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
617
+ options.apply_defaults metadata: @config.metadata,
618
+ retry_policy: @config.retry_policy
619
+
620
+ @security_center_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
621
+ yield response, operation if block_given?
622
+ return response
623
+ end
624
+ rescue GRPC::BadStatus => e
625
+ raise Google::Cloud::Error.from_error(e)
626
+ end
627
+
628
+ ##
629
+ # Gets a notification config.
630
+ #
631
+ # @overload get_notification_config(request, options = nil)
632
+ # Pass arguments to `get_notification_config` via a request object, either of type
633
+ # {Google::Cloud::SecurityCenter::V1p1beta1::GetNotificationConfigRequest} or an equivalent Hash.
634
+ #
635
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::GetNotificationConfigRequest, Hash]
636
+ # A request object representing the call parameters. Required. To specify no
637
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
638
+ # @param options [Gapic::CallOptions, Hash]
639
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
640
+ #
641
+ # @overload get_notification_config(name: nil)
642
+ # Pass arguments to `get_notification_config` via keyword arguments. Note that at
643
+ # least one keyword argument is required. To specify no parameters, or to keep all
644
+ # the default parameter values, pass an empty Hash as a request object (see above).
645
+ #
646
+ # @param name [String]
647
+ # Required. Name of the notification config to get. Its format is
648
+ # "organizations/[organization_id]/notificationConfigs/[config_id]".
649
+ #
650
+ # @yield [response, operation] Access the result along with the RPC operation
651
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig]
652
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
653
+ #
654
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig]
655
+ #
656
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
657
+ #
658
+ def get_notification_config request, options = nil
659
+ raise ArgumentError, "request must be provided" if request.nil?
660
+
661
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::GetNotificationConfigRequest
662
+
663
+ # Converts hash and nil to an options object
664
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
665
+
666
+ # Customize the options with defaults
667
+ metadata = @config.rpcs.get_notification_config.metadata.to_h
668
+
669
+ # Set x-goog-api-client and x-goog-user-project headers
670
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
671
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
672
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
673
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
674
+
675
+ header_params = {
676
+ "name" => request.name
677
+ }
678
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
679
+ metadata[:"x-goog-request-params"] ||= request_params_header
680
+
681
+ options.apply_defaults timeout: @config.rpcs.get_notification_config.timeout,
682
+ metadata: metadata,
683
+ retry_policy: @config.rpcs.get_notification_config.retry_policy
684
+ options.apply_defaults metadata: @config.metadata,
685
+ retry_policy: @config.retry_policy
686
+
687
+ @security_center_stub.call_rpc :get_notification_config, request, options: options do |response, operation|
688
+ yield response, operation if block_given?
689
+ return response
690
+ end
691
+ rescue GRPC::BadStatus => e
692
+ raise Google::Cloud::Error.from_error(e)
693
+ end
694
+
695
+ ##
696
+ # Gets the settings for an organization.
697
+ #
698
+ # @overload get_organization_settings(request, options = nil)
699
+ # Pass arguments to `get_organization_settings` via a request object, either of type
700
+ # {Google::Cloud::SecurityCenter::V1p1beta1::GetOrganizationSettingsRequest} or an equivalent Hash.
701
+ #
702
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::GetOrganizationSettingsRequest, Hash]
703
+ # A request object representing the call parameters. Required. To specify no
704
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
705
+ # @param options [Gapic::CallOptions, Hash]
706
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
707
+ #
708
+ # @overload get_organization_settings(name: nil)
709
+ # Pass arguments to `get_organization_settings` via keyword arguments. Note that at
710
+ # least one keyword argument is required. To specify no parameters, or to keep all
711
+ # the default parameter values, pass an empty Hash as a request object (see above).
712
+ #
713
+ # @param name [String]
714
+ # Required. Name of the organization to get organization settings for. Its
715
+ # format is "organizations/[organization_id]/organizationSettings".
716
+ #
717
+ # @yield [response, operation] Access the result along with the RPC operation
718
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::OrganizationSettings]
719
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
720
+ #
721
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::OrganizationSettings]
722
+ #
723
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
724
+ #
725
+ def get_organization_settings request, options = nil
726
+ raise ArgumentError, "request must be provided" if request.nil?
727
+
728
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::GetOrganizationSettingsRequest
729
+
730
+ # Converts hash and nil to an options object
731
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
732
+
733
+ # Customize the options with defaults
734
+ metadata = @config.rpcs.get_organization_settings.metadata.to_h
735
+
736
+ # Set x-goog-api-client and x-goog-user-project headers
737
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
738
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
739
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
740
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
741
+
742
+ header_params = {
743
+ "name" => request.name
744
+ }
745
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
746
+ metadata[:"x-goog-request-params"] ||= request_params_header
747
+
748
+ options.apply_defaults timeout: @config.rpcs.get_organization_settings.timeout,
749
+ metadata: metadata,
750
+ retry_policy: @config.rpcs.get_organization_settings.retry_policy
751
+ options.apply_defaults metadata: @config.metadata,
752
+ retry_policy: @config.retry_policy
753
+
754
+ @security_center_stub.call_rpc :get_organization_settings, request, options: options do |response, operation|
755
+ yield response, operation if block_given?
756
+ return response
757
+ end
758
+ rescue GRPC::BadStatus => e
759
+ raise Google::Cloud::Error.from_error(e)
760
+ end
761
+
762
+ ##
763
+ # Gets a source.
764
+ #
765
+ # @overload get_source(request, options = nil)
766
+ # Pass arguments to `get_source` via a request object, either of type
767
+ # {Google::Cloud::SecurityCenter::V1p1beta1::GetSourceRequest} or an equivalent Hash.
768
+ #
769
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::GetSourceRequest, Hash]
770
+ # A request object representing the call parameters. Required. To specify no
771
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
772
+ # @param options [Gapic::CallOptions, Hash]
773
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
774
+ #
775
+ # @overload get_source(name: nil)
776
+ # Pass arguments to `get_source` via keyword arguments. Note that at
777
+ # least one keyword argument is required. To specify no parameters, or to keep all
778
+ # the default parameter values, pass an empty Hash as a request object (see above).
779
+ #
780
+ # @param name [String]
781
+ # Required. Relative resource name of the source. Its format is
782
+ # "organizations/[organization_id]/source/[source_id]".
783
+ #
784
+ # @yield [response, operation] Access the result along with the RPC operation
785
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::Source]
786
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
787
+ #
788
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::Source]
789
+ #
790
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
791
+ #
792
+ def get_source request, options = nil
793
+ raise ArgumentError, "request must be provided" if request.nil?
794
+
795
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::GetSourceRequest
796
+
797
+ # Converts hash and nil to an options object
798
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
799
+
800
+ # Customize the options with defaults
801
+ metadata = @config.rpcs.get_source.metadata.to_h
802
+
803
+ # Set x-goog-api-client and x-goog-user-project headers
804
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
805
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
806
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
807
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
808
+
809
+ header_params = {
810
+ "name" => request.name
811
+ }
812
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
813
+ metadata[:"x-goog-request-params"] ||= request_params_header
814
+
815
+ options.apply_defaults timeout: @config.rpcs.get_source.timeout,
816
+ metadata: metadata,
817
+ retry_policy: @config.rpcs.get_source.retry_policy
818
+ options.apply_defaults metadata: @config.metadata,
819
+ retry_policy: @config.retry_policy
820
+
821
+ @security_center_stub.call_rpc :get_source, request, options: options do |response, operation|
822
+ yield response, operation if block_given?
823
+ return response
824
+ end
825
+ rescue GRPC::BadStatus => e
826
+ raise Google::Cloud::Error.from_error(e)
827
+ end
828
+
829
+ ##
830
+ # Filters an organization's assets and groups them by their specified
831
+ # properties.
832
+ #
833
+ # @overload group_assets(request, options = nil)
834
+ # Pass arguments to `group_assets` via a request object, either of type
835
+ # {Google::Cloud::SecurityCenter::V1p1beta1::GroupAssetsRequest} or an equivalent Hash.
836
+ #
837
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::GroupAssetsRequest, Hash]
838
+ # A request object representing the call parameters. Required. To specify no
839
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
840
+ # @param options [Gapic::CallOptions, Hash]
841
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
842
+ #
843
+ # @overload group_assets(parent: nil, filter: nil, group_by: nil, compare_duration: nil, read_time: nil, having: nil, page_token: nil, page_size: nil)
844
+ # Pass arguments to `group_assets` via keyword arguments. Note that at
845
+ # least one keyword argument is required. To specify no parameters, or to keep all
846
+ # the default parameter values, pass an empty Hash as a request object (see above).
847
+ #
848
+ # @param parent [String]
849
+ # Required. Name of the organization to groupBy. Its format is
850
+ # "organizations/[organization_id]".
851
+ # @param filter [String]
852
+ # Expression that defines the filter to apply across assets.
853
+ # The expression is a list of zero or more restrictions combined via logical
854
+ # operators `AND` and `OR`.
855
+ # Parentheses are supported, and `OR` has higher precedence than `AND`.
856
+ #
857
+ # Restrictions have the form `<field> <operator> <value>` and may have a `-`
858
+ # character in front of them to indicate negation. The fields map to those
859
+ # defined in the Asset resource. Examples include:
860
+ #
861
+ # * name
862
+ # * security_center_properties.resource_name
863
+ # * resource_properties.a_property
864
+ # * security_marks.marks.marka
865
+ #
866
+ # The supported operators are:
867
+ #
868
+ # * `=` for all value types.
869
+ # * `>`, `<`, `>=`, `<=` for integer values.
870
+ # * `:`, meaning substring matching, for strings.
871
+ #
872
+ # The supported value types are:
873
+ #
874
+ # * string literals in quotes.
875
+ # * integer literals without quotes.
876
+ # * boolean literals `true` and `false` without quotes.
877
+ #
878
+ # The following field and operator combinations are supported:
879
+ #
880
+ # * name: `=`
881
+ # * update_time: `=`, `>`, `<`, `>=`, `<=`
882
+ #
883
+ # Usage: This should be milliseconds since epoch or an RFC3339 string.
884
+ # Examples:
885
+ # "update_time = \"2019-06-10T16:07:18-07:00\""
886
+ # "update_time = 1560208038000"
887
+ #
888
+ # * create_time: `=`, `>`, `<`, `>=`, `<=`
889
+ #
890
+ # Usage: This should be milliseconds since epoch or an RFC3339 string.
891
+ # Examples:
892
+ # "create_time = \"2019-06-10T16:07:18-07:00\""
893
+ # "create_time = 1560208038000"
894
+ #
895
+ # * iam_policy.policy_blob: `=`, `:`
896
+ # * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
897
+ # * security_marks.marks: `=`, `:`
898
+ # * security_center_properties.resource_name: `=`, `:`
899
+ # * security_center_properties.resource_name_display_name: `=`, `:`
900
+ # * security_center_properties.resource_type: `=`, `:`
901
+ # * security_center_properties.resource_parent: `=`, `:`
902
+ # * security_center_properties.resource_parent_display_name: `=`, `:`
903
+ # * security_center_properties.resource_project: `=`, `:`
904
+ # * security_center_properties.resource_project_display_name: `=`, `:`
905
+ # * security_center_properties.resource_owners: `=`, `:`
906
+ #
907
+ # For example, `resource_properties.size = 100` is a valid filter string.
908
+ # @param group_by [String]
909
+ # Required. Expression that defines what assets fields to use for grouping.
910
+ # The string value should follow SQL syntax: comma separated list of fields.
911
+ # For example:
912
+ # "security_center_properties.resource_project,security_center_properties.project".
913
+ #
914
+ # The following fields are supported when compare_duration is not set:
915
+ #
916
+ # * security_center_properties.resource_project
917
+ # * security_center_properties.resource_project_display_name
918
+ # * security_center_properties.resource_type
919
+ # * security_center_properties.resource_parent
920
+ # * security_center_properties.resource_parent_display_name
921
+ #
922
+ # The following fields are supported when compare_duration is set:
923
+ #
924
+ # * security_center_properties.resource_type
925
+ # * security_center_properties.resource_project_display_name
926
+ # * security_center_properties.resource_parent_display_name
927
+ # @param compare_duration [Google::Protobuf::Duration, Hash]
928
+ # When compare_duration is set, the GroupResult's "state_change" property is
929
+ # updated to indicate whether the asset was added, removed, or remained
930
+ # present during the compare_duration period of time that precedes the
931
+ # read_time. This is the time between (read_time - compare_duration) and
932
+ # read_time.
933
+ #
934
+ # The state change value is derived based on the presence of the asset at the
935
+ # two points in time. Intermediate state changes between the two times don't
936
+ # affect the result. For example, the results aren't affected if the asset is
937
+ # removed and re-created again.
938
+ #
939
+ # Possible "state_change" values when compare_duration is specified:
940
+ #
941
+ # * "ADDED": indicates that the asset was not present at the start of
942
+ # compare_duration, but present at reference_time.
943
+ # * "REMOVED": indicates that the asset was present at the start of
944
+ # compare_duration, but not present at reference_time.
945
+ # * "ACTIVE": indicates that the asset was present at both the
946
+ # start and the end of the time period defined by
947
+ # compare_duration and reference_time.
948
+ #
949
+ # If compare_duration is not specified, then the only possible state_change
950
+ # is "UNUSED", which will be the state_change set for all assets present at
951
+ # read_time.
952
+ #
953
+ # If this field is set then `state_change` must be a specified field in
954
+ # `group_by`.
955
+ # @param read_time [Google::Protobuf::Timestamp, Hash]
956
+ # Time used as a reference point when filtering assets. The filter is limited
957
+ # to assets existing at the supplied time and their values are those at that
958
+ # specific time. Absence of this field will default to the API's version of
959
+ # NOW.
960
+ # @param having [String]
961
+ # Filter that specifies what fields to further filter on *after* the query
962
+ # filter has been executed. Currently only `state_change` is supported and
963
+ # requires compare_duration to be specified.
964
+ # @param page_token [String]
965
+ # The value returned by the last `GroupAssetsResponse`; indicates
966
+ # that this is a continuation of a prior `GroupAssets` call, and that the
967
+ # system should return the next page of data.
968
+ # @param page_size [Integer]
969
+ # The maximum number of results to return in a single response. Default is
970
+ # 10, minimum is 1, maximum is 1000.
971
+ #
972
+ # @yield [response, operation] Access the result along with the RPC operation
973
+ # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::GroupResult>]
974
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
975
+ #
976
+ # @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::GroupResult>]
977
+ #
978
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
979
+ #
980
+ def group_assets request, options = nil
981
+ raise ArgumentError, "request must be provided" if request.nil?
982
+
983
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::GroupAssetsRequest
984
+
985
+ # Converts hash and nil to an options object
986
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
987
+
988
+ # Customize the options with defaults
989
+ metadata = @config.rpcs.group_assets.metadata.to_h
990
+
991
+ # Set x-goog-api-client and x-goog-user-project headers
992
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
993
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
994
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
995
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
996
+
997
+ header_params = {
998
+ "parent" => request.parent
999
+ }
1000
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1001
+ metadata[:"x-goog-request-params"] ||= request_params_header
1002
+
1003
+ options.apply_defaults timeout: @config.rpcs.group_assets.timeout,
1004
+ metadata: metadata,
1005
+ retry_policy: @config.rpcs.group_assets.retry_policy
1006
+ options.apply_defaults metadata: @config.metadata,
1007
+ retry_policy: @config.retry_policy
1008
+
1009
+ @security_center_stub.call_rpc :group_assets, request, options: options do |response, operation|
1010
+ response = Gapic::PagedEnumerable.new @security_center_stub, :group_assets, request, response, operation, options
1011
+ yield response, operation if block_given?
1012
+ return response
1013
+ end
1014
+ rescue GRPC::BadStatus => e
1015
+ raise Google::Cloud::Error.from_error(e)
1016
+ end
1017
+
1018
+ ##
1019
+ # Filters an organization or source's findings and groups them by their
1020
+ # specified properties.
1021
+ #
1022
+ # To group across all sources provide a `-` as the source id.
1023
+ # Example: /v1p1beta1/organizations/\\{organization_id}/sources/-/findings
1024
+ #
1025
+ # @overload group_findings(request, options = nil)
1026
+ # Pass arguments to `group_findings` via a request object, either of type
1027
+ # {Google::Cloud::SecurityCenter::V1p1beta1::GroupFindingsRequest} or an equivalent Hash.
1028
+ #
1029
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::GroupFindingsRequest, Hash]
1030
+ # A request object representing the call parameters. Required. To specify no
1031
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1032
+ # @param options [Gapic::CallOptions, Hash]
1033
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1034
+ #
1035
+ # @overload group_findings(parent: nil, filter: nil, group_by: nil, read_time: nil, compare_duration: nil, having: nil, page_token: nil, page_size: nil)
1036
+ # Pass arguments to `group_findings` via keyword arguments. Note that at
1037
+ # least one keyword argument is required. To specify no parameters, or to keep all
1038
+ # the default parameter values, pass an empty Hash as a request object (see above).
1039
+ #
1040
+ # @param parent [String]
1041
+ # Required. Name of the source to groupBy. Its format is
1042
+ # "organizations/[organization_id]/sources/[source_id]". To groupBy across
1043
+ # all sources provide a source_id of `-`. For example:
1044
+ # organizations/\\{organization_id}/sources/-
1045
+ # @param filter [String]
1046
+ # Expression that defines the filter to apply across findings.
1047
+ # The expression is a list of one or more restrictions combined via logical
1048
+ # operators `AND` and `OR`.
1049
+ # Parentheses are supported, and `OR` has higher precedence than `AND`.
1050
+ #
1051
+ # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1052
+ # character in front of them to indicate negation. Examples include:
1053
+ #
1054
+ # * name
1055
+ # * source_properties.a_property
1056
+ # * security_marks.marks.marka
1057
+ #
1058
+ # The supported operators are:
1059
+ #
1060
+ # * `=` for all value types.
1061
+ # * `>`, `<`, `>=`, `<=` for integer values.
1062
+ # * `:`, meaning substring matching, for strings.
1063
+ #
1064
+ # The supported value types are:
1065
+ #
1066
+ # * string literals in quotes.
1067
+ # * integer literals without quotes.
1068
+ # * boolean literals `true` and `false` without quotes.
1069
+ #
1070
+ # The following field and operator combinations are supported:
1071
+ #
1072
+ # * name: `=`
1073
+ # * parent: `=`, `:`
1074
+ # * resource_name: `=`, `:`
1075
+ # * state: `=`, `:`
1076
+ # * category: `=`, `:`
1077
+ # * external_uri: `=`, `:`
1078
+ # * event_time: `=`, `>`, `<`, `>=`, `<=`
1079
+ #
1080
+ # Usage: This should be milliseconds since epoch or an RFC3339 string.
1081
+ # Examples:
1082
+ # "event_time = \"2019-06-10T16:07:18-07:00\""
1083
+ # "event_time = 1560208038000"
1084
+ #
1085
+ # * security_marks.marks: `=`, `:`
1086
+ # * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1087
+ #
1088
+ # For example, `source_properties.size = 100` is a valid filter string.
1089
+ # @param group_by [String]
1090
+ # Required. Expression that defines what assets fields to use for grouping
1091
+ # (including `state_change`). The string value should follow SQL syntax:
1092
+ # comma separated list of fields. For example: "parent,resource_name".
1093
+ #
1094
+ # The following fields are supported:
1095
+ #
1096
+ # * resource_name
1097
+ # * category
1098
+ # * state
1099
+ # * parent
1100
+ #
1101
+ # The following fields are supported when compare_duration is set:
1102
+ #
1103
+ # * state_change
1104
+ # @param read_time [Google::Protobuf::Timestamp, Hash]
1105
+ # Time used as a reference point when filtering findings. The filter is
1106
+ # limited to findings existing at the supplied time and their values are
1107
+ # those at that specific time. Absence of this field will default to the
1108
+ # API's version of NOW.
1109
+ # @param compare_duration [Google::Protobuf::Duration, Hash]
1110
+ # When compare_duration is set, the GroupResult's "state_change" attribute is
1111
+ # updated to indicate whether the finding had its state changed, the
1112
+ # finding's state remained unchanged, or if the finding was added during the
1113
+ # compare_duration period of time that precedes the read_time. This is the
1114
+ # time between (read_time - compare_duration) and read_time.
1115
+ #
1116
+ # The state_change value is derived based on the presence and state of the
1117
+ # finding at the two points in time. Intermediate state changes between the
1118
+ # two times don't affect the result. For example, the results aren't affected
1119
+ # if the finding is made inactive and then active again.
1120
+ #
1121
+ # Possible "state_change" values when compare_duration is specified:
1122
+ #
1123
+ # * "CHANGED": indicates that the finding was present at the start of
1124
+ # compare_duration, but changed its state at read_time.
1125
+ # * "UNCHANGED": indicates that the finding was present at the start of
1126
+ # compare_duration and did not change state at read_time.
1127
+ # * "ADDED": indicates that the finding was not present at the start
1128
+ # of compare_duration, but was present at read_time.
1129
+ #
1130
+ # If compare_duration is not specified, then the only possible state_change
1131
+ # is "UNUSED", which will be the state_change set for all findings present
1132
+ # at read_time.
1133
+ #
1134
+ # If this field is set then `state_change` must be a specified field in
1135
+ # `group_by`.
1136
+ # @param having [String]
1137
+ # Filter that specifies what fields to further filter on *after* the query
1138
+ # filter has been executed. Currently only `finding.state` and `state_change`
1139
+ # are supported and requires compare_duration to be specified.
1140
+ # @param page_token [String]
1141
+ # The value returned by the last `GroupFindingsResponse`; indicates
1142
+ # that this is a continuation of a prior `GroupFindings` call, and
1143
+ # that the system should return the next page of data.
1144
+ # @param page_size [Integer]
1145
+ # The maximum number of results to return in a single response. Default is
1146
+ # 10, minimum is 1, maximum is 1000.
1147
+ #
1148
+ # @yield [response, operation] Access the result along with the RPC operation
1149
+ # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::GroupResult>]
1150
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1151
+ #
1152
+ # @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::GroupResult>]
1153
+ #
1154
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1155
+ #
1156
+ def group_findings request, options = nil
1157
+ raise ArgumentError, "request must be provided" if request.nil?
1158
+
1159
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::GroupFindingsRequest
1160
+
1161
+ # Converts hash and nil to an options object
1162
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1163
+
1164
+ # Customize the options with defaults
1165
+ metadata = @config.rpcs.group_findings.metadata.to_h
1166
+
1167
+ # Set x-goog-api-client and x-goog-user-project headers
1168
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1169
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1170
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1171
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1172
+
1173
+ header_params = {
1174
+ "parent" => request.parent
1175
+ }
1176
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1177
+ metadata[:"x-goog-request-params"] ||= request_params_header
1178
+
1179
+ options.apply_defaults timeout: @config.rpcs.group_findings.timeout,
1180
+ metadata: metadata,
1181
+ retry_policy: @config.rpcs.group_findings.retry_policy
1182
+ options.apply_defaults metadata: @config.metadata,
1183
+ retry_policy: @config.retry_policy
1184
+
1185
+ @security_center_stub.call_rpc :group_findings, request, options: options do |response, operation|
1186
+ response = Gapic::PagedEnumerable.new @security_center_stub, :group_findings, request, response, operation, options
1187
+ yield response, operation if block_given?
1188
+ return response
1189
+ end
1190
+ rescue GRPC::BadStatus => e
1191
+ raise Google::Cloud::Error.from_error(e)
1192
+ end
1193
+
1194
+ ##
1195
+ # Lists an organization's assets.
1196
+ #
1197
+ # @overload list_assets(request, options = nil)
1198
+ # Pass arguments to `list_assets` via a request object, either of type
1199
+ # {Google::Cloud::SecurityCenter::V1p1beta1::ListAssetsRequest} or an equivalent Hash.
1200
+ #
1201
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::ListAssetsRequest, Hash]
1202
+ # A request object representing the call parameters. Required. To specify no
1203
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1204
+ # @param options [Gapic::CallOptions, Hash]
1205
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1206
+ #
1207
+ # @overload list_assets(parent: nil, filter: nil, order_by: nil, read_time: nil, compare_duration: nil, having: nil, field_mask: nil, page_token: nil, page_size: nil)
1208
+ # Pass arguments to `list_assets` via keyword arguments. Note that at
1209
+ # least one keyword argument is required. To specify no parameters, or to keep all
1210
+ # the default parameter values, pass an empty Hash as a request object (see above).
1211
+ #
1212
+ # @param parent [String]
1213
+ # Required. Name of the organization assets should belong to. Its format is
1214
+ # "organizations/[organization_id]".
1215
+ # @param filter [String]
1216
+ # Expression that defines the filter to apply across assets.
1217
+ # The expression is a list of zero or more restrictions combined via logical
1218
+ # operators `AND` and `OR`.
1219
+ # Parentheses are supported, and `OR` has higher precedence than `AND`.
1220
+ #
1221
+ # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1222
+ # character in front of them to indicate negation. The fields map to those
1223
+ # defined in the Asset resource. Examples include:
1224
+ #
1225
+ # * name
1226
+ # * security_center_properties.resource_name
1227
+ # * resource_properties.a_property
1228
+ # * security_marks.marks.marka
1229
+ #
1230
+ # The supported operators are:
1231
+ #
1232
+ # * `=` for all value types.
1233
+ # * `>`, `<`, `>=`, `<=` for integer values.
1234
+ # * `:`, meaning substring matching, for strings.
1235
+ #
1236
+ # The supported value types are:
1237
+ #
1238
+ # * string literals in quotes.
1239
+ # * integer literals without quotes.
1240
+ # * boolean literals `true` and `false` without quotes.
1241
+ #
1242
+ # The following are the allowed field and operator combinations:
1243
+ #
1244
+ # * name: `=`
1245
+ # * update_time: `=`, `>`, `<`, `>=`, `<=`
1246
+ #
1247
+ # Usage: This should be milliseconds since epoch or an RFC3339 string.
1248
+ # Examples:
1249
+ # "update_time = \"2019-06-10T16:07:18-07:00\""
1250
+ # "update_time = 1560208038000"
1251
+ #
1252
+ # * create_time: `=`, `>`, `<`, `>=`, `<=`
1253
+ #
1254
+ # Usage: This should be milliseconds since epoch or an RFC3339 string.
1255
+ # Examples:
1256
+ # "create_time = \"2019-06-10T16:07:18-07:00\""
1257
+ # "create_time = 1560208038000"
1258
+ #
1259
+ # * iam_policy.policy_blob: `=`, `:`
1260
+ # * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1261
+ # * security_marks.marks: `=`, `:`
1262
+ # * security_center_properties.resource_name: `=`, `:`
1263
+ # * security_center_properties.resource_display_name: `=`, `:`
1264
+ # * security_center_properties.resource_type: `=`, `:`
1265
+ # * security_center_properties.resource_parent: `=`, `:`
1266
+ # * security_center_properties.resource_parent_display_name: `=`, `:`
1267
+ # * security_center_properties.resource_project: `=`, `:`
1268
+ # * security_center_properties.resource_project_display_name: `=`, `:`
1269
+ # * security_center_properties.resource_owners: `=`, `:`
1270
+ #
1271
+ # For example, `resource_properties.size = 100` is a valid filter string.
1272
+ # @param order_by [String]
1273
+ # Expression that defines what fields and order to use for sorting. The
1274
+ # string value should follow SQL syntax: comma separated list of fields. For
1275
+ # example: "name,resource_properties.a_property". The default sorting order
1276
+ # is ascending. To specify descending order for a field, a suffix " desc"
1277
+ # should be appended to the field name. For example: "name
1278
+ # desc,resource_properties.a_property". Redundant space characters in the
1279
+ # syntax are insignificant. "name desc,resource_properties.a_property" and "
1280
+ # name desc , resource_properties.a_property " are equivalent.
1281
+ #
1282
+ # The following fields are supported:
1283
+ # name
1284
+ # update_time
1285
+ # resource_properties
1286
+ # security_marks.marks
1287
+ # security_center_properties.resource_name
1288
+ # security_center_properties.resource_display_name
1289
+ # security_center_properties.resource_parent
1290
+ # security_center_properties.resource_parent_display_name
1291
+ # security_center_properties.resource_project
1292
+ # security_center_properties.resource_project_display_name
1293
+ # security_center_properties.resource_type
1294
+ # @param read_time [Google::Protobuf::Timestamp, Hash]
1295
+ # Time used as a reference point when filtering assets. The filter is limited
1296
+ # to assets existing at the supplied time and their values are those at that
1297
+ # specific time. Absence of this field will default to the API's version of
1298
+ # NOW.
1299
+ # @param compare_duration [Google::Protobuf::Duration, Hash]
1300
+ # When compare_duration is set, the ListAssetsResult's "state_change"
1301
+ # attribute is updated to indicate whether the asset was added, removed, or
1302
+ # remained present during the compare_duration period of time that precedes
1303
+ # the read_time. This is the time between (read_time - compare_duration) and
1304
+ # read_time.
1305
+ #
1306
+ # The state_change value is derived based on the presence of the asset at the
1307
+ # two points in time. Intermediate state changes between the two times don't
1308
+ # affect the result. For example, the results aren't affected if the asset is
1309
+ # removed and re-created again.
1310
+ #
1311
+ # Possible "state_change" values when compare_duration is specified:
1312
+ #
1313
+ # * "ADDED": indicates that the asset was not present at the start of
1314
+ # compare_duration, but present at read_time.
1315
+ # * "REMOVED": indicates that the asset was present at the start of
1316
+ # compare_duration, but not present at read_time.
1317
+ # * "ACTIVE": indicates that the asset was present at both the
1318
+ # start and the end of the time period defined by
1319
+ # compare_duration and read_time.
1320
+ #
1321
+ # If compare_duration is not specified, then the only possible state_change
1322
+ # is "UNUSED", which will be the state_change set for all assets present at
1323
+ # read_time.
1324
+ # @param having [String]
1325
+ # Filter that specifies what fields to further filter on *after* the query
1326
+ # filter has been executed. Currently only `state_change` is supported and
1327
+ # requires compare_duration to be specified.
1328
+ # @param field_mask [Google::Protobuf::FieldMask, Hash]
1329
+ # Optional.
1330
+ # A field mask to specify the ListAssetsResult fields to be listed in the
1331
+ # response.
1332
+ # An empty field mask will list all fields.
1333
+ # @param page_token [String]
1334
+ # The value returned by the last `ListAssetsResponse`; indicates
1335
+ # that this is a continuation of a prior `ListAssets` call, and
1336
+ # that the system should return the next page of data.
1337
+ # @param page_size [Integer]
1338
+ # The maximum number of results to return in a single response. Default is
1339
+ # 10, minimum is 1, maximum is 1000.
1340
+ #
1341
+ # @yield [response, operation] Access the result along with the RPC operation
1342
+ # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::ListAssetsResponse::ListAssetsResult>]
1343
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1344
+ #
1345
+ # @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::ListAssetsResponse::ListAssetsResult>]
1346
+ #
1347
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1348
+ #
1349
+ def list_assets request, options = nil
1350
+ raise ArgumentError, "request must be provided" if request.nil?
1351
+
1352
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::ListAssetsRequest
1353
+
1354
+ # Converts hash and nil to an options object
1355
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1356
+
1357
+ # Customize the options with defaults
1358
+ metadata = @config.rpcs.list_assets.metadata.to_h
1359
+
1360
+ # Set x-goog-api-client and x-goog-user-project headers
1361
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1362
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1363
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1364
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1365
+
1366
+ header_params = {
1367
+ "parent" => request.parent
1368
+ }
1369
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1370
+ metadata[:"x-goog-request-params"] ||= request_params_header
1371
+
1372
+ options.apply_defaults timeout: @config.rpcs.list_assets.timeout,
1373
+ metadata: metadata,
1374
+ retry_policy: @config.rpcs.list_assets.retry_policy
1375
+ options.apply_defaults metadata: @config.metadata,
1376
+ retry_policy: @config.retry_policy
1377
+
1378
+ @security_center_stub.call_rpc :list_assets, request, options: options do |response, operation|
1379
+ response = Gapic::PagedEnumerable.new @security_center_stub, :list_assets, request, response, operation, options
1380
+ yield response, operation if block_given?
1381
+ return response
1382
+ end
1383
+ rescue GRPC::BadStatus => e
1384
+ raise Google::Cloud::Error.from_error(e)
1385
+ end
1386
+
1387
+ ##
1388
+ # Lists an organization or source's findings.
1389
+ #
1390
+ # To list across all sources provide a `-` as the source id.
1391
+ # Example: /v1p1beta1/organizations/\\{organization_id}/sources/-/findings
1392
+ #
1393
+ # @overload list_findings(request, options = nil)
1394
+ # Pass arguments to `list_findings` via a request object, either of type
1395
+ # {Google::Cloud::SecurityCenter::V1p1beta1::ListFindingsRequest} or an equivalent Hash.
1396
+ #
1397
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::ListFindingsRequest, Hash]
1398
+ # A request object representing the call parameters. Required. To specify no
1399
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1400
+ # @param options [Gapic::CallOptions, Hash]
1401
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1402
+ #
1403
+ # @overload list_findings(parent: nil, filter: nil, order_by: nil, read_time: nil, compare_duration: nil, having: nil, field_mask: nil, page_token: nil, page_size: nil)
1404
+ # Pass arguments to `list_findings` via keyword arguments. Note that at
1405
+ # least one keyword argument is required. To specify no parameters, or to keep all
1406
+ # the default parameter values, pass an empty Hash as a request object (see above).
1407
+ #
1408
+ # @param parent [String]
1409
+ # Required. Name of the source the findings belong to. Its format is
1410
+ # "organizations/[organization_id]/sources/[source_id]". To list across all
1411
+ # sources provide a source_id of `-`. For example:
1412
+ # organizations/\\{organization_id}/sources/-
1413
+ # @param filter [String]
1414
+ # Expression that defines the filter to apply across findings.
1415
+ # The expression is a list of one or more restrictions combined via logical
1416
+ # operators `AND` and `OR`.
1417
+ # Parentheses are supported, and `OR` has higher precedence than `AND`.
1418
+ #
1419
+ # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1420
+ # character in front of them to indicate negation. Examples include:
1421
+ #
1422
+ # * name
1423
+ # * source_properties.a_property
1424
+ # * security_marks.marks.marka
1425
+ #
1426
+ # The supported operators are:
1427
+ #
1428
+ # * `=` for all value types.
1429
+ # * `>`, `<`, `>=`, `<=` for integer values.
1430
+ # * `:`, meaning substring matching, for strings.
1431
+ #
1432
+ # The supported value types are:
1433
+ #
1434
+ # * string literals in quotes.
1435
+ # * integer literals without quotes.
1436
+ # * boolean literals `true` and `false` without quotes.
1437
+ #
1438
+ # The following field and operator combinations are supported:
1439
+ #
1440
+ # name: `=`
1441
+ # parent: `=`, `:`
1442
+ # resource_name: `=`, `:`
1443
+ # state: `=`, `:`
1444
+ # category: `=`, `:`
1445
+ # external_uri: `=`, `:`
1446
+ # event_time: `=`, `>`, `<`, `>=`, `<=`
1447
+ #
1448
+ # Usage: This should be milliseconds since epoch or an RFC3339 string.
1449
+ # Examples:
1450
+ # "event_time = \"2019-06-10T16:07:18-07:00\""
1451
+ # "event_time = 1560208038000"
1452
+ #
1453
+ # security_marks.marks: `=`, `:`
1454
+ # source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1455
+ #
1456
+ # For example, `source_properties.size = 100` is a valid filter string.
1457
+ # @param order_by [String]
1458
+ # Expression that defines what fields and order to use for sorting. The
1459
+ # string value should follow SQL syntax: comma separated list of fields. For
1460
+ # example: "name,resource_properties.a_property". The default sorting order
1461
+ # is ascending. To specify descending order for a field, a suffix " desc"
1462
+ # should be appended to the field name. For example: "name
1463
+ # desc,source_properties.a_property". Redundant space characters in the
1464
+ # syntax are insignificant. "name desc,source_properties.a_property" and "
1465
+ # name desc , source_properties.a_property " are equivalent.
1466
+ #
1467
+ # The following fields are supported:
1468
+ # name
1469
+ # parent
1470
+ # state
1471
+ # category
1472
+ # resource_name
1473
+ # event_time
1474
+ # source_properties
1475
+ # security_marks.marks
1476
+ # @param read_time [Google::Protobuf::Timestamp, Hash]
1477
+ # Time used as a reference point when filtering findings. The filter is
1478
+ # limited to findings existing at the supplied time and their values are
1479
+ # those at that specific time. Absence of this field will default to the
1480
+ # API's version of NOW.
1481
+ # @param compare_duration [Google::Protobuf::Duration, Hash]
1482
+ # When compare_duration is set, the ListFindingsResult's "state_change"
1483
+ # attribute is updated to indicate whether the finding had its state changed,
1484
+ # the finding's state remained unchanged, or if the finding was added in any
1485
+ # state during the compare_duration period of time that precedes the
1486
+ # read_time. This is the time between (read_time - compare_duration) and
1487
+ # read_time.
1488
+ #
1489
+ # The state_change value is derived based on the presence and state of the
1490
+ # finding at the two points in time. Intermediate state changes between the
1491
+ # two times don't affect the result. For example, the results aren't affected
1492
+ # if the finding is made inactive and then active again.
1493
+ #
1494
+ # Possible "state_change" values when compare_duration is specified:
1495
+ #
1496
+ # * "CHANGED": indicates that the finding was present at the start of
1497
+ # compare_duration, but changed its state at read_time.
1498
+ # * "UNCHANGED": indicates that the finding was present at the start of
1499
+ # compare_duration and did not change state at read_time.
1500
+ # * "ADDED": indicates that the finding was not present at the start
1501
+ # of compare_duration, but was present at read_time.
1502
+ #
1503
+ # If compare_duration is not specified, then the only possible state_change
1504
+ # is "UNUSED", which will be the state_change set for all findings present at
1505
+ # read_time.
1506
+ # @param having [String]
1507
+ # Filter that specifies what fields to further filter on *after* the query
1508
+ # filter has been executed. Currently only `finding.state` and `state_change`
1509
+ # are supported and requires compare_duration to be specified.
1510
+ # @param field_mask [Google::Protobuf::FieldMask, Hash]
1511
+ # Optional.
1512
+ # A field mask to specify the Finding fields to be listed in the response.
1513
+ # An empty field mask will list all fields.
1514
+ # @param page_token [String]
1515
+ # The value returned by the last `ListFindingsResponse`; indicates
1516
+ # that this is a continuation of a prior `ListFindings` call, and
1517
+ # that the system should return the next page of data.
1518
+ # @param page_size [Integer]
1519
+ # The maximum number of results to return in a single response. Default is
1520
+ # 10, minimum is 1, maximum is 1000.
1521
+ #
1522
+ # @yield [response, operation] Access the result along with the RPC operation
1523
+ # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::ListFindingsResponse::ListFindingsResult>]
1524
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1525
+ #
1526
+ # @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::ListFindingsResponse::ListFindingsResult>]
1527
+ #
1528
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1529
+ #
1530
+ def list_findings request, options = nil
1531
+ raise ArgumentError, "request must be provided" if request.nil?
1532
+
1533
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::ListFindingsRequest
1534
+
1535
+ # Converts hash and nil to an options object
1536
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1537
+
1538
+ # Customize the options with defaults
1539
+ metadata = @config.rpcs.list_findings.metadata.to_h
1540
+
1541
+ # Set x-goog-api-client and x-goog-user-project headers
1542
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1543
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1544
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1545
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1546
+
1547
+ header_params = {
1548
+ "parent" => request.parent
1549
+ }
1550
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1551
+ metadata[:"x-goog-request-params"] ||= request_params_header
1552
+
1553
+ options.apply_defaults timeout: @config.rpcs.list_findings.timeout,
1554
+ metadata: metadata,
1555
+ retry_policy: @config.rpcs.list_findings.retry_policy
1556
+ options.apply_defaults metadata: @config.metadata,
1557
+ retry_policy: @config.retry_policy
1558
+
1559
+ @security_center_stub.call_rpc :list_findings, request, options: options do |response, operation|
1560
+ response = Gapic::PagedEnumerable.new @security_center_stub, :list_findings, request, response, operation, options
1561
+ yield response, operation if block_given?
1562
+ return response
1563
+ end
1564
+ rescue GRPC::BadStatus => e
1565
+ raise Google::Cloud::Error.from_error(e)
1566
+ end
1567
+
1568
+ ##
1569
+ # Lists notification configs.
1570
+ #
1571
+ # @overload list_notification_configs(request, options = nil)
1572
+ # Pass arguments to `list_notification_configs` via a request object, either of type
1573
+ # {Google::Cloud::SecurityCenter::V1p1beta1::ListNotificationConfigsRequest} or an equivalent Hash.
1574
+ #
1575
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::ListNotificationConfigsRequest, Hash]
1576
+ # A request object representing the call parameters. Required. To specify no
1577
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1578
+ # @param options [Gapic::CallOptions, Hash]
1579
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1580
+ #
1581
+ # @overload list_notification_configs(parent: nil, page_token: nil, page_size: nil)
1582
+ # Pass arguments to `list_notification_configs` via keyword arguments. Note that at
1583
+ # least one keyword argument is required. To specify no parameters, or to keep all
1584
+ # the default parameter values, pass an empty Hash as a request object (see above).
1585
+ #
1586
+ # @param parent [String]
1587
+ # Required. Name of the organization to list notification configs.
1588
+ # Its format is "organizations/[organization_id]".
1589
+ # @param page_token [String]
1590
+ # The value returned by the last `ListNotificationConfigsResponse`; indicates
1591
+ # that this is a continuation of a prior `ListNotificationConfigs` call, and
1592
+ # that the system should return the next page of data.
1593
+ # @param page_size [Integer]
1594
+ # The maximum number of results to return in a single response. Default is
1595
+ # 10, minimum is 1, maximum is 1000.
1596
+ #
1597
+ # @yield [response, operation] Access the result along with the RPC operation
1598
+ # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig>]
1599
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1600
+ #
1601
+ # @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig>]
1602
+ #
1603
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1604
+ #
1605
+ def list_notification_configs request, options = nil
1606
+ raise ArgumentError, "request must be provided" if request.nil?
1607
+
1608
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::ListNotificationConfigsRequest
1609
+
1610
+ # Converts hash and nil to an options object
1611
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1612
+
1613
+ # Customize the options with defaults
1614
+ metadata = @config.rpcs.list_notification_configs.metadata.to_h
1615
+
1616
+ # Set x-goog-api-client and x-goog-user-project headers
1617
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1618
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1619
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1620
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1621
+
1622
+ header_params = {
1623
+ "parent" => request.parent
1624
+ }
1625
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1626
+ metadata[:"x-goog-request-params"] ||= request_params_header
1627
+
1628
+ options.apply_defaults timeout: @config.rpcs.list_notification_configs.timeout,
1629
+ metadata: metadata,
1630
+ retry_policy: @config.rpcs.list_notification_configs.retry_policy
1631
+ options.apply_defaults metadata: @config.metadata,
1632
+ retry_policy: @config.retry_policy
1633
+
1634
+ @security_center_stub.call_rpc :list_notification_configs, request, options: options do |response, operation|
1635
+ response = Gapic::PagedEnumerable.new @security_center_stub, :list_notification_configs, request, response, operation, options
1636
+ yield response, operation if block_given?
1637
+ return response
1638
+ end
1639
+ rescue GRPC::BadStatus => e
1640
+ raise Google::Cloud::Error.from_error(e)
1641
+ end
1642
+
1643
+ ##
1644
+ # Lists all sources belonging to an organization.
1645
+ #
1646
+ # @overload list_sources(request, options = nil)
1647
+ # Pass arguments to `list_sources` via a request object, either of type
1648
+ # {Google::Cloud::SecurityCenter::V1p1beta1::ListSourcesRequest} or an equivalent Hash.
1649
+ #
1650
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::ListSourcesRequest, Hash]
1651
+ # A request object representing the call parameters. Required. To specify no
1652
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1653
+ # @param options [Gapic::CallOptions, Hash]
1654
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1655
+ #
1656
+ # @overload list_sources(parent: nil, page_token: nil, page_size: nil)
1657
+ # Pass arguments to `list_sources` via keyword arguments. Note that at
1658
+ # least one keyword argument is required. To specify no parameters, or to keep all
1659
+ # the default parameter values, pass an empty Hash as a request object (see above).
1660
+ #
1661
+ # @param parent [String]
1662
+ # Required. Resource name of the parent of sources to list. Its format should
1663
+ # be "organizations/[organization_id]".
1664
+ # @param page_token [String]
1665
+ # The value returned by the last `ListSourcesResponse`; indicates
1666
+ # that this is a continuation of a prior `ListSources` call, and
1667
+ # that the system should return the next page of data.
1668
+ # @param page_size [Integer]
1669
+ # The maximum number of results to return in a single response. Default is
1670
+ # 10, minimum is 1, maximum is 1000.
1671
+ #
1672
+ # @yield [response, operation] Access the result along with the RPC operation
1673
+ # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::Source>]
1674
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1675
+ #
1676
+ # @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1p1beta1::Source>]
1677
+ #
1678
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1679
+ #
1680
+ def list_sources request, options = nil
1681
+ raise ArgumentError, "request must be provided" if request.nil?
1682
+
1683
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::ListSourcesRequest
1684
+
1685
+ # Converts hash and nil to an options object
1686
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1687
+
1688
+ # Customize the options with defaults
1689
+ metadata = @config.rpcs.list_sources.metadata.to_h
1690
+
1691
+ # Set x-goog-api-client and x-goog-user-project headers
1692
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1693
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1694
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1695
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1696
+
1697
+ header_params = {
1698
+ "parent" => request.parent
1699
+ }
1700
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1701
+ metadata[:"x-goog-request-params"] ||= request_params_header
1702
+
1703
+ options.apply_defaults timeout: @config.rpcs.list_sources.timeout,
1704
+ metadata: metadata,
1705
+ retry_policy: @config.rpcs.list_sources.retry_policy
1706
+ options.apply_defaults metadata: @config.metadata,
1707
+ retry_policy: @config.retry_policy
1708
+
1709
+ @security_center_stub.call_rpc :list_sources, request, options: options do |response, operation|
1710
+ response = Gapic::PagedEnumerable.new @security_center_stub, :list_sources, request, response, operation, options
1711
+ yield response, operation if block_given?
1712
+ return response
1713
+ end
1714
+ rescue GRPC::BadStatus => e
1715
+ raise Google::Cloud::Error.from_error(e)
1716
+ end
1717
+
1718
+ ##
1719
+ # Runs asset discovery. The discovery is tracked with a long-running
1720
+ # operation.
1721
+ #
1722
+ # This API can only be called with limited frequency for an organization. If
1723
+ # it is called too frequently the caller will receive a TOO_MANY_REQUESTS
1724
+ # error.
1725
+ #
1726
+ # @overload run_asset_discovery(request, options = nil)
1727
+ # Pass arguments to `run_asset_discovery` via a request object, either of type
1728
+ # {Google::Cloud::SecurityCenter::V1p1beta1::RunAssetDiscoveryRequest} or an equivalent Hash.
1729
+ #
1730
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::RunAssetDiscoveryRequest, Hash]
1731
+ # A request object representing the call parameters. Required. To specify no
1732
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1733
+ # @param options [Gapic::CallOptions, Hash]
1734
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1735
+ #
1736
+ # @overload run_asset_discovery(parent: nil)
1737
+ # Pass arguments to `run_asset_discovery` via keyword arguments. Note that at
1738
+ # least one keyword argument is required. To specify no parameters, or to keep all
1739
+ # the default parameter values, pass an empty Hash as a request object (see above).
1740
+ #
1741
+ # @param parent [String]
1742
+ # Required. Name of the organization to run asset discovery for. Its format
1743
+ # is "organizations/[organization_id]".
1744
+ #
1745
+ # @yield [response, operation] Access the result along with the RPC operation
1746
+ # @yieldparam response [Gapic::Operation]
1747
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1748
+ #
1749
+ # @return [Gapic::Operation]
1750
+ #
1751
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1752
+ #
1753
+ def run_asset_discovery request, options = nil
1754
+ raise ArgumentError, "request must be provided" if request.nil?
1755
+
1756
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::RunAssetDiscoveryRequest
1757
+
1758
+ # Converts hash and nil to an options object
1759
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1760
+
1761
+ # Customize the options with defaults
1762
+ metadata = @config.rpcs.run_asset_discovery.metadata.to_h
1763
+
1764
+ # Set x-goog-api-client and x-goog-user-project headers
1765
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1766
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1767
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1768
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1769
+
1770
+ header_params = {
1771
+ "parent" => request.parent
1772
+ }
1773
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1774
+ metadata[:"x-goog-request-params"] ||= request_params_header
1775
+
1776
+ options.apply_defaults timeout: @config.rpcs.run_asset_discovery.timeout,
1777
+ metadata: metadata,
1778
+ retry_policy: @config.rpcs.run_asset_discovery.retry_policy
1779
+ options.apply_defaults metadata: @config.metadata,
1780
+ retry_policy: @config.retry_policy
1781
+
1782
+ @security_center_stub.call_rpc :run_asset_discovery, request, options: options do |response, operation|
1783
+ response = Gapic::Operation.new response, @operations_client, options: options
1784
+ yield response, operation if block_given?
1785
+ return response
1786
+ end
1787
+ rescue GRPC::BadStatus => e
1788
+ raise Google::Cloud::Error.from_error(e)
1789
+ end
1790
+
1791
+ ##
1792
+ # Updates the state of a finding.
1793
+ #
1794
+ # @overload set_finding_state(request, options = nil)
1795
+ # Pass arguments to `set_finding_state` via a request object, either of type
1796
+ # {Google::Cloud::SecurityCenter::V1p1beta1::SetFindingStateRequest} or an equivalent Hash.
1797
+ #
1798
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::SetFindingStateRequest, Hash]
1799
+ # A request object representing the call parameters. Required. To specify no
1800
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1801
+ # @param options [Gapic::CallOptions, Hash]
1802
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1803
+ #
1804
+ # @overload set_finding_state(name: nil, state: nil, start_time: nil)
1805
+ # Pass arguments to `set_finding_state` via keyword arguments. Note that at
1806
+ # least one keyword argument is required. To specify no parameters, or to keep all
1807
+ # the default parameter values, pass an empty Hash as a request object (see above).
1808
+ #
1809
+ # @param name [String]
1810
+ # Required. The relative resource name of the finding. See:
1811
+ # https://cloud.google.com/apis/design/resource_names#relative_resource_name
1812
+ # Example:
1813
+ # "organizations/\\{organization_id}/sources/\\{source_id}/finding/\\{finding_id}".
1814
+ # @param state [Google::Cloud::SecurityCenter::V1p1beta1::Finding::State]
1815
+ # Required. The desired State of the finding.
1816
+ # @param start_time [Google::Protobuf::Timestamp, Hash]
1817
+ # Required. The time at which the updated state takes effect.
1818
+ #
1819
+ # @yield [response, operation] Access the result along with the RPC operation
1820
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::Finding]
1821
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1822
+ #
1823
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::Finding]
1824
+ #
1825
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1826
+ #
1827
+ def set_finding_state request, options = nil
1828
+ raise ArgumentError, "request must be provided" if request.nil?
1829
+
1830
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::SetFindingStateRequest
1831
+
1832
+ # Converts hash and nil to an options object
1833
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1834
+
1835
+ # Customize the options with defaults
1836
+ metadata = @config.rpcs.set_finding_state.metadata.to_h
1837
+
1838
+ # Set x-goog-api-client and x-goog-user-project headers
1839
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1840
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1841
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1842
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1843
+
1844
+ header_params = {
1845
+ "name" => request.name
1846
+ }
1847
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1848
+ metadata[:"x-goog-request-params"] ||= request_params_header
1849
+
1850
+ options.apply_defaults timeout: @config.rpcs.set_finding_state.timeout,
1851
+ metadata: metadata,
1852
+ retry_policy: @config.rpcs.set_finding_state.retry_policy
1853
+ options.apply_defaults metadata: @config.metadata,
1854
+ retry_policy: @config.retry_policy
1855
+
1856
+ @security_center_stub.call_rpc :set_finding_state, request, options: options do |response, operation|
1857
+ yield response, operation if block_given?
1858
+ return response
1859
+ end
1860
+ rescue GRPC::BadStatus => e
1861
+ raise Google::Cloud::Error.from_error(e)
1862
+ end
1863
+
1864
+ ##
1865
+ # Sets the access control policy on the specified Source.
1866
+ #
1867
+ # @overload set_iam_policy(request, options = nil)
1868
+ # Pass arguments to `set_iam_policy` via a request object, either of type
1869
+ # {Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
1870
+ #
1871
+ # @param request [Google::Iam::V1::SetIamPolicyRequest, Hash]
1872
+ # A request object representing the call parameters. Required. To specify no
1873
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1874
+ # @param options [Gapic::CallOptions, Hash]
1875
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1876
+ #
1877
+ # @overload set_iam_policy(resource: nil, policy: nil)
1878
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
1879
+ # least one keyword argument is required. To specify no parameters, or to keep all
1880
+ # the default parameter values, pass an empty Hash as a request object (see above).
1881
+ #
1882
+ # @param resource [String]
1883
+ # REQUIRED: The resource for which the policy is being specified.
1884
+ # See the operation documentation for the appropriate value for this field.
1885
+ # @param policy [Google::Iam::V1::Policy, Hash]
1886
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
1887
+ # the policy is limited to a few 10s of KB. An empty policy is a
1888
+ # valid policy but certain Cloud Platform services (such as Projects)
1889
+ # might reject them.
1890
+ #
1891
+ # @yield [response, operation] Access the result along with the RPC operation
1892
+ # @yieldparam response [Google::Iam::V1::Policy]
1893
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1894
+ #
1895
+ # @return [Google::Iam::V1::Policy]
1896
+ #
1897
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1898
+ #
1899
+ def set_iam_policy request, options = nil
1900
+ raise ArgumentError, "request must be provided" if request.nil?
1901
+
1902
+ request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::SetIamPolicyRequest
1903
+
1904
+ # Converts hash and nil to an options object
1905
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1906
+
1907
+ # Customize the options with defaults
1908
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
1909
+
1910
+ # Set x-goog-api-client and x-goog-user-project headers
1911
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1912
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1913
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1914
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1915
+
1916
+ header_params = {
1917
+ "resource" => request.resource
1918
+ }
1919
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1920
+ metadata[:"x-goog-request-params"] ||= request_params_header
1921
+
1922
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
1923
+ metadata: metadata,
1924
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
1925
+ options.apply_defaults metadata: @config.metadata,
1926
+ retry_policy: @config.retry_policy
1927
+
1928
+ @security_center_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
1929
+ yield response, operation if block_given?
1930
+ return response
1931
+ end
1932
+ rescue GRPC::BadStatus => e
1933
+ raise Google::Cloud::Error.from_error(e)
1934
+ end
1935
+
1936
+ ##
1937
+ # Returns the permissions that a caller has on the specified source.
1938
+ #
1939
+ # @overload test_iam_permissions(request, options = nil)
1940
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
1941
+ # {Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
1942
+ #
1943
+ # @param request [Google::Iam::V1::TestIamPermissionsRequest, Hash]
1944
+ # A request object representing the call parameters. Required. To specify no
1945
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1946
+ # @param options [Gapic::CallOptions, Hash]
1947
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1948
+ #
1949
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
1950
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1951
+ # least one keyword argument is required. To specify no parameters, or to keep all
1952
+ # the default parameter values, pass an empty Hash as a request object (see above).
1953
+ #
1954
+ # @param resource [String]
1955
+ # REQUIRED: The resource for which the policy detail is being requested.
1956
+ # See the operation documentation for the appropriate value for this field.
1957
+ # @param permissions [Array<String>]
1958
+ # The set of permissions to check for the `resource`. Permissions with
1959
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1960
+ # information see
1961
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1962
+ #
1963
+ # @yield [response, operation] Access the result along with the RPC operation
1964
+ # @yieldparam response [Google::Iam::V1::TestIamPermissionsResponse]
1965
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1966
+ #
1967
+ # @return [Google::Iam::V1::TestIamPermissionsResponse]
1968
+ #
1969
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
1970
+ #
1971
+ def test_iam_permissions request, options = nil
1972
+ raise ArgumentError, "request must be provided" if request.nil?
1973
+
1974
+ request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::TestIamPermissionsRequest
1975
+
1976
+ # Converts hash and nil to an options object
1977
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1978
+
1979
+ # Customize the options with defaults
1980
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1981
+
1982
+ # Set x-goog-api-client and x-goog-user-project headers
1983
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
1984
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1985
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
1986
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1987
+
1988
+ header_params = {
1989
+ "resource" => request.resource
1990
+ }
1991
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1992
+ metadata[:"x-goog-request-params"] ||= request_params_header
1993
+
1994
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1995
+ metadata: metadata,
1996
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1997
+ options.apply_defaults metadata: @config.metadata,
1998
+ retry_policy: @config.retry_policy
1999
+
2000
+ @security_center_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
2001
+ yield response, operation if block_given?
2002
+ return response
2003
+ end
2004
+ rescue GRPC::BadStatus => e
2005
+ raise Google::Cloud::Error.from_error(e)
2006
+ end
2007
+
2008
+ ##
2009
+ # Creates or updates a finding. The corresponding source must exist for a
2010
+ # finding creation to succeed.
2011
+ #
2012
+ # @overload update_finding(request, options = nil)
2013
+ # Pass arguments to `update_finding` via a request object, either of type
2014
+ # {Google::Cloud::SecurityCenter::V1p1beta1::UpdateFindingRequest} or an equivalent Hash.
2015
+ #
2016
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::UpdateFindingRequest, Hash]
2017
+ # A request object representing the call parameters. Required. To specify no
2018
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2019
+ # @param options [Gapic::CallOptions, Hash]
2020
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2021
+ #
2022
+ # @overload update_finding(finding: nil, update_mask: nil)
2023
+ # Pass arguments to `update_finding` via keyword arguments. Note that at
2024
+ # least one keyword argument is required. To specify no parameters, or to keep all
2025
+ # the default parameter values, pass an empty Hash as a request object (see above).
2026
+ #
2027
+ # @param finding [Google::Cloud::SecurityCenter::V1p1beta1::Finding, Hash]
2028
+ # Required. The finding resource to update or create if it does not already
2029
+ # exist. parent, security_marks, and update_time will be ignored.
2030
+ #
2031
+ # In the case of creation, the finding id portion of the name must be
2032
+ # alphanumeric and less than or equal to 32 characters and greater than 0
2033
+ # characters in length.
2034
+ # @param update_mask [Google::Protobuf::FieldMask, Hash]
2035
+ # The FieldMask to use when updating the finding resource. This field should
2036
+ # not be specified when creating a finding.
2037
+ #
2038
+ # When updating a finding, an empty mask is treated as updating all mutable
2039
+ # fields and replacing source_properties. Individual source_properties can
2040
+ # be added/updated by using "source_properties.<property key>" in the field
2041
+ # mask.
2042
+ #
2043
+ # @yield [response, operation] Access the result along with the RPC operation
2044
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::Finding]
2045
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
2046
+ #
2047
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::Finding]
2048
+ #
2049
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
2050
+ #
2051
+ def update_finding request, options = nil
2052
+ raise ArgumentError, "request must be provided" if request.nil?
2053
+
2054
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::UpdateFindingRequest
2055
+
2056
+ # Converts hash and nil to an options object
2057
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2058
+
2059
+ # Customize the options with defaults
2060
+ metadata = @config.rpcs.update_finding.metadata.to_h
2061
+
2062
+ # Set x-goog-api-client and x-goog-user-project headers
2063
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
2064
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2065
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
2066
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2067
+
2068
+ header_params = {
2069
+ "finding.name" => request.finding.name
2070
+ }
2071
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2072
+ metadata[:"x-goog-request-params"] ||= request_params_header
2073
+
2074
+ options.apply_defaults timeout: @config.rpcs.update_finding.timeout,
2075
+ metadata: metadata,
2076
+ retry_policy: @config.rpcs.update_finding.retry_policy
2077
+ options.apply_defaults metadata: @config.metadata,
2078
+ retry_policy: @config.retry_policy
2079
+
2080
+ @security_center_stub.call_rpc :update_finding, request, options: options do |response, operation|
2081
+ yield response, operation if block_given?
2082
+ return response
2083
+ end
2084
+ rescue GRPC::BadStatus => e
2085
+ raise Google::Cloud::Error.from_error(e)
2086
+ end
2087
+
2088
+ ##
2089
+ # Updates a notification config.
2090
+ #
2091
+ # @overload update_notification_config(request, options = nil)
2092
+ # Pass arguments to `update_notification_config` via a request object, either of type
2093
+ # {Google::Cloud::SecurityCenter::V1p1beta1::UpdateNotificationConfigRequest} or an equivalent Hash.
2094
+ #
2095
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::UpdateNotificationConfigRequest, Hash]
2096
+ # A request object representing the call parameters. Required. To specify no
2097
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2098
+ # @param options [Gapic::CallOptions, Hash]
2099
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2100
+ #
2101
+ # @overload update_notification_config(notification_config: nil, update_mask: nil)
2102
+ # Pass arguments to `update_notification_config` via keyword arguments. Note that at
2103
+ # least one keyword argument is required. To specify no parameters, or to keep all
2104
+ # the default parameter values, pass an empty Hash as a request object (see above).
2105
+ #
2106
+ # @param notification_config [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig, Hash]
2107
+ # Required. The notification config to update.
2108
+ # @param update_mask [Google::Protobuf::FieldMask, Hash]
2109
+ # The FieldMask to use when updating the notification config.
2110
+ #
2111
+ # If empty all mutable fields will be updated.
2112
+ #
2113
+ # @yield [response, operation] Access the result along with the RPC operation
2114
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig]
2115
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
2116
+ #
2117
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::NotificationConfig]
2118
+ #
2119
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
2120
+ #
2121
+ def update_notification_config request, options = nil
2122
+ raise ArgumentError, "request must be provided" if request.nil?
2123
+
2124
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::UpdateNotificationConfigRequest
2125
+
2126
+ # Converts hash and nil to an options object
2127
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2128
+
2129
+ # Customize the options with defaults
2130
+ metadata = @config.rpcs.update_notification_config.metadata.to_h
2131
+
2132
+ # Set x-goog-api-client and x-goog-user-project headers
2133
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
2134
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2135
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
2136
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2137
+
2138
+ header_params = {
2139
+ "notification_config.name" => request.notification_config.name
2140
+ }
2141
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2142
+ metadata[:"x-goog-request-params"] ||= request_params_header
2143
+
2144
+ options.apply_defaults timeout: @config.rpcs.update_notification_config.timeout,
2145
+ metadata: metadata,
2146
+ retry_policy: @config.rpcs.update_notification_config.retry_policy
2147
+ options.apply_defaults metadata: @config.metadata,
2148
+ retry_policy: @config.retry_policy
2149
+
2150
+ @security_center_stub.call_rpc :update_notification_config, request, options: options do |response, operation|
2151
+ yield response, operation if block_given?
2152
+ return response
2153
+ end
2154
+ rescue GRPC::BadStatus => e
2155
+ raise Google::Cloud::Error.from_error(e)
2156
+ end
2157
+
2158
+ ##
2159
+ # Updates an organization's settings.
2160
+ #
2161
+ # @overload update_organization_settings(request, options = nil)
2162
+ # Pass arguments to `update_organization_settings` via a request object, either of type
2163
+ # {Google::Cloud::SecurityCenter::V1p1beta1::UpdateOrganizationSettingsRequest} or an equivalent Hash.
2164
+ #
2165
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::UpdateOrganizationSettingsRequest, Hash]
2166
+ # A request object representing the call parameters. Required. To specify no
2167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2168
+ # @param options [Gapic::CallOptions, Hash]
2169
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2170
+ #
2171
+ # @overload update_organization_settings(organization_settings: nil, update_mask: nil)
2172
+ # Pass arguments to `update_organization_settings` via keyword arguments. Note that at
2173
+ # least one keyword argument is required. To specify no parameters, or to keep all
2174
+ # the default parameter values, pass an empty Hash as a request object (see above).
2175
+ #
2176
+ # @param organization_settings [Google::Cloud::SecurityCenter::V1p1beta1::OrganizationSettings, Hash]
2177
+ # Required. The organization settings resource to update.
2178
+ # @param update_mask [Google::Protobuf::FieldMask, Hash]
2179
+ # The FieldMask to use when updating the settings resource.
2180
+ #
2181
+ # If empty all mutable fields will be updated.
2182
+ #
2183
+ # @yield [response, operation] Access the result along with the RPC operation
2184
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::OrganizationSettings]
2185
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
2186
+ #
2187
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::OrganizationSettings]
2188
+ #
2189
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
2190
+ #
2191
+ def update_organization_settings request, options = nil
2192
+ raise ArgumentError, "request must be provided" if request.nil?
2193
+
2194
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::UpdateOrganizationSettingsRequest
2195
+
2196
+ # Converts hash and nil to an options object
2197
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2198
+
2199
+ # Customize the options with defaults
2200
+ metadata = @config.rpcs.update_organization_settings.metadata.to_h
2201
+
2202
+ # Set x-goog-api-client and x-goog-user-project headers
2203
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
2204
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2205
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
2206
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2207
+
2208
+ header_params = {
2209
+ "organization_settings.name" => request.organization_settings.name
2210
+ }
2211
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2212
+ metadata[:"x-goog-request-params"] ||= request_params_header
2213
+
2214
+ options.apply_defaults timeout: @config.rpcs.update_organization_settings.timeout,
2215
+ metadata: metadata,
2216
+ retry_policy: @config.rpcs.update_organization_settings.retry_policy
2217
+ options.apply_defaults metadata: @config.metadata,
2218
+ retry_policy: @config.retry_policy
2219
+
2220
+ @security_center_stub.call_rpc :update_organization_settings, request, options: options do |response, operation|
2221
+ yield response, operation if block_given?
2222
+ return response
2223
+ end
2224
+ rescue GRPC::BadStatus => e
2225
+ raise Google::Cloud::Error.from_error(e)
2226
+ end
2227
+
2228
+ ##
2229
+ # Updates a source.
2230
+ #
2231
+ # @overload update_source(request, options = nil)
2232
+ # Pass arguments to `update_source` via a request object, either of type
2233
+ # {Google::Cloud::SecurityCenter::V1p1beta1::UpdateSourceRequest} or an equivalent Hash.
2234
+ #
2235
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::UpdateSourceRequest, Hash]
2236
+ # A request object representing the call parameters. Required. To specify no
2237
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2238
+ # @param options [Gapic::CallOptions, Hash]
2239
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2240
+ #
2241
+ # @overload update_source(source: nil, update_mask: nil)
2242
+ # Pass arguments to `update_source` via keyword arguments. Note that at
2243
+ # least one keyword argument is required. To specify no parameters, or to keep all
2244
+ # the default parameter values, pass an empty Hash as a request object (see above).
2245
+ #
2246
+ # @param source [Google::Cloud::SecurityCenter::V1p1beta1::Source, Hash]
2247
+ # Required. The source resource to update.
2248
+ # @param update_mask [Google::Protobuf::FieldMask, Hash]
2249
+ # The FieldMask to use when updating the source resource.
2250
+ #
2251
+ # If empty all mutable fields will be updated.
2252
+ #
2253
+ # @yield [response, operation] Access the result along with the RPC operation
2254
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::Source]
2255
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
2256
+ #
2257
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::Source]
2258
+ #
2259
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
2260
+ #
2261
+ def update_source request, options = nil
2262
+ raise ArgumentError, "request must be provided" if request.nil?
2263
+
2264
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::UpdateSourceRequest
2265
+
2266
+ # Converts hash and nil to an options object
2267
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2268
+
2269
+ # Customize the options with defaults
2270
+ metadata = @config.rpcs.update_source.metadata.to_h
2271
+
2272
+ # Set x-goog-api-client and x-goog-user-project headers
2273
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
2274
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2275
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
2276
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2277
+
2278
+ header_params = {
2279
+ "source.name" => request.source.name
2280
+ }
2281
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2282
+ metadata[:"x-goog-request-params"] ||= request_params_header
2283
+
2284
+ options.apply_defaults timeout: @config.rpcs.update_source.timeout,
2285
+ metadata: metadata,
2286
+ retry_policy: @config.rpcs.update_source.retry_policy
2287
+ options.apply_defaults metadata: @config.metadata,
2288
+ retry_policy: @config.retry_policy
2289
+
2290
+ @security_center_stub.call_rpc :update_source, request, options: options do |response, operation|
2291
+ yield response, operation if block_given?
2292
+ return response
2293
+ end
2294
+ rescue GRPC::BadStatus => e
2295
+ raise Google::Cloud::Error.from_error(e)
2296
+ end
2297
+
2298
+ ##
2299
+ # Updates security marks.
2300
+ #
2301
+ # @overload update_security_marks(request, options = nil)
2302
+ # Pass arguments to `update_security_marks` via a request object, either of type
2303
+ # {Google::Cloud::SecurityCenter::V1p1beta1::UpdateSecurityMarksRequest} or an equivalent Hash.
2304
+ #
2305
+ # @param request [Google::Cloud::SecurityCenter::V1p1beta1::UpdateSecurityMarksRequest, Hash]
2306
+ # A request object representing the call parameters. Required. To specify no
2307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2308
+ # @param options [Gapic::CallOptions, Hash]
2309
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2310
+ #
2311
+ # @overload update_security_marks(security_marks: nil, update_mask: nil, start_time: nil)
2312
+ # Pass arguments to `update_security_marks` via keyword arguments. Note that at
2313
+ # least one keyword argument is required. To specify no parameters, or to keep all
2314
+ # the default parameter values, pass an empty Hash as a request object (see above).
2315
+ #
2316
+ # @param security_marks [Google::Cloud::SecurityCenter::V1p1beta1::SecurityMarks, Hash]
2317
+ # Required. The security marks resource to update.
2318
+ # @param update_mask [Google::Protobuf::FieldMask, Hash]
2319
+ # The FieldMask to use when updating the security marks resource.
2320
+ #
2321
+ # The field mask must not contain duplicate fields.
2322
+ # If empty or set to "marks", all marks will be replaced. Individual
2323
+ # marks can be updated using "marks.<mark_key>".
2324
+ # @param start_time [Google::Protobuf::Timestamp, Hash]
2325
+ # The time at which the updated SecurityMarks take effect.
2326
+ # If not set uses current server time. Updates will be applied to the
2327
+ # SecurityMarks that are active immediately preceding this time.
2328
+ #
2329
+ # @yield [response, operation] Access the result along with the RPC operation
2330
+ # @yieldparam response [Google::Cloud::SecurityCenter::V1p1beta1::SecurityMarks]
2331
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
2332
+ #
2333
+ # @return [Google::Cloud::SecurityCenter::V1p1beta1::SecurityMarks]
2334
+ #
2335
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
2336
+ #
2337
+ def update_security_marks request, options = nil
2338
+ raise ArgumentError, "request must be provided" if request.nil?
2339
+
2340
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1p1beta1::UpdateSecurityMarksRequest
2341
+
2342
+ # Converts hash and nil to an options object
2343
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2344
+
2345
+ # Customize the options with defaults
2346
+ metadata = @config.rpcs.update_security_marks.metadata.to_h
2347
+
2348
+ # Set x-goog-api-client and x-goog-user-project headers
2349
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
2350
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2351
+ gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
2352
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2353
+
2354
+ header_params = {
2355
+ "security_marks.name" => request.security_marks.name
2356
+ }
2357
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2358
+ metadata[:"x-goog-request-params"] ||= request_params_header
2359
+
2360
+ options.apply_defaults timeout: @config.rpcs.update_security_marks.timeout,
2361
+ metadata: metadata,
2362
+ retry_policy: @config.rpcs.update_security_marks.retry_policy
2363
+ options.apply_defaults metadata: @config.metadata,
2364
+ retry_policy: @config.retry_policy
2365
+
2366
+ @security_center_stub.call_rpc :update_security_marks, request, options: options do |response, operation|
2367
+ yield response, operation if block_given?
2368
+ return response
2369
+ end
2370
+ rescue GRPC::BadStatus => e
2371
+ raise Google::Cloud::Error.from_error(e)
2372
+ end
2373
+
2374
+ ##
2375
+ # Configuration class for the SecurityCenter API.
2376
+ #
2377
+ # This class represents the configuration for SecurityCenter,
2378
+ # providing control over timeouts, retry behavior, logging, transport
2379
+ # parameters, and other low-level controls. Certain parameters can also be
2380
+ # applied individually to specific RPCs. See
2381
+ # {Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client::Configuration::Rpcs}
2382
+ # for a list of RPCs that can be configured independently.
2383
+ #
2384
+ # Configuration can be applied globally to all clients, or to a single client
2385
+ # on construction.
2386
+ #
2387
+ # # Examples
2388
+ #
2389
+ # To modify the global config, setting the timeout for create_source
2390
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
2391
+ #
2392
+ # Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.configure do |config|
2393
+ # config.timeout = 10_000
2394
+ # config.rpcs.create_source.timeout = 20_000
2395
+ # end
2396
+ #
2397
+ # To apply the above configuration only to a new client:
2398
+ #
2399
+ # client = Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client.new do |config|
2400
+ # config.timeout = 10_000
2401
+ # config.rpcs.create_source.timeout = 20_000
2402
+ # end
2403
+ #
2404
+ # @!attribute [rw] endpoint
2405
+ # The hostname or hostname:port of the service endpoint.
2406
+ # Defaults to `"securitycenter.googleapis.com"`.
2407
+ # @return [String]
2408
+ # @!attribute [rw] credentials
2409
+ # Credentials to send with calls. You may provide any of the following types:
2410
+ # * (`String`) The path to a service account key file in JSON format
2411
+ # * (`Hash`) A service account key as a Hash
2412
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
2413
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
2414
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2415
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
2416
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2417
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2418
+ # * (`nil`) indicating no credentials
2419
+ # @return [Object]
2420
+ # @!attribute [rw] scope
2421
+ # The OAuth scopes
2422
+ # @return [Array<String>]
2423
+ # @!attribute [rw] lib_name
2424
+ # The library name as recorded in instrumentation and logging
2425
+ # @return [String]
2426
+ # @!attribute [rw] lib_version
2427
+ # The library version as recorded in instrumentation and logging
2428
+ # @return [String]
2429
+ # @!attribute [rw] channel_args
2430
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
2431
+ # `GRPC::Core::Channel` object is provided as the credential.
2432
+ # @return [Hash]
2433
+ # @!attribute [rw] interceptors
2434
+ # An array of interceptors that are run before calls are executed.
2435
+ # @return [Array<GRPC::ClientInterceptor>]
2436
+ # @!attribute [rw] timeout
2437
+ # The call timeout in milliseconds.
2438
+ # @return [Numeric]
2439
+ # @!attribute [rw] metadata
2440
+ # Additional gRPC headers to be sent with the call.
2441
+ # @return [Hash{Symbol=>String}]
2442
+ # @!attribute [rw] retry_policy
2443
+ # The retry policy. The value is a hash with the following keys:
2444
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2445
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2446
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2447
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2448
+ # trigger a retry.
2449
+ # @return [Hash]
2450
+ #
2451
+ class Configuration
2452
+ extend Gapic::Config
2453
+
2454
+ config_attr :endpoint, "securitycenter.googleapis.com", String
2455
+ config_attr :credentials, nil do |value|
2456
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2457
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
2458
+ allowed.any? { |klass| klass === value }
2459
+ end
2460
+ config_attr :scope, nil, String, Array, nil
2461
+ config_attr :lib_name, nil, String, nil
2462
+ config_attr :lib_version, nil, String, nil
2463
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
2464
+ config_attr :interceptors, nil, Array, nil
2465
+ config_attr :timeout, nil, Numeric, nil
2466
+ config_attr :metadata, nil, Hash, nil
2467
+ config_attr :retry_policy, nil, Hash, Proc, nil
2468
+
2469
+ # @private
2470
+ def initialize parent_config = nil
2471
+ @parent_config = parent_config unless parent_config.nil?
2472
+
2473
+ yield self if block_given?
2474
+ end
2475
+
2476
+ ##
2477
+ # Configurations for individual RPCs
2478
+ # @return [Rpcs]
2479
+ #
2480
+ def rpcs
2481
+ @rpcs ||= begin
2482
+ parent_rpcs = nil
2483
+ parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
2484
+ Rpcs.new parent_rpcs
2485
+ end
2486
+ end
2487
+
2488
+ ##
2489
+ # Configuration RPC class for the SecurityCenter API.
2490
+ #
2491
+ # Includes fields providing the configuration for each RPC in this service.
2492
+ # Each configuration object is of type `Gapic::Config::Method` and includes
2493
+ # the following configuration fields:
2494
+ #
2495
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2496
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2497
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2498
+ # include the following keys:
2499
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2500
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2501
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2502
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2503
+ # trigger a retry.
2504
+ #
2505
+ class Rpcs
2506
+ ##
2507
+ # RPC-specific configuration for `create_source`
2508
+ # @return [Gapic::Config::Method]
2509
+ #
2510
+ attr_reader :create_source
2511
+ ##
2512
+ # RPC-specific configuration for `create_finding`
2513
+ # @return [Gapic::Config::Method]
2514
+ #
2515
+ attr_reader :create_finding
2516
+ ##
2517
+ # RPC-specific configuration for `create_notification_config`
2518
+ # @return [Gapic::Config::Method]
2519
+ #
2520
+ attr_reader :create_notification_config
2521
+ ##
2522
+ # RPC-specific configuration for `delete_notification_config`
2523
+ # @return [Gapic::Config::Method]
2524
+ #
2525
+ attr_reader :delete_notification_config
2526
+ ##
2527
+ # RPC-specific configuration for `get_iam_policy`
2528
+ # @return [Gapic::Config::Method]
2529
+ #
2530
+ attr_reader :get_iam_policy
2531
+ ##
2532
+ # RPC-specific configuration for `get_notification_config`
2533
+ # @return [Gapic::Config::Method]
2534
+ #
2535
+ attr_reader :get_notification_config
2536
+ ##
2537
+ # RPC-specific configuration for `get_organization_settings`
2538
+ # @return [Gapic::Config::Method]
2539
+ #
2540
+ attr_reader :get_organization_settings
2541
+ ##
2542
+ # RPC-specific configuration for `get_source`
2543
+ # @return [Gapic::Config::Method]
2544
+ #
2545
+ attr_reader :get_source
2546
+ ##
2547
+ # RPC-specific configuration for `group_assets`
2548
+ # @return [Gapic::Config::Method]
2549
+ #
2550
+ attr_reader :group_assets
2551
+ ##
2552
+ # RPC-specific configuration for `group_findings`
2553
+ # @return [Gapic::Config::Method]
2554
+ #
2555
+ attr_reader :group_findings
2556
+ ##
2557
+ # RPC-specific configuration for `list_assets`
2558
+ # @return [Gapic::Config::Method]
2559
+ #
2560
+ attr_reader :list_assets
2561
+ ##
2562
+ # RPC-specific configuration for `list_findings`
2563
+ # @return [Gapic::Config::Method]
2564
+ #
2565
+ attr_reader :list_findings
2566
+ ##
2567
+ # RPC-specific configuration for `list_notification_configs`
2568
+ # @return [Gapic::Config::Method]
2569
+ #
2570
+ attr_reader :list_notification_configs
2571
+ ##
2572
+ # RPC-specific configuration for `list_sources`
2573
+ # @return [Gapic::Config::Method]
2574
+ #
2575
+ attr_reader :list_sources
2576
+ ##
2577
+ # RPC-specific configuration for `run_asset_discovery`
2578
+ # @return [Gapic::Config::Method]
2579
+ #
2580
+ attr_reader :run_asset_discovery
2581
+ ##
2582
+ # RPC-specific configuration for `set_finding_state`
2583
+ # @return [Gapic::Config::Method]
2584
+ #
2585
+ attr_reader :set_finding_state
2586
+ ##
2587
+ # RPC-specific configuration for `set_iam_policy`
2588
+ # @return [Gapic::Config::Method]
2589
+ #
2590
+ attr_reader :set_iam_policy
2591
+ ##
2592
+ # RPC-specific configuration for `test_iam_permissions`
2593
+ # @return [Gapic::Config::Method]
2594
+ #
2595
+ attr_reader :test_iam_permissions
2596
+ ##
2597
+ # RPC-specific configuration for `update_finding`
2598
+ # @return [Gapic::Config::Method]
2599
+ #
2600
+ attr_reader :update_finding
2601
+ ##
2602
+ # RPC-specific configuration for `update_notification_config`
2603
+ # @return [Gapic::Config::Method]
2604
+ #
2605
+ attr_reader :update_notification_config
2606
+ ##
2607
+ # RPC-specific configuration for `update_organization_settings`
2608
+ # @return [Gapic::Config::Method]
2609
+ #
2610
+ attr_reader :update_organization_settings
2611
+ ##
2612
+ # RPC-specific configuration for `update_source`
2613
+ # @return [Gapic::Config::Method]
2614
+ #
2615
+ attr_reader :update_source
2616
+ ##
2617
+ # RPC-specific configuration for `update_security_marks`
2618
+ # @return [Gapic::Config::Method]
2619
+ #
2620
+ attr_reader :update_security_marks
2621
+
2622
+ # @private
2623
+ def initialize parent_rpcs = nil
2624
+ create_source_config = parent_rpcs&.create_source if parent_rpcs&.respond_to? :create_source
2625
+ @create_source = Gapic::Config::Method.new create_source_config
2626
+ create_finding_config = parent_rpcs&.create_finding if parent_rpcs&.respond_to? :create_finding
2627
+ @create_finding = Gapic::Config::Method.new create_finding_config
2628
+ create_notification_config_config = parent_rpcs&.create_notification_config if parent_rpcs&.respond_to? :create_notification_config
2629
+ @create_notification_config = Gapic::Config::Method.new create_notification_config_config
2630
+ delete_notification_config_config = parent_rpcs&.delete_notification_config if parent_rpcs&.respond_to? :delete_notification_config
2631
+ @delete_notification_config = Gapic::Config::Method.new delete_notification_config_config
2632
+ get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
2633
+ @get_iam_policy = Gapic::Config::Method.new get_iam_policy_config
2634
+ get_notification_config_config = parent_rpcs&.get_notification_config if parent_rpcs&.respond_to? :get_notification_config
2635
+ @get_notification_config = Gapic::Config::Method.new get_notification_config_config
2636
+ get_organization_settings_config = parent_rpcs&.get_organization_settings if parent_rpcs&.respond_to? :get_organization_settings
2637
+ @get_organization_settings = Gapic::Config::Method.new get_organization_settings_config
2638
+ get_source_config = parent_rpcs&.get_source if parent_rpcs&.respond_to? :get_source
2639
+ @get_source = Gapic::Config::Method.new get_source_config
2640
+ group_assets_config = parent_rpcs&.group_assets if parent_rpcs&.respond_to? :group_assets
2641
+ @group_assets = Gapic::Config::Method.new group_assets_config
2642
+ group_findings_config = parent_rpcs&.group_findings if parent_rpcs&.respond_to? :group_findings
2643
+ @group_findings = Gapic::Config::Method.new group_findings_config
2644
+ list_assets_config = parent_rpcs&.list_assets if parent_rpcs&.respond_to? :list_assets
2645
+ @list_assets = Gapic::Config::Method.new list_assets_config
2646
+ list_findings_config = parent_rpcs&.list_findings if parent_rpcs&.respond_to? :list_findings
2647
+ @list_findings = Gapic::Config::Method.new list_findings_config
2648
+ list_notification_configs_config = parent_rpcs&.list_notification_configs if parent_rpcs&.respond_to? :list_notification_configs
2649
+ @list_notification_configs = Gapic::Config::Method.new list_notification_configs_config
2650
+ list_sources_config = parent_rpcs&.list_sources if parent_rpcs&.respond_to? :list_sources
2651
+ @list_sources = Gapic::Config::Method.new list_sources_config
2652
+ run_asset_discovery_config = parent_rpcs&.run_asset_discovery if parent_rpcs&.respond_to? :run_asset_discovery
2653
+ @run_asset_discovery = Gapic::Config::Method.new run_asset_discovery_config
2654
+ set_finding_state_config = parent_rpcs&.set_finding_state if parent_rpcs&.respond_to? :set_finding_state
2655
+ @set_finding_state = Gapic::Config::Method.new set_finding_state_config
2656
+ set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
2657
+ @set_iam_policy = Gapic::Config::Method.new set_iam_policy_config
2658
+ test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
2659
+ @test_iam_permissions = Gapic::Config::Method.new test_iam_permissions_config
2660
+ update_finding_config = parent_rpcs&.update_finding if parent_rpcs&.respond_to? :update_finding
2661
+ @update_finding = Gapic::Config::Method.new update_finding_config
2662
+ update_notification_config_config = parent_rpcs&.update_notification_config if parent_rpcs&.respond_to? :update_notification_config
2663
+ @update_notification_config = Gapic::Config::Method.new update_notification_config_config
2664
+ update_organization_settings_config = parent_rpcs&.update_organization_settings if parent_rpcs&.respond_to? :update_organization_settings
2665
+ @update_organization_settings = Gapic::Config::Method.new update_organization_settings_config
2666
+ update_source_config = parent_rpcs&.update_source if parent_rpcs&.respond_to? :update_source
2667
+ @update_source = Gapic::Config::Method.new update_source_config
2668
+ update_security_marks_config = parent_rpcs&.update_security_marks if parent_rpcs&.respond_to? :update_security_marks
2669
+ @update_security_marks = Gapic::Config::Method.new update_security_marks_config
2670
+
2671
+ yield self if block_given?
2672
+ end
2673
+ end
2674
+ end
2675
+ end
2676
+ end
2677
+ end
2678
+ end
2679
+ end
2680
+ end