google-cloud-security_center-v1p1beta1 0.6.0 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/security_center/v1p1beta1/security_center/client.rb +131 -114
  5. data/lib/google/cloud/security_center/v1p1beta1/security_center/operations.rb +34 -25
  6. data/lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb +174 -16
  7. data/lib/google/cloud/security_center/v1p1beta1/version.rb +1 -1
  8. data/lib/google/cloud/securitycenter/v1p1beta1/asset_pb.rb +4 -1
  9. data/lib/google/cloud/securitycenter/v1p1beta1/finding_pb.rb +2 -1
  10. data/lib/google/cloud/securitycenter/v1p1beta1/folder_pb.rb +24 -0
  11. data/lib/google/cloud/securitycenter/v1p1beta1/notification_config_pb.rb +1 -1
  12. data/lib/google/cloud/securitycenter/v1p1beta1/notification_message_pb.rb +1 -2
  13. data/lib/google/cloud/securitycenter/v1p1beta1/organization_settings_pb.rb +2 -1
  14. data/lib/google/cloud/securitycenter/v1p1beta1/resource_pb.rb +3 -0
  15. data/lib/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response_pb.rb +1 -1
  16. data/lib/google/cloud/securitycenter/v1p1beta1/security_marks_pb.rb +2 -1
  17. data/lib/google/cloud/securitycenter/v1p1beta1/securitycenter_service_pb.rb +2 -0
  18. data/lib/google/cloud/securitycenter/v1p1beta1/securitycenter_service_services_pb.rb +3 -1
  19. data/lib/google/cloud/securitycenter/v1p1beta1/source_pb.rb +2 -1
  20. data/proto_docs/google/api/field_behavior.rb +7 -1
  21. data/proto_docs/google/cloud/securitycenter/v1p1beta1/asset.rb +13 -2
  22. data/proto_docs/google/cloud/securitycenter/v1p1beta1/finding.rb +10 -1
  23. data/proto_docs/google/cloud/securitycenter/v1p1beta1/folder.rb +40 -0
  24. data/proto_docs/google/cloud/securitycenter/v1p1beta1/organization_settings.rb +4 -0
  25. data/proto_docs/google/cloud/securitycenter/v1p1beta1/resource.rb +5 -0
  26. data/proto_docs/google/cloud/securitycenter/v1p1beta1/security_marks.rb +10 -0
  27. data/proto_docs/google/cloud/securitycenter/v1p1beta1/securitycenter_service.rb +23 -9
  28. data/proto_docs/google/cloud/securitycenter/v1p1beta1/source.rb +8 -0
  29. data/proto_docs/google/type/expr.rb +35 -12
  30. metadata +17 -9
@@ -82,7 +82,7 @@ module Google
82
82
  # Create credentials
83
83
  credentials = @config.credentials
84
84
  credentials ||= Credentials.default scope: @config.scope
85
- if credentials.is_a?(String) || credentials.is_a?(Hash)
85
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
86
86
  credentials = Credentials.new credentials, scope: @config.scope
87
87
  end
88
88
  @quota_project_id = @config.quota_project
@@ -169,7 +169,9 @@ module Google
169
169
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
170
170
  metadata: metadata,
171
171
  retry_policy: @config.rpcs.list_operations.retry_policy
172
- options.apply_defaults metadata: @config.metadata,
172
+
173
+ options.apply_defaults timeout: @config.timeout,
174
+ metadata: @config.metadata,
173
175
  retry_policy: @config.retry_policy
174
176
 
175
177
  @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
@@ -239,7 +241,9 @@ module Google
239
241
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
240
242
  metadata: metadata,
241
243
  retry_policy: @config.rpcs.get_operation.retry_policy
242
- options.apply_defaults metadata: @config.metadata,
244
+
245
+ options.apply_defaults timeout: @config.timeout,
246
+ metadata: @config.metadata,
243
247
  retry_policy: @config.retry_policy
244
248
 
245
249
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
@@ -309,7 +313,9 @@ module Google
309
313
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
310
314
  metadata: metadata,
311
315
  retry_policy: @config.rpcs.delete_operation.retry_policy
312
- options.apply_defaults metadata: @config.metadata,
316
+
317
+ options.apply_defaults timeout: @config.timeout,
318
+ metadata: @config.metadata,
313
319
  retry_policy: @config.retry_policy
314
320
 
315
321
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
@@ -384,7 +390,9 @@ module Google
384
390
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
385
391
  metadata: metadata,
386
392
  retry_policy: @config.rpcs.cancel_operation.retry_policy
387
- options.apply_defaults metadata: @config.metadata,
393
+
394
+ options.apply_defaults timeout: @config.timeout,
395
+ metadata: @config.metadata,
388
396
  retry_policy: @config.retry_policy
389
397
 
390
398
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
@@ -396,9 +404,9 @@ module Google
396
404
  end
397
405
 
398
406
  ##
399
- # Waits for the specified long-running operation until it is done or reaches
400
- # at most a specified timeout, returning the latest state. If the operation
401
- # is already done, the latest state is immediately returned. If the timeout
407
+ # Waits until the specified long-running operation is done or reaches at most
408
+ # a specified timeout, returning the latest state. If the operation is
409
+ # already done, the latest state is immediately returned. If the timeout
402
410
  # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
411
  # timeout is used. If the server does not support this method, it returns
404
412
  # `google.rpc.Code.UNIMPLEMENTED`.
@@ -456,7 +464,9 @@ module Google
456
464
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
465
  metadata: metadata,
458
466
  retry_policy: @config.rpcs.wait_operation.retry_policy
459
- options.apply_defaults metadata: @config.metadata,
467
+
468
+ options.apply_defaults timeout: @config.timeout,
469
+ metadata: @config.metadata,
460
470
  retry_policy: @config.retry_policy
461
471
 
462
472
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
@@ -481,22 +491,21 @@ module Google
481
491
  # Configuration can be applied globally to all clients, or to a single client
482
492
  # on construction.
483
493
  #
484
- # # Examples
485
- #
486
- # To modify the global config, setting the timeout for list_operations
487
- # to 20 seconds, and all remaining timeouts to 10 seconds:
488
- #
489
- # ::Google::Longrunning::Operations::Client.configure do |config|
490
- # config.timeout = 10.0
491
- # config.rpcs.list_operations.timeout = 20.0
492
- # end
493
- #
494
- # To apply the above configuration only to a new client:
495
- #
496
- # client = ::Google::Longrunning::Operations::Client.new do |config|
497
- # config.timeout = 10.0
498
- # config.rpcs.list_operations.timeout = 20.0
499
- # end
494
+ # @example
495
+ #
496
+ # # Modify the global config, setting the timeout for
497
+ # # list_operations to 20 seconds,
498
+ # # and all remaining timeouts to 10 seconds.
499
+ # ::Google::Longrunning::Operations::Client.configure do |config|
500
+ # config.timeout = 10.0
501
+ # config.rpcs.list_operations.timeout = 20.0
502
+ # end
503
+ #
504
+ # # Apply the above configuration only to a new client.
505
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
506
+ # config.timeout = 10.0
507
+ # config.rpcs.list_operations.timeout = 20.0
508
+ # end
500
509
  #
501
510
  # @!attribute [rw] endpoint
502
511
  # The hostname or hostname:port of the service endpoint.
@@ -27,20 +27,73 @@ module Google
27
27
  ##
28
28
  # Create a fully-qualified Finding resource string.
29
29
  #
30
- # The resource will be in the following format:
30
+ # @overload finding_path(organization:, source:, finding:)
31
+ # The resource will be in the following format:
31
32
  #
32
- # `organizations/{organization}/sources/{source}/findings/{finding}`
33
+ # `organizations/{organization}/sources/{source}/findings/{finding}`
33
34
  #
34
- # @param organization [String]
35
- # @param source [String]
36
- # @param finding [String]
35
+ # @param organization [String]
36
+ # @param source [String]
37
+ # @param finding [String]
38
+ #
39
+ # @overload finding_path(folder:, source:, finding:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `folders/{folder}/sources/{source}/findings/{finding}`
43
+ #
44
+ # @param folder [String]
45
+ # @param source [String]
46
+ # @param finding [String]
47
+ #
48
+ # @overload finding_path(project:, source:, finding:)
49
+ # The resource will be in the following format:
50
+ #
51
+ # `projects/{project}/sources/{source}/findings/{finding}`
52
+ #
53
+ # @param project [String]
54
+ # @param source [String]
55
+ # @param finding [String]
37
56
  #
38
57
  # @return [::String]
39
- def finding_path organization:, source:, finding:
40
- raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
41
- raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
58
+ def finding_path **args
59
+ resources = {
60
+ "finding:organization:source" => (proc do |organization:, source:, finding:|
61
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
62
+ raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
63
+
64
+ "organizations/#{organization}/sources/#{source}/findings/#{finding}"
65
+ end),
66
+ "finding:folder:source" => (proc do |folder:, source:, finding:|
67
+ raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
68
+ raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
69
+
70
+ "folders/#{folder}/sources/#{source}/findings/#{finding}"
71
+ end),
72
+ "finding:project:source" => (proc do |project:, source:, finding:|
73
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
74
+ raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
42
75
 
43
- "organizations/#{organization}/sources/#{source}/findings/#{finding}"
76
+ "projects/#{project}/sources/#{source}/findings/#{finding}"
77
+ end)
78
+ }
79
+
80
+ resource = resources[args.keys.sort.join(":")]
81
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
82
+ resource.call(**args)
83
+ end
84
+
85
+ ##
86
+ # Create a fully-qualified Folder resource string.
87
+ #
88
+ # The resource will be in the following format:
89
+ #
90
+ # `folders/{folder}`
91
+ #
92
+ # @param folder [String]
93
+ #
94
+ # @return [::String]
95
+ def folder_path folder:
96
+ "folders/#{folder}"
44
97
  end
45
98
 
46
99
  ##
@@ -88,6 +141,20 @@ module Google
88
141
  "organizations/#{organization}/organizationSettings"
89
142
  end
90
143
 
144
+ ##
145
+ # Create a fully-qualified Project resource string.
146
+ #
147
+ # The resource will be in the following format:
148
+ #
149
+ # `projects/{project}`
150
+ #
151
+ # @param project [String]
152
+ #
153
+ # @return [::String]
154
+ def project_path project:
155
+ "projects/#{project}"
156
+ end
157
+
91
158
  ##
92
159
  # Create a fully-qualified SecurityMarks resource string.
93
160
  #
@@ -108,6 +175,40 @@ module Google
108
175
  # @param source [String]
109
176
  # @param finding [String]
110
177
  #
178
+ # @overload security_marks_path(folder:, asset:)
179
+ # The resource will be in the following format:
180
+ #
181
+ # `folders/{folder}/assets/{asset}/securityMarks`
182
+ #
183
+ # @param folder [String]
184
+ # @param asset [String]
185
+ #
186
+ # @overload security_marks_path(project:, asset:)
187
+ # The resource will be in the following format:
188
+ #
189
+ # `projects/{project}/assets/{asset}/securityMarks`
190
+ #
191
+ # @param project [String]
192
+ # @param asset [String]
193
+ #
194
+ # @overload security_marks_path(folder:, source:, finding:)
195
+ # The resource will be in the following format:
196
+ #
197
+ # `folders/{folder}/sources/{source}/findings/{finding}/securityMarks`
198
+ #
199
+ # @param folder [String]
200
+ # @param source [String]
201
+ # @param finding [String]
202
+ #
203
+ # @overload security_marks_path(project:, source:, finding:)
204
+ # The resource will be in the following format:
205
+ #
206
+ # `projects/{project}/sources/{source}/findings/{finding}/securityMarks`
207
+ #
208
+ # @param project [String]
209
+ # @param source [String]
210
+ # @param finding [String]
211
+ #
111
212
  # @return [::String]
112
213
  def security_marks_path **args
113
214
  resources = {
@@ -121,6 +222,28 @@ module Google
121
222
  raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
122
223
 
123
224
  "organizations/#{organization}/sources/#{source}/findings/#{finding}/securityMarks"
225
+ end),
226
+ "asset:folder" => (proc do |folder:, asset:|
227
+ raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
228
+
229
+ "folders/#{folder}/assets/#{asset}/securityMarks"
230
+ end),
231
+ "asset:project" => (proc do |project:, asset:|
232
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
233
+
234
+ "projects/#{project}/assets/#{asset}/securityMarks"
235
+ end),
236
+ "finding:folder:source" => (proc do |folder:, source:, finding:|
237
+ raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
238
+ raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
239
+
240
+ "folders/#{folder}/sources/#{source}/findings/#{finding}/securityMarks"
241
+ end),
242
+ "finding:project:source" => (proc do |project:, source:, finding:|
243
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
244
+ raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"
245
+
246
+ "projects/#{project}/sources/#{source}/findings/#{finding}/securityMarks"
124
247
  end)
125
248
  }
126
249
 
@@ -132,18 +255,53 @@ module Google
132
255
  ##
133
256
  # Create a fully-qualified Source resource string.
134
257
  #
135
- # The resource will be in the following format:
258
+ # @overload source_path(organization:, source:)
259
+ # The resource will be in the following format:
136
260
  #
137
- # `organizations/{organization}/sources/{source}`
261
+ # `organizations/{organization}/sources/{source}`
138
262
  #
139
- # @param organization [String]
140
- # @param source [String]
263
+ # @param organization [String]
264
+ # @param source [String]
265
+ #
266
+ # @overload source_path(folder:, source:)
267
+ # The resource will be in the following format:
268
+ #
269
+ # `folders/{folder}/sources/{source}`
270
+ #
271
+ # @param folder [String]
272
+ # @param source [String]
273
+ #
274
+ # @overload source_path(project:, source:)
275
+ # The resource will be in the following format:
276
+ #
277
+ # `projects/{project}/sources/{source}`
278
+ #
279
+ # @param project [String]
280
+ # @param source [String]
141
281
  #
142
282
  # @return [::String]
143
- def source_path organization:, source:
144
- raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
283
+ def source_path **args
284
+ resources = {
285
+ "organization:source" => (proc do |organization:, source:|
286
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
287
+
288
+ "organizations/#{organization}/sources/#{source}"
289
+ end),
290
+ "folder:source" => (proc do |folder:, source:|
291
+ raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
292
+
293
+ "folders/#{folder}/sources/#{source}"
294
+ end),
295
+ "project:source" => (proc do |project:, source:|
296
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
297
+
298
+ "projects/#{project}/sources/#{source}"
299
+ end)
300
+ }
145
301
 
146
- "organizations/#{organization}/sources/#{source}"
302
+ resource = resources[args.keys.sort.join(":")]
303
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
304
+ resource.call(**args)
147
305
  end
148
306
 
149
307
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module SecurityCenter
23
23
  module V1p1beta1
24
- VERSION = "0.6.0"
24
+ VERSION = "0.7.3"
25
25
  end
26
26
  end
27
27
  end
@@ -3,11 +3,12 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
- require 'google/api/annotations_pb'
7
6
  require 'google/api/resource_pb'
7
+ require 'google/cloud/securitycenter/v1p1beta1/folder_pb'
8
8
  require 'google/cloud/securitycenter/v1p1beta1/security_marks_pb'
9
9
  require 'google/protobuf/struct_pb'
10
10
  require 'google/protobuf/timestamp_pb'
11
+ require 'google/api/annotations_pb'
11
12
  Google::Protobuf::DescriptorPool.generated_pool.build do
12
13
  add_file("google/cloud/securitycenter/v1p1beta1/asset.proto", :syntax => :proto3) do
13
14
  add_message "google.cloud.securitycenter.v1p1beta1.Asset" do
@@ -18,6 +19,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
18
19
  optional :create_time, :message, 9, "google.protobuf.Timestamp"
19
20
  optional :update_time, :message, 10, "google.protobuf.Timestamp"
20
21
  optional :iam_policy, :message, 11, "google.cloud.securitycenter.v1p1beta1.Asset.IamPolicy"
22
+ optional :canonical_name, :string, 13
21
23
  end
22
24
  add_message "google.cloud.securitycenter.v1p1beta1.Asset.SecurityCenterProperties" do
23
25
  optional :resource_name, :string, 1
@@ -28,6 +30,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
28
30
  optional :resource_display_name, :string, 6
29
31
  optional :resource_parent_display_name, :string, 7
30
32
  optional :resource_project_display_name, :string, 8
33
+ repeated :folders, :message, 10, "google.cloud.securitycenter.v1p1beta1.Folder"
31
34
  end
32
35
  add_message "google.cloud.securitycenter.v1p1beta1.Asset.IamPolicy" do
33
36
  optional :policy_blob, :string, 1
@@ -3,12 +3,12 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
- require 'google/api/annotations_pb'
7
6
  require 'google/api/field_behavior_pb'
8
7
  require 'google/api/resource_pb'
9
8
  require 'google/cloud/securitycenter/v1p1beta1/security_marks_pb'
10
9
  require 'google/protobuf/struct_pb'
11
10
  require 'google/protobuf/timestamp_pb'
11
+ require 'google/api/annotations_pb'
12
12
  Google::Protobuf::DescriptorPool.generated_pool.build do
13
13
  add_file("google/cloud/securitycenter/v1p1beta1/finding.proto", :syntax => :proto3) do
14
14
  add_message "google.cloud.securitycenter.v1p1beta1.Finding" do
@@ -23,6 +23,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
23
23
  optional :event_time, :message, 9, "google.protobuf.Timestamp"
24
24
  optional :create_time, :message, 10, "google.protobuf.Timestamp"
25
25
  optional :severity, :enum, 13, "google.cloud.securitycenter.v1p1beta1.Finding.Severity"
26
+ optional :canonical_name, :string, 14
26
27
  end
27
28
  add_enum "google.cloud.securitycenter.v1p1beta1.Finding.State" do
28
29
  value :STATE_UNSPECIFIED, 0
@@ -0,0 +1,24 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/securitycenter/v1p1beta1/folder.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_file("google/cloud/securitycenter/v1p1beta1/folder.proto", :syntax => :proto3) do
9
+ add_message "google.cloud.securitycenter.v1p1beta1.Folder" do
10
+ optional :resource_folder, :string, 1
11
+ optional :resource_folder_display_name, :string, 2
12
+ end
13
+ end
14
+ end
15
+
16
+ module Google
17
+ module Cloud
18
+ module SecurityCenter
19
+ module V1p1Beta1
20
+ Folder = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1p1beta1.Folder").msgclass
21
+ end
22
+ end
23
+ end
24
+ end
@@ -3,9 +3,9 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
- require 'google/api/annotations_pb'
7
6
  require 'google/api/field_behavior_pb'
8
7
  require 'google/api/resource_pb'
8
+ require 'google/api/annotations_pb'
9
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
10
10
  add_file("google/cloud/securitycenter/v1p1beta1/notification_config.proto", :syntax => :proto3) do
11
11
  add_message "google.cloud.securitycenter.v1p1beta1.NotificationConfig" do
@@ -3,10 +3,9 @@
3
3
 
4
4
  require 'google/protobuf'
5
5
 
6
- require 'google/api/annotations_pb'
7
- require 'google/cloud/securitycenter/v1p1beta1/asset_pb'
8
6
  require 'google/cloud/securitycenter/v1p1beta1/finding_pb'
9
7
  require 'google/cloud/securitycenter/v1p1beta1/resource_pb'
8
+ require 'google/api/annotations_pb'
10
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
11
10
  add_file("google/cloud/securitycenter/v1p1beta1/notification_message.proto", :syntax => :proto3) do
12
11
  add_message "google.cloud.securitycenter.v1p1beta1.NotificationMessage" do