google-cloud-security_center-v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/security_center/v1/security_center/client.rb +2673 -0
- data/lib/google/cloud/security_center/v1/security_center/credentials.rb +51 -0
- data/lib/google/cloud/security_center/v1/security_center/operations.rb +564 -0
- data/lib/google/cloud/security_center/v1/security_center/paths.rb +172 -0
- data/lib/google/cloud/security_center/v1/security_center.rb +50 -0
- data/lib/google/cloud/security_center/v1/version.rb +28 -0
- data/lib/google/cloud/security_center/v1.rb +35 -0
- data/lib/google/cloud/securitycenter/v1/asset_pb.rb +48 -0
- data/lib/google/cloud/securitycenter/v1/finding_pb.rb +43 -0
- data/lib/google/cloud/securitycenter/v1/notification_config_pb.rb +35 -0
- data/lib/google/cloud/securitycenter/v1/notification_message_pb.rb +27 -0
- data/lib/google/cloud/securitycenter/v1/organization_settings_pb.rb +37 -0
- data/lib/google/cloud/securitycenter/v1/run_asset_discovery_response_pb.rb +32 -0
- data/lib/google/cloud/securitycenter/v1/security_marks_pb.rb +25 -0
- data/lib/google/cloud/securitycenter/v1/securitycenter_service_pb.rb +237 -0
- data/lib/google/cloud/securitycenter/v1/securitycenter_service_services_pb.rb +105 -0
- data/lib/google/cloud/securitycenter/v1/source_pb.rb +26 -0
- data/lib/google-cloud-security_center-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/securitycenter/v1/asset.rb +127 -0
- data/proto_docs/google/cloud/securitycenter/v1/finding.rb +113 -0
- data/proto_docs/google/cloud/securitycenter/v1/notification_config.rb +85 -0
- data/proto_docs/google/cloud/securitycenter/v1/notification_message.rb +39 -0
- data/proto_docs/google/cloud/securitycenter/v1/organization_settings.rb +82 -0
- data/proto_docs/google/cloud/securitycenter/v1/run_asset_discovery_response.rb +54 -0
- data/proto_docs/google/cloud/securitycenter/v1/security_marks.rb +61 -0
- data/proto_docs/google/cloud/securitycenter/v1/securitycenter_service.rb +1015 -0
- data/proto_docs/google/cloud/securitycenter/v1/source.rb +57 -0
- data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
- data/proto_docs/google/iam/v1/options.rb +40 -0
- data/proto_docs/google/iam/v1/policy.rb +248 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/expr.rb +52 -0
- metadata +222 -0
@@ -0,0 +1,2673 @@
|
|
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/v1/securitycenter_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module SecurityCenter
|
25
|
+
module V1
|
26
|
+
module SecurityCenter
|
27
|
+
##
|
28
|
+
# Client for the SecurityCenter service.
|
29
|
+
#
|
30
|
+
# V1 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::V1::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::V1::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", "V1"]
|
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::V1::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::V1::SecurityCenter::Client.new
|
215
|
+
#
|
216
|
+
# To create a new SecurityCenter client with a custom
|
217
|
+
# configuration:
|
218
|
+
#
|
219
|
+
# client = Google::Cloud::SecurityCenter::V1::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/v1/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::V1::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::V1::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::V1::CreateSourceRequest} or an equivalent Hash.
|
276
|
+
#
|
277
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::Source]
|
297
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
298
|
+
#
|
299
|
+
# @return [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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 creation
|
342
|
+
# 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::V1::CreateFindingRequest} or an equivalent Hash.
|
347
|
+
#
|
348
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::Finding]
|
372
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
373
|
+
#
|
374
|
+
# @return [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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::V1::CreateNotificationConfigRequest} or an equivalent Hash.
|
421
|
+
#
|
422
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::NotificationConfig]
|
448
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
449
|
+
#
|
450
|
+
# @return [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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::V1::DeleteNotificationConfigRequest} or an equivalent Hash.
|
497
|
+
#
|
498
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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::V1::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::V1::GetNotificationConfigRequest} or an equivalent Hash.
|
634
|
+
#
|
635
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::NotificationConfig]
|
652
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
653
|
+
#
|
654
|
+
# @return [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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::V1::GetOrganizationSettingsRequest} or an equivalent Hash.
|
701
|
+
#
|
702
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::OrganizationSettings]
|
719
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
720
|
+
#
|
721
|
+
# @return [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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::V1::GetSourceRequest} or an equivalent Hash.
|
768
|
+
#
|
769
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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::V1::Source]
|
786
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
787
|
+
#
|
788
|
+
# @return [Google::Cloud::SecurityCenter::V1::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::V1::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::V1::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::V1::GroupAssetsRequest} or an equivalent Hash.
|
836
|
+
#
|
837
|
+
# @param request [Google::Cloud::SecurityCenter::V1::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, 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_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 page_token [String]
|
961
|
+
# The value returned by the last `GroupAssetsResponse`; indicates
|
962
|
+
# that this is a continuation of a prior `GroupAssets` call, and that the
|
963
|
+
# system should return the next page of data.
|
964
|
+
# @param page_size [Integer]
|
965
|
+
# The maximum number of results to return in a single response. Default is
|
966
|
+
# 10, minimum is 1, maximum is 1000.
|
967
|
+
#
|
968
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
969
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
|
970
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
971
|
+
#
|
972
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
|
973
|
+
#
|
974
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
975
|
+
#
|
976
|
+
def group_assets request, options = nil
|
977
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
978
|
+
|
979
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::GroupAssetsRequest
|
980
|
+
|
981
|
+
# Converts hash and nil to an options object
|
982
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
983
|
+
|
984
|
+
# Customize the options with defaults
|
985
|
+
metadata = @config.rpcs.group_assets.metadata.to_h
|
986
|
+
|
987
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
988
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
989
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
990
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
991
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
992
|
+
|
993
|
+
header_params = {
|
994
|
+
"parent" => request.parent
|
995
|
+
}
|
996
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
997
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
998
|
+
|
999
|
+
options.apply_defaults timeout: @config.rpcs.group_assets.timeout,
|
1000
|
+
metadata: metadata,
|
1001
|
+
retry_policy: @config.rpcs.group_assets.retry_policy
|
1002
|
+
options.apply_defaults metadata: @config.metadata,
|
1003
|
+
retry_policy: @config.retry_policy
|
1004
|
+
|
1005
|
+
@security_center_stub.call_rpc :group_assets, request, options: options do |response, operation|
|
1006
|
+
response = Gapic::PagedEnumerable.new @security_center_stub, :group_assets, request, response, operation, options
|
1007
|
+
yield response, operation if block_given?
|
1008
|
+
return response
|
1009
|
+
end
|
1010
|
+
rescue GRPC::BadStatus => e
|
1011
|
+
raise Google::Cloud::Error.from_error(e)
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
##
|
1015
|
+
# Filters an organization or source's findings and groups them by their
|
1016
|
+
# specified properties.
|
1017
|
+
#
|
1018
|
+
# To group across all sources provide a `-` as the source id.
|
1019
|
+
# Example: /v1/organizations/\\{organization_id}/sources/-/findings
|
1020
|
+
#
|
1021
|
+
# @overload group_findings(request, options = nil)
|
1022
|
+
# Pass arguments to `group_findings` via a request object, either of type
|
1023
|
+
# {Google::Cloud::SecurityCenter::V1::GroupFindingsRequest} or an equivalent Hash.
|
1024
|
+
#
|
1025
|
+
# @param request [Google::Cloud::SecurityCenter::V1::GroupFindingsRequest, Hash]
|
1026
|
+
# A request object representing the call parameters. Required. To specify no
|
1027
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1028
|
+
# @param options [Gapic::CallOptions, Hash]
|
1029
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1030
|
+
#
|
1031
|
+
# @overload group_findings(parent: nil, filter: nil, group_by: nil, read_time: nil, compare_duration: nil, page_token: nil, page_size: nil)
|
1032
|
+
# Pass arguments to `group_findings` via keyword arguments. Note that at
|
1033
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1034
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1035
|
+
#
|
1036
|
+
# @param parent [String]
|
1037
|
+
# Required. Name of the source to groupBy. Its format is
|
1038
|
+
# "organizations/[organization_id]/sources/[source_id]". To groupBy across
|
1039
|
+
# all sources provide a source_id of `-`. For example:
|
1040
|
+
# organizations/\\{organization_id}/sources/-
|
1041
|
+
# @param filter [String]
|
1042
|
+
# Expression that defines the filter to apply across findings.
|
1043
|
+
# The expression is a list of one or more restrictions combined via logical
|
1044
|
+
# operators `AND` and `OR`.
|
1045
|
+
# Parentheses are supported, and `OR` has higher precedence than `AND`.
|
1046
|
+
#
|
1047
|
+
# Restrictions have the form `<field> <operator> <value>` and may have a `-`
|
1048
|
+
# character in front of them to indicate negation. Examples include:
|
1049
|
+
#
|
1050
|
+
# * name
|
1051
|
+
# * source_properties.a_property
|
1052
|
+
# * security_marks.marks.marka
|
1053
|
+
#
|
1054
|
+
# The supported operators are:
|
1055
|
+
#
|
1056
|
+
# * `=` for all value types.
|
1057
|
+
# * `>`, `<`, `>=`, `<=` for integer values.
|
1058
|
+
# * `:`, meaning substring matching, for strings.
|
1059
|
+
#
|
1060
|
+
# The supported value types are:
|
1061
|
+
#
|
1062
|
+
# * string literals in quotes.
|
1063
|
+
# * integer literals without quotes.
|
1064
|
+
# * boolean literals `true` and `false` without quotes.
|
1065
|
+
#
|
1066
|
+
# The following field and operator combinations are supported:
|
1067
|
+
#
|
1068
|
+
# * name: `=`
|
1069
|
+
# * parent: `=`, `:`
|
1070
|
+
# * resource_name: `=`, `:`
|
1071
|
+
# * state: `=`, `:`
|
1072
|
+
# * category: `=`, `:`
|
1073
|
+
# * external_uri: `=`, `:`
|
1074
|
+
# * event_time: `=`, `>`, `<`, `>=`, `<=`
|
1075
|
+
#
|
1076
|
+
# Usage: This should be milliseconds since epoch or an RFC3339 string.
|
1077
|
+
# Examples:
|
1078
|
+
# "event_time = \"2019-06-10T16:07:18-07:00\""
|
1079
|
+
# "event_time = 1560208038000"
|
1080
|
+
#
|
1081
|
+
# * security_marks.marks: `=`, `:`
|
1082
|
+
# * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
|
1083
|
+
#
|
1084
|
+
# For example, `source_properties.size = 100` is a valid filter string.
|
1085
|
+
# @param group_by [String]
|
1086
|
+
# Required. Expression that defines what assets fields to use for grouping
|
1087
|
+
# (including `state_change`). The string value should follow SQL syntax:
|
1088
|
+
# comma separated list of fields. For example: "parent,resource_name".
|
1089
|
+
#
|
1090
|
+
# The following fields are supported:
|
1091
|
+
#
|
1092
|
+
# * resource_name
|
1093
|
+
# * category
|
1094
|
+
# * state
|
1095
|
+
# * parent
|
1096
|
+
#
|
1097
|
+
# The following fields are supported when compare_duration is set:
|
1098
|
+
#
|
1099
|
+
# * state_change
|
1100
|
+
# @param read_time [Google::Protobuf::Timestamp, Hash]
|
1101
|
+
# Time used as a reference point when filtering findings. The filter is
|
1102
|
+
# limited to findings existing at the supplied time and their values are
|
1103
|
+
# those at that specific time. Absence of this field will default to the
|
1104
|
+
# API's version of NOW.
|
1105
|
+
# @param compare_duration [Google::Protobuf::Duration, Hash]
|
1106
|
+
# When compare_duration is set, the GroupResult's "state_change" attribute is
|
1107
|
+
# updated to indicate whether the finding had its state changed, the
|
1108
|
+
# finding's state remained unchanged, or if the finding was added during the
|
1109
|
+
# compare_duration period of time that precedes the read_time. This is the
|
1110
|
+
# time between (read_time - compare_duration) and read_time.
|
1111
|
+
#
|
1112
|
+
# The state_change value is derived based on the presence and state of the
|
1113
|
+
# finding at the two points in time. Intermediate state changes between the
|
1114
|
+
# two times don't affect the result. For example, the results aren't affected
|
1115
|
+
# if the finding is made inactive and then active again.
|
1116
|
+
#
|
1117
|
+
# Possible "state_change" values when compare_duration is specified:
|
1118
|
+
#
|
1119
|
+
# * "CHANGED": indicates that the finding was present and matched the given
|
1120
|
+
# filter at the start of compare_duration, but changed its
|
1121
|
+
# state at read_time.
|
1122
|
+
# * "UNCHANGED": indicates that the finding was present and matched the given
|
1123
|
+
# filter at the start of compare_duration and did not change
|
1124
|
+
# state at read_time.
|
1125
|
+
# * "ADDED": indicates that the finding did not match the given filter or
|
1126
|
+
# was not present at the start of compare_duration, but was
|
1127
|
+
# present at read_time.
|
1128
|
+
# * "REMOVED": indicates that the finding was present and matched the
|
1129
|
+
# filter at the start of compare_duration, but did not match
|
1130
|
+
# the filter at read_time.
|
1131
|
+
#
|
1132
|
+
# If compare_duration is not specified, then the only possible state_change
|
1133
|
+
# is "UNUSED", which will be the state_change set for all findings present
|
1134
|
+
# at read_time.
|
1135
|
+
#
|
1136
|
+
# If this field is set then `state_change` must be a specified field in
|
1137
|
+
# `group_by`.
|
1138
|
+
# @param page_token [String]
|
1139
|
+
# The value returned by the last `GroupFindingsResponse`; indicates
|
1140
|
+
# that this is a continuation of a prior `GroupFindings` call, and
|
1141
|
+
# that the system should return the next page of data.
|
1142
|
+
# @param page_size [Integer]
|
1143
|
+
# The maximum number of results to return in a single response. Default is
|
1144
|
+
# 10, minimum is 1, maximum is 1000.
|
1145
|
+
#
|
1146
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1147
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
|
1148
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1149
|
+
#
|
1150
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
|
1151
|
+
#
|
1152
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1153
|
+
#
|
1154
|
+
def group_findings request, options = nil
|
1155
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1156
|
+
|
1157
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::GroupFindingsRequest
|
1158
|
+
|
1159
|
+
# Converts hash and nil to an options object
|
1160
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1161
|
+
|
1162
|
+
# Customize the options with defaults
|
1163
|
+
metadata = @config.rpcs.group_findings.metadata.to_h
|
1164
|
+
|
1165
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1166
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1167
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1168
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1169
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1170
|
+
|
1171
|
+
header_params = {
|
1172
|
+
"parent" => request.parent
|
1173
|
+
}
|
1174
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1175
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1176
|
+
|
1177
|
+
options.apply_defaults timeout: @config.rpcs.group_findings.timeout,
|
1178
|
+
metadata: metadata,
|
1179
|
+
retry_policy: @config.rpcs.group_findings.retry_policy
|
1180
|
+
options.apply_defaults metadata: @config.metadata,
|
1181
|
+
retry_policy: @config.retry_policy
|
1182
|
+
|
1183
|
+
@security_center_stub.call_rpc :group_findings, request, options: options do |response, operation|
|
1184
|
+
response = Gapic::PagedEnumerable.new @security_center_stub, :group_findings, request, response, operation, options
|
1185
|
+
yield response, operation if block_given?
|
1186
|
+
return response
|
1187
|
+
end
|
1188
|
+
rescue GRPC::BadStatus => e
|
1189
|
+
raise Google::Cloud::Error.from_error(e)
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
##
|
1193
|
+
# Lists an organization's assets.
|
1194
|
+
#
|
1195
|
+
# @overload list_assets(request, options = nil)
|
1196
|
+
# Pass arguments to `list_assets` via a request object, either of type
|
1197
|
+
# {Google::Cloud::SecurityCenter::V1::ListAssetsRequest} or an equivalent Hash.
|
1198
|
+
#
|
1199
|
+
# @param request [Google::Cloud::SecurityCenter::V1::ListAssetsRequest, Hash]
|
1200
|
+
# A request object representing the call parameters. Required. To specify no
|
1201
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1202
|
+
# @param options [Gapic::CallOptions, Hash]
|
1203
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1204
|
+
#
|
1205
|
+
# @overload list_assets(parent: nil, filter: nil, order_by: nil, read_time: nil, compare_duration: nil, field_mask: nil, page_token: nil, page_size: nil)
|
1206
|
+
# Pass arguments to `list_assets` via keyword arguments. Note that at
|
1207
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1208
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1209
|
+
#
|
1210
|
+
# @param parent [String]
|
1211
|
+
# Required. Name of the organization assets should belong to. Its format is
|
1212
|
+
# "organizations/[organization_id]".
|
1213
|
+
# @param filter [String]
|
1214
|
+
# Expression that defines the filter to apply across assets.
|
1215
|
+
# The expression is a list of zero or more restrictions combined via logical
|
1216
|
+
# operators `AND` and `OR`.
|
1217
|
+
# Parentheses are supported, and `OR` has higher precedence than `AND`.
|
1218
|
+
#
|
1219
|
+
# Restrictions have the form `<field> <operator> <value>` and may have a `-`
|
1220
|
+
# character in front of them to indicate negation. The fields map to those
|
1221
|
+
# defined in the Asset resource. Examples include:
|
1222
|
+
#
|
1223
|
+
# * name
|
1224
|
+
# * security_center_properties.resource_name
|
1225
|
+
# * resource_properties.a_property
|
1226
|
+
# * security_marks.marks.marka
|
1227
|
+
#
|
1228
|
+
# The supported operators are:
|
1229
|
+
#
|
1230
|
+
# * `=` for all value types.
|
1231
|
+
# * `>`, `<`, `>=`, `<=` for integer values.
|
1232
|
+
# * `:`, meaning substring matching, for strings.
|
1233
|
+
#
|
1234
|
+
# The supported value types are:
|
1235
|
+
#
|
1236
|
+
# * string literals in quotes.
|
1237
|
+
# * integer literals without quotes.
|
1238
|
+
# * boolean literals `true` and `false` without quotes.
|
1239
|
+
#
|
1240
|
+
# The following are the allowed field and operator combinations:
|
1241
|
+
#
|
1242
|
+
# * name: `=`
|
1243
|
+
# * update_time: `=`, `>`, `<`, `>=`, `<=`
|
1244
|
+
#
|
1245
|
+
# Usage: This should be milliseconds since epoch or an RFC3339 string.
|
1246
|
+
# Examples:
|
1247
|
+
# "update_time = \"2019-06-10T16:07:18-07:00\""
|
1248
|
+
# "update_time = 1560208038000"
|
1249
|
+
#
|
1250
|
+
# * create_time: `=`, `>`, `<`, `>=`, `<=`
|
1251
|
+
#
|
1252
|
+
# Usage: This should be milliseconds since epoch or an RFC3339 string.
|
1253
|
+
# Examples:
|
1254
|
+
# "create_time = \"2019-06-10T16:07:18-07:00\""
|
1255
|
+
# "create_time = 1560208038000"
|
1256
|
+
#
|
1257
|
+
# * iam_policy.policy_blob: `=`, `:`
|
1258
|
+
# * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
|
1259
|
+
# * security_marks.marks: `=`, `:`
|
1260
|
+
# * security_center_properties.resource_name: `=`, `:`
|
1261
|
+
# * security_center_properties.resource_display_name: `=`, `:`
|
1262
|
+
# * security_center_properties.resource_type: `=`, `:`
|
1263
|
+
# * security_center_properties.resource_parent: `=`, `:`
|
1264
|
+
# * security_center_properties.resource_parent_display_name: `=`, `:`
|
1265
|
+
# * security_center_properties.resource_project: `=`, `:`
|
1266
|
+
# * security_center_properties.resource_project_display_name: `=`, `:`
|
1267
|
+
# * security_center_properties.resource_owners: `=`, `:`
|
1268
|
+
#
|
1269
|
+
# For example, `resource_properties.size = 100` is a valid filter string.
|
1270
|
+
# @param order_by [String]
|
1271
|
+
# Expression that defines what fields and order to use for sorting. The
|
1272
|
+
# string value should follow SQL syntax: comma separated list of fields. For
|
1273
|
+
# example: "name,resource_properties.a_property". The default sorting order
|
1274
|
+
# is ascending. To specify descending order for a field, a suffix " desc"
|
1275
|
+
# should be appended to the field name. For example: "name
|
1276
|
+
# desc,resource_properties.a_property". Redundant space characters in the
|
1277
|
+
# syntax are insignificant. "name desc,resource_properties.a_property" and "
|
1278
|
+
# name desc , resource_properties.a_property " are equivalent.
|
1279
|
+
#
|
1280
|
+
# The following fields are supported:
|
1281
|
+
# name
|
1282
|
+
# update_time
|
1283
|
+
# resource_properties
|
1284
|
+
# security_marks.marks
|
1285
|
+
# security_center_properties.resource_name
|
1286
|
+
# security_center_properties.resource_display_name
|
1287
|
+
# security_center_properties.resource_parent
|
1288
|
+
# security_center_properties.resource_parent_display_name
|
1289
|
+
# security_center_properties.resource_project
|
1290
|
+
# security_center_properties.resource_project_display_name
|
1291
|
+
# security_center_properties.resource_type
|
1292
|
+
# @param read_time [Google::Protobuf::Timestamp, Hash]
|
1293
|
+
# Time used as a reference point when filtering assets. The filter is limited
|
1294
|
+
# to assets existing at the supplied time and their values are those at that
|
1295
|
+
# specific time. Absence of this field will default to the API's version of
|
1296
|
+
# NOW.
|
1297
|
+
# @param compare_duration [Google::Protobuf::Duration, Hash]
|
1298
|
+
# When compare_duration is set, the ListAssetsResult's "state_change"
|
1299
|
+
# attribute is updated to indicate whether the asset was added, removed, or
|
1300
|
+
# remained present during the compare_duration period of time that precedes
|
1301
|
+
# the read_time. This is the time between (read_time - compare_duration) and
|
1302
|
+
# read_time.
|
1303
|
+
#
|
1304
|
+
# The state_change value is derived based on the presence of the asset at the
|
1305
|
+
# two points in time. Intermediate state changes between the two times don't
|
1306
|
+
# affect the result. For example, the results aren't affected if the asset is
|
1307
|
+
# removed and re-created again.
|
1308
|
+
#
|
1309
|
+
# Possible "state_change" values when compare_duration is specified:
|
1310
|
+
#
|
1311
|
+
# * "ADDED": indicates that the asset was not present at the start of
|
1312
|
+
# compare_duration, but present at read_time.
|
1313
|
+
# * "REMOVED": indicates that the asset was present at the start of
|
1314
|
+
# compare_duration, but not present at read_time.
|
1315
|
+
# * "ACTIVE": indicates that the asset was present at both the
|
1316
|
+
# start and the end of the time period defined by
|
1317
|
+
# compare_duration and read_time.
|
1318
|
+
#
|
1319
|
+
# If compare_duration is not specified, then the only possible state_change
|
1320
|
+
# is "UNUSED", which will be the state_change set for all assets present at
|
1321
|
+
# read_time.
|
1322
|
+
# @param field_mask [Google::Protobuf::FieldMask, Hash]
|
1323
|
+
# Optional. A field mask to specify the ListAssetsResult fields to be listed
|
1324
|
+
# in the response. An empty field mask will list all fields.
|
1325
|
+
# @param page_token [String]
|
1326
|
+
# The value returned by the last `ListAssetsResponse`; indicates
|
1327
|
+
# that this is a continuation of a prior `ListAssets` call, and
|
1328
|
+
# that the system should return the next page of data.
|
1329
|
+
# @param page_size [Integer]
|
1330
|
+
# The maximum number of results to return in a single response. Default is
|
1331
|
+
# 10, minimum is 1, maximum is 1000.
|
1332
|
+
#
|
1333
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1334
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult>]
|
1335
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1336
|
+
#
|
1337
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult>]
|
1338
|
+
#
|
1339
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1340
|
+
#
|
1341
|
+
def list_assets request, options = nil
|
1342
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1343
|
+
|
1344
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::ListAssetsRequest
|
1345
|
+
|
1346
|
+
# Converts hash and nil to an options object
|
1347
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1348
|
+
|
1349
|
+
# Customize the options with defaults
|
1350
|
+
metadata = @config.rpcs.list_assets.metadata.to_h
|
1351
|
+
|
1352
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1353
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1354
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1355
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1356
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1357
|
+
|
1358
|
+
header_params = {
|
1359
|
+
"parent" => request.parent
|
1360
|
+
}
|
1361
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1362
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1363
|
+
|
1364
|
+
options.apply_defaults timeout: @config.rpcs.list_assets.timeout,
|
1365
|
+
metadata: metadata,
|
1366
|
+
retry_policy: @config.rpcs.list_assets.retry_policy
|
1367
|
+
options.apply_defaults metadata: @config.metadata,
|
1368
|
+
retry_policy: @config.retry_policy
|
1369
|
+
|
1370
|
+
@security_center_stub.call_rpc :list_assets, request, options: options do |response, operation|
|
1371
|
+
response = Gapic::PagedEnumerable.new @security_center_stub, :list_assets, request, response, operation, options
|
1372
|
+
yield response, operation if block_given?
|
1373
|
+
return response
|
1374
|
+
end
|
1375
|
+
rescue GRPC::BadStatus => e
|
1376
|
+
raise Google::Cloud::Error.from_error(e)
|
1377
|
+
end
|
1378
|
+
|
1379
|
+
##
|
1380
|
+
# Lists an organization or source's findings.
|
1381
|
+
#
|
1382
|
+
# To list across all sources provide a `-` as the source id.
|
1383
|
+
# Example: /v1/organizations/\\{organization_id}/sources/-/findings
|
1384
|
+
#
|
1385
|
+
# @overload list_findings(request, options = nil)
|
1386
|
+
# Pass arguments to `list_findings` via a request object, either of type
|
1387
|
+
# {Google::Cloud::SecurityCenter::V1::ListFindingsRequest} or an equivalent Hash.
|
1388
|
+
#
|
1389
|
+
# @param request [Google::Cloud::SecurityCenter::V1::ListFindingsRequest, Hash]
|
1390
|
+
# A request object representing the call parameters. Required. To specify no
|
1391
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1392
|
+
# @param options [Gapic::CallOptions, Hash]
|
1393
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1394
|
+
#
|
1395
|
+
# @overload list_findings(parent: nil, filter: nil, order_by: nil, read_time: nil, compare_duration: nil, field_mask: nil, page_token: nil, page_size: nil)
|
1396
|
+
# Pass arguments to `list_findings` via keyword arguments. Note that at
|
1397
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1398
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1399
|
+
#
|
1400
|
+
# @param parent [String]
|
1401
|
+
# Required. Name of the source the findings belong to. Its format is
|
1402
|
+
# "organizations/[organization_id]/sources/[source_id]". To list across all
|
1403
|
+
# sources provide a source_id of `-`. For example:
|
1404
|
+
# organizations/\\{organization_id}/sources/-
|
1405
|
+
# @param filter [String]
|
1406
|
+
# Expression that defines the filter to apply across findings.
|
1407
|
+
# The expression is a list of one or more restrictions combined via logical
|
1408
|
+
# operators `AND` and `OR`.
|
1409
|
+
# Parentheses are supported, and `OR` has higher precedence than `AND`.
|
1410
|
+
#
|
1411
|
+
# Restrictions have the form `<field> <operator> <value>` and may have a `-`
|
1412
|
+
# character in front of them to indicate negation. Examples include:
|
1413
|
+
#
|
1414
|
+
# * name
|
1415
|
+
# * source_properties.a_property
|
1416
|
+
# * security_marks.marks.marka
|
1417
|
+
#
|
1418
|
+
# The supported operators are:
|
1419
|
+
#
|
1420
|
+
# * `=` for all value types.
|
1421
|
+
# * `>`, `<`, `>=`, `<=` for integer values.
|
1422
|
+
# * `:`, meaning substring matching, for strings.
|
1423
|
+
#
|
1424
|
+
# The supported value types are:
|
1425
|
+
#
|
1426
|
+
# * string literals in quotes.
|
1427
|
+
# * integer literals without quotes.
|
1428
|
+
# * boolean literals `true` and `false` without quotes.
|
1429
|
+
#
|
1430
|
+
# The following field and operator combinations are supported:
|
1431
|
+
#
|
1432
|
+
# name: `=`
|
1433
|
+
# parent: `=`, `:`
|
1434
|
+
# resource_name: `=`, `:`
|
1435
|
+
# state: `=`, `:`
|
1436
|
+
# category: `=`, `:`
|
1437
|
+
# external_uri: `=`, `:`
|
1438
|
+
# event_time: `=`, `>`, `<`, `>=`, `<=`
|
1439
|
+
#
|
1440
|
+
# Usage: This should be milliseconds since epoch or an RFC3339 string.
|
1441
|
+
# Examples:
|
1442
|
+
# "event_time = \"2019-06-10T16:07:18-07:00\""
|
1443
|
+
# "event_time = 1560208038000"
|
1444
|
+
#
|
1445
|
+
# security_marks.marks: `=`, `:`
|
1446
|
+
# source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
|
1447
|
+
#
|
1448
|
+
# For example, `source_properties.size = 100` is a valid filter string.
|
1449
|
+
# @param order_by [String]
|
1450
|
+
# Expression that defines what fields and order to use for sorting. The
|
1451
|
+
# string value should follow SQL syntax: comma separated list of fields. For
|
1452
|
+
# example: "name,resource_properties.a_property". The default sorting order
|
1453
|
+
# is ascending. To specify descending order for a field, a suffix " desc"
|
1454
|
+
# should be appended to the field name. For example: "name
|
1455
|
+
# desc,source_properties.a_property". Redundant space characters in the
|
1456
|
+
# syntax are insignificant. "name desc,source_properties.a_property" and "
|
1457
|
+
# name desc , source_properties.a_property " are equivalent.
|
1458
|
+
#
|
1459
|
+
# The following fields are supported:
|
1460
|
+
# name
|
1461
|
+
# parent
|
1462
|
+
# state
|
1463
|
+
# category
|
1464
|
+
# resource_name
|
1465
|
+
# event_time
|
1466
|
+
# source_properties
|
1467
|
+
# security_marks.marks
|
1468
|
+
# @param read_time [Google::Protobuf::Timestamp, Hash]
|
1469
|
+
# Time used as a reference point when filtering findings. The filter is
|
1470
|
+
# limited to findings existing at the supplied time and their values are
|
1471
|
+
# those at that specific time. Absence of this field will default to the
|
1472
|
+
# API's version of NOW.
|
1473
|
+
# @param compare_duration [Google::Protobuf::Duration, Hash]
|
1474
|
+
# When compare_duration is set, the ListFindingsResult's "state_change"
|
1475
|
+
# attribute is updated to indicate whether the finding had its state changed,
|
1476
|
+
# the finding's state remained unchanged, or if the finding was added in any
|
1477
|
+
# state during the compare_duration period of time that precedes the
|
1478
|
+
# read_time. This is the time between (read_time - compare_duration) and
|
1479
|
+
# read_time.
|
1480
|
+
#
|
1481
|
+
# The state_change value is derived based on the presence and state of the
|
1482
|
+
# finding at the two points in time. Intermediate state changes between the
|
1483
|
+
# two times don't affect the result. For example, the results aren't affected
|
1484
|
+
# if the finding is made inactive and then active again.
|
1485
|
+
#
|
1486
|
+
# Possible "state_change" values when compare_duration is specified:
|
1487
|
+
#
|
1488
|
+
# * "CHANGED": indicates that the finding was present and matched the given
|
1489
|
+
# filter at the start of compare_duration, but changed its
|
1490
|
+
# state at read_time.
|
1491
|
+
# * "UNCHANGED": indicates that the finding was present and matched the given
|
1492
|
+
# filter at the start of compare_duration and did not change
|
1493
|
+
# state at read_time.
|
1494
|
+
# * "ADDED": indicates that the finding did not match the given filter or
|
1495
|
+
# was not present at the start of compare_duration, but was
|
1496
|
+
# present at read_time.
|
1497
|
+
# * "REMOVED": indicates that the finding was present and matched the
|
1498
|
+
# filter at the start of compare_duration, but did not match
|
1499
|
+
# the filter at read_time.
|
1500
|
+
#
|
1501
|
+
# If compare_duration is not specified, then the only possible state_change
|
1502
|
+
# is "UNUSED", which will be the state_change set for all findings present at
|
1503
|
+
# read_time.
|
1504
|
+
# @param field_mask [Google::Protobuf::FieldMask, Hash]
|
1505
|
+
# Optional. A field mask to specify the Finding fields to be listed in the
|
1506
|
+
# response. An empty field mask will list all fields.
|
1507
|
+
# @param page_token [String]
|
1508
|
+
# The value returned by the last `ListFindingsResponse`; indicates
|
1509
|
+
# that this is a continuation of a prior `ListFindings` call, and
|
1510
|
+
# that the system should return the next page of data.
|
1511
|
+
# @param page_size [Integer]
|
1512
|
+
# The maximum number of results to return in a single response. Default is
|
1513
|
+
# 10, minimum is 1, maximum is 1000.
|
1514
|
+
#
|
1515
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1516
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult>]
|
1517
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1518
|
+
#
|
1519
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult>]
|
1520
|
+
#
|
1521
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1522
|
+
#
|
1523
|
+
def list_findings request, options = nil
|
1524
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1525
|
+
|
1526
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::ListFindingsRequest
|
1527
|
+
|
1528
|
+
# Converts hash and nil to an options object
|
1529
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1530
|
+
|
1531
|
+
# Customize the options with defaults
|
1532
|
+
metadata = @config.rpcs.list_findings.metadata.to_h
|
1533
|
+
|
1534
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1535
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1536
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1537
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1538
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1539
|
+
|
1540
|
+
header_params = {
|
1541
|
+
"parent" => request.parent
|
1542
|
+
}
|
1543
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1544
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1545
|
+
|
1546
|
+
options.apply_defaults timeout: @config.rpcs.list_findings.timeout,
|
1547
|
+
metadata: metadata,
|
1548
|
+
retry_policy: @config.rpcs.list_findings.retry_policy
|
1549
|
+
options.apply_defaults metadata: @config.metadata,
|
1550
|
+
retry_policy: @config.retry_policy
|
1551
|
+
|
1552
|
+
@security_center_stub.call_rpc :list_findings, request, options: options do |response, operation|
|
1553
|
+
response = Gapic::PagedEnumerable.new @security_center_stub, :list_findings, request, response, operation, options
|
1554
|
+
yield response, operation if block_given?
|
1555
|
+
return response
|
1556
|
+
end
|
1557
|
+
rescue GRPC::BadStatus => e
|
1558
|
+
raise Google::Cloud::Error.from_error(e)
|
1559
|
+
end
|
1560
|
+
|
1561
|
+
##
|
1562
|
+
# Lists notification configs.
|
1563
|
+
#
|
1564
|
+
# @overload list_notification_configs(request, options = nil)
|
1565
|
+
# Pass arguments to `list_notification_configs` via a request object, either of type
|
1566
|
+
# {Google::Cloud::SecurityCenter::V1::ListNotificationConfigsRequest} or an equivalent Hash.
|
1567
|
+
#
|
1568
|
+
# @param request [Google::Cloud::SecurityCenter::V1::ListNotificationConfigsRequest, Hash]
|
1569
|
+
# A request object representing the call parameters. Required. To specify no
|
1570
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1571
|
+
# @param options [Gapic::CallOptions, Hash]
|
1572
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1573
|
+
#
|
1574
|
+
# @overload list_notification_configs(parent: nil, page_token: nil, page_size: nil)
|
1575
|
+
# Pass arguments to `list_notification_configs` via keyword arguments. Note that at
|
1576
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1577
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1578
|
+
#
|
1579
|
+
# @param parent [String]
|
1580
|
+
# Required. Name of the organization to list notification configs.
|
1581
|
+
# Its format is "organizations/[organization_id]".
|
1582
|
+
# @param page_token [String]
|
1583
|
+
# The value returned by the last `ListNotificationConfigsResponse`; indicates
|
1584
|
+
# that this is a continuation of a prior `ListNotificationConfigs` call, and
|
1585
|
+
# that the system should return the next page of data.
|
1586
|
+
# @param page_size [Integer]
|
1587
|
+
# The maximum number of results to return in a single response. Default is
|
1588
|
+
# 10, minimum is 1, maximum is 1000.
|
1589
|
+
#
|
1590
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1591
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::NotificationConfig>]
|
1592
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1593
|
+
#
|
1594
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::NotificationConfig>]
|
1595
|
+
#
|
1596
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1597
|
+
#
|
1598
|
+
def list_notification_configs request, options = nil
|
1599
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1600
|
+
|
1601
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::ListNotificationConfigsRequest
|
1602
|
+
|
1603
|
+
# Converts hash and nil to an options object
|
1604
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1605
|
+
|
1606
|
+
# Customize the options with defaults
|
1607
|
+
metadata = @config.rpcs.list_notification_configs.metadata.to_h
|
1608
|
+
|
1609
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1610
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1611
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1612
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1613
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1614
|
+
|
1615
|
+
header_params = {
|
1616
|
+
"parent" => request.parent
|
1617
|
+
}
|
1618
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1619
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1620
|
+
|
1621
|
+
options.apply_defaults timeout: @config.rpcs.list_notification_configs.timeout,
|
1622
|
+
metadata: metadata,
|
1623
|
+
retry_policy: @config.rpcs.list_notification_configs.retry_policy
|
1624
|
+
options.apply_defaults metadata: @config.metadata,
|
1625
|
+
retry_policy: @config.retry_policy
|
1626
|
+
|
1627
|
+
@security_center_stub.call_rpc :list_notification_configs, request, options: options do |response, operation|
|
1628
|
+
response = Gapic::PagedEnumerable.new @security_center_stub, :list_notification_configs, request, response, operation, options
|
1629
|
+
yield response, operation if block_given?
|
1630
|
+
return response
|
1631
|
+
end
|
1632
|
+
rescue GRPC::BadStatus => e
|
1633
|
+
raise Google::Cloud::Error.from_error(e)
|
1634
|
+
end
|
1635
|
+
|
1636
|
+
##
|
1637
|
+
# Lists all sources belonging to an organization.
|
1638
|
+
#
|
1639
|
+
# @overload list_sources(request, options = nil)
|
1640
|
+
# Pass arguments to `list_sources` via a request object, either of type
|
1641
|
+
# {Google::Cloud::SecurityCenter::V1::ListSourcesRequest} or an equivalent Hash.
|
1642
|
+
#
|
1643
|
+
# @param request [Google::Cloud::SecurityCenter::V1::ListSourcesRequest, Hash]
|
1644
|
+
# A request object representing the call parameters. Required. To specify no
|
1645
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1646
|
+
# @param options [Gapic::CallOptions, Hash]
|
1647
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1648
|
+
#
|
1649
|
+
# @overload list_sources(parent: nil, page_token: nil, page_size: nil)
|
1650
|
+
# Pass arguments to `list_sources` via keyword arguments. Note that at
|
1651
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1652
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1653
|
+
#
|
1654
|
+
# @param parent [String]
|
1655
|
+
# Required. Resource name of the parent of sources to list. Its format should
|
1656
|
+
# be "organizations/[organization_id]".
|
1657
|
+
# @param page_token [String]
|
1658
|
+
# The value returned by the last `ListSourcesResponse`; indicates
|
1659
|
+
# that this is a continuation of a prior `ListSources` call, and
|
1660
|
+
# that the system should return the next page of data.
|
1661
|
+
# @param page_size [Integer]
|
1662
|
+
# The maximum number of results to return in a single response. Default is
|
1663
|
+
# 10, minimum is 1, maximum is 1000.
|
1664
|
+
#
|
1665
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1666
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::Source>]
|
1667
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1668
|
+
#
|
1669
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecurityCenter::V1::Source>]
|
1670
|
+
#
|
1671
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1672
|
+
#
|
1673
|
+
def list_sources request, options = nil
|
1674
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1675
|
+
|
1676
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::ListSourcesRequest
|
1677
|
+
|
1678
|
+
# Converts hash and nil to an options object
|
1679
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1680
|
+
|
1681
|
+
# Customize the options with defaults
|
1682
|
+
metadata = @config.rpcs.list_sources.metadata.to_h
|
1683
|
+
|
1684
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1685
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1686
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1687
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1688
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1689
|
+
|
1690
|
+
header_params = {
|
1691
|
+
"parent" => request.parent
|
1692
|
+
}
|
1693
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1694
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1695
|
+
|
1696
|
+
options.apply_defaults timeout: @config.rpcs.list_sources.timeout,
|
1697
|
+
metadata: metadata,
|
1698
|
+
retry_policy: @config.rpcs.list_sources.retry_policy
|
1699
|
+
options.apply_defaults metadata: @config.metadata,
|
1700
|
+
retry_policy: @config.retry_policy
|
1701
|
+
|
1702
|
+
@security_center_stub.call_rpc :list_sources, request, options: options do |response, operation|
|
1703
|
+
response = Gapic::PagedEnumerable.new @security_center_stub, :list_sources, request, response, operation, options
|
1704
|
+
yield response, operation if block_given?
|
1705
|
+
return response
|
1706
|
+
end
|
1707
|
+
rescue GRPC::BadStatus => e
|
1708
|
+
raise Google::Cloud::Error.from_error(e)
|
1709
|
+
end
|
1710
|
+
|
1711
|
+
##
|
1712
|
+
# Runs asset discovery. The discovery is tracked with a long-running
|
1713
|
+
# operation.
|
1714
|
+
#
|
1715
|
+
# This API can only be called with limited frequency for an organization. If
|
1716
|
+
# it is called too frequently the caller will receive a TOO_MANY_REQUESTS
|
1717
|
+
# error.
|
1718
|
+
#
|
1719
|
+
# @overload run_asset_discovery(request, options = nil)
|
1720
|
+
# Pass arguments to `run_asset_discovery` via a request object, either of type
|
1721
|
+
# {Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryRequest} or an equivalent Hash.
|
1722
|
+
#
|
1723
|
+
# @param request [Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryRequest, Hash]
|
1724
|
+
# A request object representing the call parameters. Required. To specify no
|
1725
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1726
|
+
# @param options [Gapic::CallOptions, Hash]
|
1727
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1728
|
+
#
|
1729
|
+
# @overload run_asset_discovery(parent: nil)
|
1730
|
+
# Pass arguments to `run_asset_discovery` via keyword arguments. Note that at
|
1731
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1732
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1733
|
+
#
|
1734
|
+
# @param parent [String]
|
1735
|
+
# Required. Name of the organization to run asset discovery for. Its format
|
1736
|
+
# is "organizations/[organization_id]".
|
1737
|
+
#
|
1738
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1739
|
+
# @yieldparam response [Gapic::Operation]
|
1740
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1741
|
+
#
|
1742
|
+
# @return [Gapic::Operation]
|
1743
|
+
#
|
1744
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1745
|
+
#
|
1746
|
+
def run_asset_discovery request, options = nil
|
1747
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1748
|
+
|
1749
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryRequest
|
1750
|
+
|
1751
|
+
# Converts hash and nil to an options object
|
1752
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1753
|
+
|
1754
|
+
# Customize the options with defaults
|
1755
|
+
metadata = @config.rpcs.run_asset_discovery.metadata.to_h
|
1756
|
+
|
1757
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1758
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1759
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1760
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1761
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1762
|
+
|
1763
|
+
header_params = {
|
1764
|
+
"parent" => request.parent
|
1765
|
+
}
|
1766
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1767
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1768
|
+
|
1769
|
+
options.apply_defaults timeout: @config.rpcs.run_asset_discovery.timeout,
|
1770
|
+
metadata: metadata,
|
1771
|
+
retry_policy: @config.rpcs.run_asset_discovery.retry_policy
|
1772
|
+
options.apply_defaults metadata: @config.metadata,
|
1773
|
+
retry_policy: @config.retry_policy
|
1774
|
+
|
1775
|
+
@security_center_stub.call_rpc :run_asset_discovery, request, options: options do |response, operation|
|
1776
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
1777
|
+
yield response, operation if block_given?
|
1778
|
+
return response
|
1779
|
+
end
|
1780
|
+
rescue GRPC::BadStatus => e
|
1781
|
+
raise Google::Cloud::Error.from_error(e)
|
1782
|
+
end
|
1783
|
+
|
1784
|
+
##
|
1785
|
+
# Updates the state of a finding.
|
1786
|
+
#
|
1787
|
+
# @overload set_finding_state(request, options = nil)
|
1788
|
+
# Pass arguments to `set_finding_state` via a request object, either of type
|
1789
|
+
# {Google::Cloud::SecurityCenter::V1::SetFindingStateRequest} or an equivalent Hash.
|
1790
|
+
#
|
1791
|
+
# @param request [Google::Cloud::SecurityCenter::V1::SetFindingStateRequest, Hash]
|
1792
|
+
# A request object representing the call parameters. Required. To specify no
|
1793
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1794
|
+
# @param options [Gapic::CallOptions, Hash]
|
1795
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1796
|
+
#
|
1797
|
+
# @overload set_finding_state(name: nil, state: nil, start_time: nil)
|
1798
|
+
# Pass arguments to `set_finding_state` via keyword arguments. Note that at
|
1799
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1800
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1801
|
+
#
|
1802
|
+
# @param name [String]
|
1803
|
+
# Required. The relative resource name of the finding. See:
|
1804
|
+
# https://cloud.google.com/apis/design/resource_names#relative_resource_name
|
1805
|
+
# Example:
|
1806
|
+
# "organizations/\\{organization_id}/sources/\\{source_id}/finding/\\{finding_id}".
|
1807
|
+
# @param state [Google::Cloud::SecurityCenter::V1::Finding::State]
|
1808
|
+
# Required. The desired State of the finding.
|
1809
|
+
# @param start_time [Google::Protobuf::Timestamp, Hash]
|
1810
|
+
# Required. The time at which the updated state takes effect.
|
1811
|
+
#
|
1812
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1813
|
+
# @yieldparam response [Google::Cloud::SecurityCenter::V1::Finding]
|
1814
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1815
|
+
#
|
1816
|
+
# @return [Google::Cloud::SecurityCenter::V1::Finding]
|
1817
|
+
#
|
1818
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1819
|
+
#
|
1820
|
+
def set_finding_state request, options = nil
|
1821
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1822
|
+
|
1823
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::SetFindingStateRequest
|
1824
|
+
|
1825
|
+
# Converts hash and nil to an options object
|
1826
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1827
|
+
|
1828
|
+
# Customize the options with defaults
|
1829
|
+
metadata = @config.rpcs.set_finding_state.metadata.to_h
|
1830
|
+
|
1831
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1832
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1833
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1834
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1835
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1836
|
+
|
1837
|
+
header_params = {
|
1838
|
+
"name" => request.name
|
1839
|
+
}
|
1840
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1841
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1842
|
+
|
1843
|
+
options.apply_defaults timeout: @config.rpcs.set_finding_state.timeout,
|
1844
|
+
metadata: metadata,
|
1845
|
+
retry_policy: @config.rpcs.set_finding_state.retry_policy
|
1846
|
+
options.apply_defaults metadata: @config.metadata,
|
1847
|
+
retry_policy: @config.retry_policy
|
1848
|
+
|
1849
|
+
@security_center_stub.call_rpc :set_finding_state, request, options: options do |response, operation|
|
1850
|
+
yield response, operation if block_given?
|
1851
|
+
return response
|
1852
|
+
end
|
1853
|
+
rescue GRPC::BadStatus => e
|
1854
|
+
raise Google::Cloud::Error.from_error(e)
|
1855
|
+
end
|
1856
|
+
|
1857
|
+
##
|
1858
|
+
# Sets the access control policy on the specified Source.
|
1859
|
+
#
|
1860
|
+
# @overload set_iam_policy(request, options = nil)
|
1861
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
1862
|
+
# {Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
1863
|
+
#
|
1864
|
+
# @param request [Google::Iam::V1::SetIamPolicyRequest, Hash]
|
1865
|
+
# A request object representing the call parameters. Required. To specify no
|
1866
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1867
|
+
# @param options [Gapic::CallOptions, Hash]
|
1868
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1869
|
+
#
|
1870
|
+
# @overload set_iam_policy(resource: nil, policy: nil)
|
1871
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
1872
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1873
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1874
|
+
#
|
1875
|
+
# @param resource [String]
|
1876
|
+
# REQUIRED: The resource for which the policy is being specified.
|
1877
|
+
# See the operation documentation for the appropriate value for this field.
|
1878
|
+
# @param policy [Google::Iam::V1::Policy, Hash]
|
1879
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
1880
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
1881
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
1882
|
+
# might reject them.
|
1883
|
+
#
|
1884
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1885
|
+
# @yieldparam response [Google::Iam::V1::Policy]
|
1886
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1887
|
+
#
|
1888
|
+
# @return [Google::Iam::V1::Policy]
|
1889
|
+
#
|
1890
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1891
|
+
#
|
1892
|
+
def set_iam_policy request, options = nil
|
1893
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1894
|
+
|
1895
|
+
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::SetIamPolicyRequest
|
1896
|
+
|
1897
|
+
# Converts hash and nil to an options object
|
1898
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1899
|
+
|
1900
|
+
# Customize the options with defaults
|
1901
|
+
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
1902
|
+
|
1903
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1904
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1905
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1906
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1907
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1908
|
+
|
1909
|
+
header_params = {
|
1910
|
+
"resource" => request.resource
|
1911
|
+
}
|
1912
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1913
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1914
|
+
|
1915
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
1916
|
+
metadata: metadata,
|
1917
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
1918
|
+
options.apply_defaults metadata: @config.metadata,
|
1919
|
+
retry_policy: @config.retry_policy
|
1920
|
+
|
1921
|
+
@security_center_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
1922
|
+
yield response, operation if block_given?
|
1923
|
+
return response
|
1924
|
+
end
|
1925
|
+
rescue GRPC::BadStatus => e
|
1926
|
+
raise Google::Cloud::Error.from_error(e)
|
1927
|
+
end
|
1928
|
+
|
1929
|
+
##
|
1930
|
+
# Returns the permissions that a caller has on the specified source.
|
1931
|
+
#
|
1932
|
+
# @overload test_iam_permissions(request, options = nil)
|
1933
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
1934
|
+
# {Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
1935
|
+
#
|
1936
|
+
# @param request [Google::Iam::V1::TestIamPermissionsRequest, Hash]
|
1937
|
+
# A request object representing the call parameters. Required. To specify no
|
1938
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1939
|
+
# @param options [Gapic::CallOptions, Hash]
|
1940
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1941
|
+
#
|
1942
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
1943
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
1944
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1945
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1946
|
+
#
|
1947
|
+
# @param resource [String]
|
1948
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
1949
|
+
# See the operation documentation for the appropriate value for this field.
|
1950
|
+
# @param permissions [Array<String>]
|
1951
|
+
# The set of permissions to check for the `resource`. Permissions with
|
1952
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
1953
|
+
# information see
|
1954
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
1955
|
+
#
|
1956
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1957
|
+
# @yieldparam response [Google::Iam::V1::TestIamPermissionsResponse]
|
1958
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1959
|
+
#
|
1960
|
+
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
1961
|
+
#
|
1962
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1963
|
+
#
|
1964
|
+
def test_iam_permissions request, options = nil
|
1965
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1966
|
+
|
1967
|
+
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::TestIamPermissionsRequest
|
1968
|
+
|
1969
|
+
# Converts hash and nil to an options object
|
1970
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1971
|
+
|
1972
|
+
# Customize the options with defaults
|
1973
|
+
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
1974
|
+
|
1975
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1976
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1977
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1978
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
1979
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1980
|
+
|
1981
|
+
header_params = {
|
1982
|
+
"resource" => request.resource
|
1983
|
+
}
|
1984
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1985
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1986
|
+
|
1987
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
1988
|
+
metadata: metadata,
|
1989
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
1990
|
+
options.apply_defaults metadata: @config.metadata,
|
1991
|
+
retry_policy: @config.retry_policy
|
1992
|
+
|
1993
|
+
@security_center_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
1994
|
+
yield response, operation if block_given?
|
1995
|
+
return response
|
1996
|
+
end
|
1997
|
+
rescue GRPC::BadStatus => e
|
1998
|
+
raise Google::Cloud::Error.from_error(e)
|
1999
|
+
end
|
2000
|
+
|
2001
|
+
##
|
2002
|
+
# Creates or updates a finding. The corresponding source must exist for a
|
2003
|
+
# finding creation to succeed.
|
2004
|
+
#
|
2005
|
+
# @overload update_finding(request, options = nil)
|
2006
|
+
# Pass arguments to `update_finding` via a request object, either of type
|
2007
|
+
# {Google::Cloud::SecurityCenter::V1::UpdateFindingRequest} or an equivalent Hash.
|
2008
|
+
#
|
2009
|
+
# @param request [Google::Cloud::SecurityCenter::V1::UpdateFindingRequest, Hash]
|
2010
|
+
# A request object representing the call parameters. Required. To specify no
|
2011
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2012
|
+
# @param options [Gapic::CallOptions, Hash]
|
2013
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2014
|
+
#
|
2015
|
+
# @overload update_finding(finding: nil, update_mask: nil)
|
2016
|
+
# Pass arguments to `update_finding` via keyword arguments. Note that at
|
2017
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2018
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2019
|
+
#
|
2020
|
+
# @param finding [Google::Cloud::SecurityCenter::V1::Finding, Hash]
|
2021
|
+
# Required. The finding resource to update or create if it does not already
|
2022
|
+
# exist. parent, security_marks, and update_time will be ignored.
|
2023
|
+
#
|
2024
|
+
# In the case of creation, the finding id portion of the name must be
|
2025
|
+
# alphanumeric and less than or equal to 32 characters and greater than 0
|
2026
|
+
# characters in length.
|
2027
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
2028
|
+
# The FieldMask to use when updating the finding resource. This field should
|
2029
|
+
# not be specified when creating a finding.
|
2030
|
+
#
|
2031
|
+
# When updating a finding, an empty mask is treated as updating all mutable
|
2032
|
+
# fields and replacing source_properties. Individual source_properties can
|
2033
|
+
# be added/updated by using "source_properties.<property key>" in the field
|
2034
|
+
# mask.
|
2035
|
+
#
|
2036
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2037
|
+
# @yieldparam response [Google::Cloud::SecurityCenter::V1::Finding]
|
2038
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
2039
|
+
#
|
2040
|
+
# @return [Google::Cloud::SecurityCenter::V1::Finding]
|
2041
|
+
#
|
2042
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
2043
|
+
#
|
2044
|
+
def update_finding request, options = nil
|
2045
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
2046
|
+
|
2047
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::UpdateFindingRequest
|
2048
|
+
|
2049
|
+
# Converts hash and nil to an options object
|
2050
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2051
|
+
|
2052
|
+
# Customize the options with defaults
|
2053
|
+
metadata = @config.rpcs.update_finding.metadata.to_h
|
2054
|
+
|
2055
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2056
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
2057
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2058
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
2059
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2060
|
+
|
2061
|
+
header_params = {
|
2062
|
+
"finding.name" => request.finding.name
|
2063
|
+
}
|
2064
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2065
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2066
|
+
|
2067
|
+
options.apply_defaults timeout: @config.rpcs.update_finding.timeout,
|
2068
|
+
metadata: metadata,
|
2069
|
+
retry_policy: @config.rpcs.update_finding.retry_policy
|
2070
|
+
options.apply_defaults metadata: @config.metadata,
|
2071
|
+
retry_policy: @config.retry_policy
|
2072
|
+
|
2073
|
+
@security_center_stub.call_rpc :update_finding, request, options: options do |response, operation|
|
2074
|
+
yield response, operation if block_given?
|
2075
|
+
return response
|
2076
|
+
end
|
2077
|
+
rescue GRPC::BadStatus => e
|
2078
|
+
raise Google::Cloud::Error.from_error(e)
|
2079
|
+
end
|
2080
|
+
|
2081
|
+
##
|
2082
|
+
# Updates a notification config.
|
2083
|
+
#
|
2084
|
+
# @overload update_notification_config(request, options = nil)
|
2085
|
+
# Pass arguments to `update_notification_config` via a request object, either of type
|
2086
|
+
# {Google::Cloud::SecurityCenter::V1::UpdateNotificationConfigRequest} or an equivalent Hash.
|
2087
|
+
#
|
2088
|
+
# @param request [Google::Cloud::SecurityCenter::V1::UpdateNotificationConfigRequest, Hash]
|
2089
|
+
# A request object representing the call parameters. Required. To specify no
|
2090
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2091
|
+
# @param options [Gapic::CallOptions, Hash]
|
2092
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2093
|
+
#
|
2094
|
+
# @overload update_notification_config(notification_config: nil, update_mask: nil)
|
2095
|
+
# Pass arguments to `update_notification_config` via keyword arguments. Note that at
|
2096
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2097
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2098
|
+
#
|
2099
|
+
# @param notification_config [Google::Cloud::SecurityCenter::V1::NotificationConfig, Hash]
|
2100
|
+
# Required. The notification config to update.
|
2101
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
2102
|
+
# The FieldMask to use when updating the notification config.
|
2103
|
+
#
|
2104
|
+
# If empty all mutable fields will be updated.
|
2105
|
+
#
|
2106
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2107
|
+
# @yieldparam response [Google::Cloud::SecurityCenter::V1::NotificationConfig]
|
2108
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
2109
|
+
#
|
2110
|
+
# @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
|
2111
|
+
#
|
2112
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
2113
|
+
#
|
2114
|
+
def update_notification_config request, options = nil
|
2115
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
2116
|
+
|
2117
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::UpdateNotificationConfigRequest
|
2118
|
+
|
2119
|
+
# Converts hash and nil to an options object
|
2120
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2121
|
+
|
2122
|
+
# Customize the options with defaults
|
2123
|
+
metadata = @config.rpcs.update_notification_config.metadata.to_h
|
2124
|
+
|
2125
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2126
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
2127
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2128
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
2129
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2130
|
+
|
2131
|
+
header_params = {
|
2132
|
+
"notification_config.name" => request.notification_config.name
|
2133
|
+
}
|
2134
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2135
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2136
|
+
|
2137
|
+
options.apply_defaults timeout: @config.rpcs.update_notification_config.timeout,
|
2138
|
+
metadata: metadata,
|
2139
|
+
retry_policy: @config.rpcs.update_notification_config.retry_policy
|
2140
|
+
options.apply_defaults metadata: @config.metadata,
|
2141
|
+
retry_policy: @config.retry_policy
|
2142
|
+
|
2143
|
+
@security_center_stub.call_rpc :update_notification_config, request, options: options do |response, operation|
|
2144
|
+
yield response, operation if block_given?
|
2145
|
+
return response
|
2146
|
+
end
|
2147
|
+
rescue GRPC::BadStatus => e
|
2148
|
+
raise Google::Cloud::Error.from_error(e)
|
2149
|
+
end
|
2150
|
+
|
2151
|
+
##
|
2152
|
+
# Updates an organization's settings.
|
2153
|
+
#
|
2154
|
+
# @overload update_organization_settings(request, options = nil)
|
2155
|
+
# Pass arguments to `update_organization_settings` via a request object, either of type
|
2156
|
+
# {Google::Cloud::SecurityCenter::V1::UpdateOrganizationSettingsRequest} or an equivalent Hash.
|
2157
|
+
#
|
2158
|
+
# @param request [Google::Cloud::SecurityCenter::V1::UpdateOrganizationSettingsRequest, Hash]
|
2159
|
+
# A request object representing the call parameters. Required. To specify no
|
2160
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2161
|
+
# @param options [Gapic::CallOptions, Hash]
|
2162
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2163
|
+
#
|
2164
|
+
# @overload update_organization_settings(organization_settings: nil, update_mask: nil)
|
2165
|
+
# Pass arguments to `update_organization_settings` via keyword arguments. Note that at
|
2166
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2167
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2168
|
+
#
|
2169
|
+
# @param organization_settings [Google::Cloud::SecurityCenter::V1::OrganizationSettings, Hash]
|
2170
|
+
# Required. The organization settings resource to update.
|
2171
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
2172
|
+
# The FieldMask to use when updating the settings resource.
|
2173
|
+
#
|
2174
|
+
# If empty all mutable fields will be updated.
|
2175
|
+
#
|
2176
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2177
|
+
# @yieldparam response [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
|
2178
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
2179
|
+
#
|
2180
|
+
# @return [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
|
2181
|
+
#
|
2182
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
2183
|
+
#
|
2184
|
+
def update_organization_settings request, options = nil
|
2185
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
2186
|
+
|
2187
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::UpdateOrganizationSettingsRequest
|
2188
|
+
|
2189
|
+
# Converts hash and nil to an options object
|
2190
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2191
|
+
|
2192
|
+
# Customize the options with defaults
|
2193
|
+
metadata = @config.rpcs.update_organization_settings.metadata.to_h
|
2194
|
+
|
2195
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2196
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
2197
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2198
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
2199
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2200
|
+
|
2201
|
+
header_params = {
|
2202
|
+
"organization_settings.name" => request.organization_settings.name
|
2203
|
+
}
|
2204
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2205
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2206
|
+
|
2207
|
+
options.apply_defaults timeout: @config.rpcs.update_organization_settings.timeout,
|
2208
|
+
metadata: metadata,
|
2209
|
+
retry_policy: @config.rpcs.update_organization_settings.retry_policy
|
2210
|
+
options.apply_defaults metadata: @config.metadata,
|
2211
|
+
retry_policy: @config.retry_policy
|
2212
|
+
|
2213
|
+
@security_center_stub.call_rpc :update_organization_settings, request, options: options do |response, operation|
|
2214
|
+
yield response, operation if block_given?
|
2215
|
+
return response
|
2216
|
+
end
|
2217
|
+
rescue GRPC::BadStatus => e
|
2218
|
+
raise Google::Cloud::Error.from_error(e)
|
2219
|
+
end
|
2220
|
+
|
2221
|
+
##
|
2222
|
+
# Updates a source.
|
2223
|
+
#
|
2224
|
+
# @overload update_source(request, options = nil)
|
2225
|
+
# Pass arguments to `update_source` via a request object, either of type
|
2226
|
+
# {Google::Cloud::SecurityCenter::V1::UpdateSourceRequest} or an equivalent Hash.
|
2227
|
+
#
|
2228
|
+
# @param request [Google::Cloud::SecurityCenter::V1::UpdateSourceRequest, Hash]
|
2229
|
+
# A request object representing the call parameters. Required. To specify no
|
2230
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2231
|
+
# @param options [Gapic::CallOptions, Hash]
|
2232
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2233
|
+
#
|
2234
|
+
# @overload update_source(source: nil, update_mask: nil)
|
2235
|
+
# Pass arguments to `update_source` via keyword arguments. Note that at
|
2236
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2237
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2238
|
+
#
|
2239
|
+
# @param source [Google::Cloud::SecurityCenter::V1::Source, Hash]
|
2240
|
+
# Required. The source resource to update.
|
2241
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
2242
|
+
# The FieldMask to use when updating the source resource.
|
2243
|
+
#
|
2244
|
+
# If empty all mutable fields will be updated.
|
2245
|
+
#
|
2246
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2247
|
+
# @yieldparam response [Google::Cloud::SecurityCenter::V1::Source]
|
2248
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
2249
|
+
#
|
2250
|
+
# @return [Google::Cloud::SecurityCenter::V1::Source]
|
2251
|
+
#
|
2252
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
2253
|
+
#
|
2254
|
+
def update_source request, options = nil
|
2255
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
2256
|
+
|
2257
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::UpdateSourceRequest
|
2258
|
+
|
2259
|
+
# Converts hash and nil to an options object
|
2260
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2261
|
+
|
2262
|
+
# Customize the options with defaults
|
2263
|
+
metadata = @config.rpcs.update_source.metadata.to_h
|
2264
|
+
|
2265
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2266
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
2267
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2268
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
2269
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2270
|
+
|
2271
|
+
header_params = {
|
2272
|
+
"source.name" => request.source.name
|
2273
|
+
}
|
2274
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2275
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2276
|
+
|
2277
|
+
options.apply_defaults timeout: @config.rpcs.update_source.timeout,
|
2278
|
+
metadata: metadata,
|
2279
|
+
retry_policy: @config.rpcs.update_source.retry_policy
|
2280
|
+
options.apply_defaults metadata: @config.metadata,
|
2281
|
+
retry_policy: @config.retry_policy
|
2282
|
+
|
2283
|
+
@security_center_stub.call_rpc :update_source, request, options: options do |response, operation|
|
2284
|
+
yield response, operation if block_given?
|
2285
|
+
return response
|
2286
|
+
end
|
2287
|
+
rescue GRPC::BadStatus => e
|
2288
|
+
raise Google::Cloud::Error.from_error(e)
|
2289
|
+
end
|
2290
|
+
|
2291
|
+
##
|
2292
|
+
# Updates security marks.
|
2293
|
+
#
|
2294
|
+
# @overload update_security_marks(request, options = nil)
|
2295
|
+
# Pass arguments to `update_security_marks` via a request object, either of type
|
2296
|
+
# {Google::Cloud::SecurityCenter::V1::UpdateSecurityMarksRequest} or an equivalent Hash.
|
2297
|
+
#
|
2298
|
+
# @param request [Google::Cloud::SecurityCenter::V1::UpdateSecurityMarksRequest, Hash]
|
2299
|
+
# A request object representing the call parameters. Required. To specify no
|
2300
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2301
|
+
# @param options [Gapic::CallOptions, Hash]
|
2302
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2303
|
+
#
|
2304
|
+
# @overload update_security_marks(security_marks: nil, update_mask: nil, start_time: nil)
|
2305
|
+
# Pass arguments to `update_security_marks` via keyword arguments. Note that at
|
2306
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2307
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2308
|
+
#
|
2309
|
+
# @param security_marks [Google::Cloud::SecurityCenter::V1::SecurityMarks, Hash]
|
2310
|
+
# Required. The security marks resource to update.
|
2311
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
2312
|
+
# The FieldMask to use when updating the security marks resource.
|
2313
|
+
#
|
2314
|
+
# The field mask must not contain duplicate fields.
|
2315
|
+
# If empty or set to "marks", all marks will be replaced. Individual
|
2316
|
+
# marks can be updated using "marks.<mark_key>".
|
2317
|
+
# @param start_time [Google::Protobuf::Timestamp, Hash]
|
2318
|
+
# The time at which the updated SecurityMarks take effect.
|
2319
|
+
# If not set uses current server time. Updates will be applied to the
|
2320
|
+
# SecurityMarks that are active immediately preceding this time.
|
2321
|
+
#
|
2322
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2323
|
+
# @yieldparam response [Google::Cloud::SecurityCenter::V1::SecurityMarks]
|
2324
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
2325
|
+
#
|
2326
|
+
# @return [Google::Cloud::SecurityCenter::V1::SecurityMarks]
|
2327
|
+
#
|
2328
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
2329
|
+
#
|
2330
|
+
def update_security_marks request, options = nil
|
2331
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
2332
|
+
|
2333
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecurityCenter::V1::UpdateSecurityMarksRequest
|
2334
|
+
|
2335
|
+
# Converts hash and nil to an options object
|
2336
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2337
|
+
|
2338
|
+
# Customize the options with defaults
|
2339
|
+
metadata = @config.rpcs.update_security_marks.metadata.to_h
|
2340
|
+
|
2341
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2342
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
2343
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2344
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
|
2345
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2346
|
+
|
2347
|
+
header_params = {
|
2348
|
+
"security_marks.name" => request.security_marks.name
|
2349
|
+
}
|
2350
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2351
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2352
|
+
|
2353
|
+
options.apply_defaults timeout: @config.rpcs.update_security_marks.timeout,
|
2354
|
+
metadata: metadata,
|
2355
|
+
retry_policy: @config.rpcs.update_security_marks.retry_policy
|
2356
|
+
options.apply_defaults metadata: @config.metadata,
|
2357
|
+
retry_policy: @config.retry_policy
|
2358
|
+
|
2359
|
+
@security_center_stub.call_rpc :update_security_marks, request, options: options do |response, operation|
|
2360
|
+
yield response, operation if block_given?
|
2361
|
+
return response
|
2362
|
+
end
|
2363
|
+
rescue GRPC::BadStatus => e
|
2364
|
+
raise Google::Cloud::Error.from_error(e)
|
2365
|
+
end
|
2366
|
+
|
2367
|
+
##
|
2368
|
+
# Configuration class for the SecurityCenter API.
|
2369
|
+
#
|
2370
|
+
# This class represents the configuration for SecurityCenter,
|
2371
|
+
# providing control over timeouts, retry behavior, logging, transport
|
2372
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
2373
|
+
# applied individually to specific RPCs. See
|
2374
|
+
# {Google::Cloud::SecurityCenter::V1::SecurityCenter::Client::Configuration::Rpcs}
|
2375
|
+
# for a list of RPCs that can be configured independently.
|
2376
|
+
#
|
2377
|
+
# Configuration can be applied globally to all clients, or to a single client
|
2378
|
+
# on construction.
|
2379
|
+
#
|
2380
|
+
# # Examples
|
2381
|
+
#
|
2382
|
+
# To modify the global config, setting the timeout for create_source
|
2383
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
2384
|
+
#
|
2385
|
+
# Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
|
2386
|
+
# config.timeout = 10_000
|
2387
|
+
# config.rpcs.create_source.timeout = 20_000
|
2388
|
+
# end
|
2389
|
+
#
|
2390
|
+
# To apply the above configuration only to a new client:
|
2391
|
+
#
|
2392
|
+
# client = Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new do |config|
|
2393
|
+
# config.timeout = 10_000
|
2394
|
+
# config.rpcs.create_source.timeout = 20_000
|
2395
|
+
# end
|
2396
|
+
#
|
2397
|
+
# @!attribute [rw] endpoint
|
2398
|
+
# The hostname or hostname:port of the service endpoint.
|
2399
|
+
# Defaults to `"securitycenter.googleapis.com"`.
|
2400
|
+
# @return [String]
|
2401
|
+
# @!attribute [rw] credentials
|
2402
|
+
# Credentials to send with calls. You may provide any of the following types:
|
2403
|
+
# * (`String`) The path to a service account key file in JSON format
|
2404
|
+
# * (`Hash`) A service account key as a Hash
|
2405
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
2406
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
2407
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
2408
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
2409
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
2410
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
2411
|
+
# * (`nil`) indicating no credentials
|
2412
|
+
# @return [Object]
|
2413
|
+
# @!attribute [rw] scope
|
2414
|
+
# The OAuth scopes
|
2415
|
+
# @return [Array<String>]
|
2416
|
+
# @!attribute [rw] lib_name
|
2417
|
+
# The library name as recorded in instrumentation and logging
|
2418
|
+
# @return [String]
|
2419
|
+
# @!attribute [rw] lib_version
|
2420
|
+
# The library version as recorded in instrumentation and logging
|
2421
|
+
# @return [String]
|
2422
|
+
# @!attribute [rw] channel_args
|
2423
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
2424
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
2425
|
+
# @return [Hash]
|
2426
|
+
# @!attribute [rw] interceptors
|
2427
|
+
# An array of interceptors that are run before calls are executed.
|
2428
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
2429
|
+
# @!attribute [rw] timeout
|
2430
|
+
# The call timeout in milliseconds.
|
2431
|
+
# @return [Numeric]
|
2432
|
+
# @!attribute [rw] metadata
|
2433
|
+
# Additional gRPC headers to be sent with the call.
|
2434
|
+
# @return [Hash{Symbol=>String}]
|
2435
|
+
# @!attribute [rw] retry_policy
|
2436
|
+
# The retry policy. The value is a hash with the following keys:
|
2437
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2438
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2439
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2440
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2441
|
+
# trigger a retry.
|
2442
|
+
# @return [Hash]
|
2443
|
+
#
|
2444
|
+
class Configuration
|
2445
|
+
extend Gapic::Config
|
2446
|
+
|
2447
|
+
config_attr :endpoint, "securitycenter.googleapis.com", String
|
2448
|
+
config_attr :credentials, nil do |value|
|
2449
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
2450
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
2451
|
+
allowed.any? { |klass| klass === value }
|
2452
|
+
end
|
2453
|
+
config_attr :scope, nil, String, Array, nil
|
2454
|
+
config_attr :lib_name, nil, String, nil
|
2455
|
+
config_attr :lib_version, nil, String, nil
|
2456
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
2457
|
+
config_attr :interceptors, nil, Array, nil
|
2458
|
+
config_attr :timeout, nil, Numeric, nil
|
2459
|
+
config_attr :metadata, nil, Hash, nil
|
2460
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
2461
|
+
|
2462
|
+
# @private
|
2463
|
+
def initialize parent_config = nil
|
2464
|
+
@parent_config = parent_config unless parent_config.nil?
|
2465
|
+
|
2466
|
+
yield self if block_given?
|
2467
|
+
end
|
2468
|
+
|
2469
|
+
##
|
2470
|
+
# Configurations for individual RPCs
|
2471
|
+
# @return [Rpcs]
|
2472
|
+
#
|
2473
|
+
def rpcs
|
2474
|
+
@rpcs ||= begin
|
2475
|
+
parent_rpcs = nil
|
2476
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
2477
|
+
Rpcs.new parent_rpcs
|
2478
|
+
end
|
2479
|
+
end
|
2480
|
+
|
2481
|
+
##
|
2482
|
+
# Configuration RPC class for the SecurityCenter API.
|
2483
|
+
#
|
2484
|
+
# Includes fields providing the configuration for each RPC in this service.
|
2485
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
2486
|
+
# the following configuration fields:
|
2487
|
+
#
|
2488
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
2489
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
2490
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
2491
|
+
# include the following keys:
|
2492
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2493
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2494
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2495
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2496
|
+
# trigger a retry.
|
2497
|
+
#
|
2498
|
+
class Rpcs
|
2499
|
+
##
|
2500
|
+
# RPC-specific configuration for `create_source`
|
2501
|
+
# @return [Gapic::Config::Method]
|
2502
|
+
#
|
2503
|
+
attr_reader :create_source
|
2504
|
+
##
|
2505
|
+
# RPC-specific configuration for `create_finding`
|
2506
|
+
# @return [Gapic::Config::Method]
|
2507
|
+
#
|
2508
|
+
attr_reader :create_finding
|
2509
|
+
##
|
2510
|
+
# RPC-specific configuration for `create_notification_config`
|
2511
|
+
# @return [Gapic::Config::Method]
|
2512
|
+
#
|
2513
|
+
attr_reader :create_notification_config
|
2514
|
+
##
|
2515
|
+
# RPC-specific configuration for `delete_notification_config`
|
2516
|
+
# @return [Gapic::Config::Method]
|
2517
|
+
#
|
2518
|
+
attr_reader :delete_notification_config
|
2519
|
+
##
|
2520
|
+
# RPC-specific configuration for `get_iam_policy`
|
2521
|
+
# @return [Gapic::Config::Method]
|
2522
|
+
#
|
2523
|
+
attr_reader :get_iam_policy
|
2524
|
+
##
|
2525
|
+
# RPC-specific configuration for `get_notification_config`
|
2526
|
+
# @return [Gapic::Config::Method]
|
2527
|
+
#
|
2528
|
+
attr_reader :get_notification_config
|
2529
|
+
##
|
2530
|
+
# RPC-specific configuration for `get_organization_settings`
|
2531
|
+
# @return [Gapic::Config::Method]
|
2532
|
+
#
|
2533
|
+
attr_reader :get_organization_settings
|
2534
|
+
##
|
2535
|
+
# RPC-specific configuration for `get_source`
|
2536
|
+
# @return [Gapic::Config::Method]
|
2537
|
+
#
|
2538
|
+
attr_reader :get_source
|
2539
|
+
##
|
2540
|
+
# RPC-specific configuration for `group_assets`
|
2541
|
+
# @return [Gapic::Config::Method]
|
2542
|
+
#
|
2543
|
+
attr_reader :group_assets
|
2544
|
+
##
|
2545
|
+
# RPC-specific configuration for `group_findings`
|
2546
|
+
# @return [Gapic::Config::Method]
|
2547
|
+
#
|
2548
|
+
attr_reader :group_findings
|
2549
|
+
##
|
2550
|
+
# RPC-specific configuration for `list_assets`
|
2551
|
+
# @return [Gapic::Config::Method]
|
2552
|
+
#
|
2553
|
+
attr_reader :list_assets
|
2554
|
+
##
|
2555
|
+
# RPC-specific configuration for `list_findings`
|
2556
|
+
# @return [Gapic::Config::Method]
|
2557
|
+
#
|
2558
|
+
attr_reader :list_findings
|
2559
|
+
##
|
2560
|
+
# RPC-specific configuration for `list_notification_configs`
|
2561
|
+
# @return [Gapic::Config::Method]
|
2562
|
+
#
|
2563
|
+
attr_reader :list_notification_configs
|
2564
|
+
##
|
2565
|
+
# RPC-specific configuration for `list_sources`
|
2566
|
+
# @return [Gapic::Config::Method]
|
2567
|
+
#
|
2568
|
+
attr_reader :list_sources
|
2569
|
+
##
|
2570
|
+
# RPC-specific configuration for `run_asset_discovery`
|
2571
|
+
# @return [Gapic::Config::Method]
|
2572
|
+
#
|
2573
|
+
attr_reader :run_asset_discovery
|
2574
|
+
##
|
2575
|
+
# RPC-specific configuration for `set_finding_state`
|
2576
|
+
# @return [Gapic::Config::Method]
|
2577
|
+
#
|
2578
|
+
attr_reader :set_finding_state
|
2579
|
+
##
|
2580
|
+
# RPC-specific configuration for `set_iam_policy`
|
2581
|
+
# @return [Gapic::Config::Method]
|
2582
|
+
#
|
2583
|
+
attr_reader :set_iam_policy
|
2584
|
+
##
|
2585
|
+
# RPC-specific configuration for `test_iam_permissions`
|
2586
|
+
# @return [Gapic::Config::Method]
|
2587
|
+
#
|
2588
|
+
attr_reader :test_iam_permissions
|
2589
|
+
##
|
2590
|
+
# RPC-specific configuration for `update_finding`
|
2591
|
+
# @return [Gapic::Config::Method]
|
2592
|
+
#
|
2593
|
+
attr_reader :update_finding
|
2594
|
+
##
|
2595
|
+
# RPC-specific configuration for `update_notification_config`
|
2596
|
+
# @return [Gapic::Config::Method]
|
2597
|
+
#
|
2598
|
+
attr_reader :update_notification_config
|
2599
|
+
##
|
2600
|
+
# RPC-specific configuration for `update_organization_settings`
|
2601
|
+
# @return [Gapic::Config::Method]
|
2602
|
+
#
|
2603
|
+
attr_reader :update_organization_settings
|
2604
|
+
##
|
2605
|
+
# RPC-specific configuration for `update_source`
|
2606
|
+
# @return [Gapic::Config::Method]
|
2607
|
+
#
|
2608
|
+
attr_reader :update_source
|
2609
|
+
##
|
2610
|
+
# RPC-specific configuration for `update_security_marks`
|
2611
|
+
# @return [Gapic::Config::Method]
|
2612
|
+
#
|
2613
|
+
attr_reader :update_security_marks
|
2614
|
+
|
2615
|
+
# @private
|
2616
|
+
def initialize parent_rpcs = nil
|
2617
|
+
create_source_config = parent_rpcs&.create_source if parent_rpcs&.respond_to? :create_source
|
2618
|
+
@create_source = Gapic::Config::Method.new create_source_config
|
2619
|
+
create_finding_config = parent_rpcs&.create_finding if parent_rpcs&.respond_to? :create_finding
|
2620
|
+
@create_finding = Gapic::Config::Method.new create_finding_config
|
2621
|
+
create_notification_config_config = parent_rpcs&.create_notification_config if parent_rpcs&.respond_to? :create_notification_config
|
2622
|
+
@create_notification_config = Gapic::Config::Method.new create_notification_config_config
|
2623
|
+
delete_notification_config_config = parent_rpcs&.delete_notification_config if parent_rpcs&.respond_to? :delete_notification_config
|
2624
|
+
@delete_notification_config = Gapic::Config::Method.new delete_notification_config_config
|
2625
|
+
get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
|
2626
|
+
@get_iam_policy = Gapic::Config::Method.new get_iam_policy_config
|
2627
|
+
get_notification_config_config = parent_rpcs&.get_notification_config if parent_rpcs&.respond_to? :get_notification_config
|
2628
|
+
@get_notification_config = Gapic::Config::Method.new get_notification_config_config
|
2629
|
+
get_organization_settings_config = parent_rpcs&.get_organization_settings if parent_rpcs&.respond_to? :get_organization_settings
|
2630
|
+
@get_organization_settings = Gapic::Config::Method.new get_organization_settings_config
|
2631
|
+
get_source_config = parent_rpcs&.get_source if parent_rpcs&.respond_to? :get_source
|
2632
|
+
@get_source = Gapic::Config::Method.new get_source_config
|
2633
|
+
group_assets_config = parent_rpcs&.group_assets if parent_rpcs&.respond_to? :group_assets
|
2634
|
+
@group_assets = Gapic::Config::Method.new group_assets_config
|
2635
|
+
group_findings_config = parent_rpcs&.group_findings if parent_rpcs&.respond_to? :group_findings
|
2636
|
+
@group_findings = Gapic::Config::Method.new group_findings_config
|
2637
|
+
list_assets_config = parent_rpcs&.list_assets if parent_rpcs&.respond_to? :list_assets
|
2638
|
+
@list_assets = Gapic::Config::Method.new list_assets_config
|
2639
|
+
list_findings_config = parent_rpcs&.list_findings if parent_rpcs&.respond_to? :list_findings
|
2640
|
+
@list_findings = Gapic::Config::Method.new list_findings_config
|
2641
|
+
list_notification_configs_config = parent_rpcs&.list_notification_configs if parent_rpcs&.respond_to? :list_notification_configs
|
2642
|
+
@list_notification_configs = Gapic::Config::Method.new list_notification_configs_config
|
2643
|
+
list_sources_config = parent_rpcs&.list_sources if parent_rpcs&.respond_to? :list_sources
|
2644
|
+
@list_sources = Gapic::Config::Method.new list_sources_config
|
2645
|
+
run_asset_discovery_config = parent_rpcs&.run_asset_discovery if parent_rpcs&.respond_to? :run_asset_discovery
|
2646
|
+
@run_asset_discovery = Gapic::Config::Method.new run_asset_discovery_config
|
2647
|
+
set_finding_state_config = parent_rpcs&.set_finding_state if parent_rpcs&.respond_to? :set_finding_state
|
2648
|
+
@set_finding_state = Gapic::Config::Method.new set_finding_state_config
|
2649
|
+
set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
|
2650
|
+
@set_iam_policy = Gapic::Config::Method.new set_iam_policy_config
|
2651
|
+
test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
|
2652
|
+
@test_iam_permissions = Gapic::Config::Method.new test_iam_permissions_config
|
2653
|
+
update_finding_config = parent_rpcs&.update_finding if parent_rpcs&.respond_to? :update_finding
|
2654
|
+
@update_finding = Gapic::Config::Method.new update_finding_config
|
2655
|
+
update_notification_config_config = parent_rpcs&.update_notification_config if parent_rpcs&.respond_to? :update_notification_config
|
2656
|
+
@update_notification_config = Gapic::Config::Method.new update_notification_config_config
|
2657
|
+
update_organization_settings_config = parent_rpcs&.update_organization_settings if parent_rpcs&.respond_to? :update_organization_settings
|
2658
|
+
@update_organization_settings = Gapic::Config::Method.new update_organization_settings_config
|
2659
|
+
update_source_config = parent_rpcs&.update_source if parent_rpcs&.respond_to? :update_source
|
2660
|
+
@update_source = Gapic::Config::Method.new update_source_config
|
2661
|
+
update_security_marks_config = parent_rpcs&.update_security_marks if parent_rpcs&.respond_to? :update_security_marks
|
2662
|
+
@update_security_marks = Gapic::Config::Method.new update_security_marks_config
|
2663
|
+
|
2664
|
+
yield self if block_given?
|
2665
|
+
end
|
2666
|
+
end
|
2667
|
+
end
|
2668
|
+
end
|
2669
|
+
end
|
2670
|
+
end
|
2671
|
+
end
|
2672
|
+
end
|
2673
|
+
end
|