google-cloud-security_center-v1 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) 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/v1/security_center/client.rb +67 -70
  5. data/lib/google/cloud/security_center/v1/security_center/operations.rb +4 -4
  6. data/lib/google/cloud/security_center/v1/security_center/paths.rb +174 -16
  7. data/lib/google/cloud/security_center/v1/version.rb +1 -1
  8. data/lib/google/cloud/securitycenter/v1/asset_pb.rb +4 -1
  9. data/lib/google/cloud/securitycenter/v1/finding_pb.rb +13 -1
  10. data/lib/google/cloud/securitycenter/v1/folder_pb.rb +24 -0
  11. data/lib/google/cloud/securitycenter/v1/indicator_pb.rb +24 -0
  12. data/lib/google/cloud/securitycenter/v1/notification_config_pb.rb +1 -1
  13. data/lib/google/cloud/securitycenter/v1/notification_message_pb.rb +1 -1
  14. data/lib/google/cloud/securitycenter/v1/organization_settings_pb.rb +2 -1
  15. data/lib/google/cloud/securitycenter/v1/resource_pb.rb +3 -0
  16. data/lib/google/cloud/securitycenter/v1/run_asset_discovery_response_pb.rb +1 -1
  17. data/lib/google/cloud/securitycenter/v1/security_marks_pb.rb +2 -1
  18. data/lib/google/cloud/securitycenter/v1/securitycenter_service_pb.rb +2 -0
  19. data/lib/google/cloud/securitycenter/v1/securitycenter_service_services_pb.rb +4 -1
  20. data/lib/google/cloud/securitycenter/v1/source_pb.rb +2 -1
  21. data/proto_docs/google/api/field_behavior.rb +7 -1
  22. data/proto_docs/google/cloud/securitycenter/v1/asset.rb +13 -2
  23. data/proto_docs/google/cloud/securitycenter/v1/finding.rb +40 -1
  24. data/proto_docs/google/cloud/securitycenter/v1/folder.rb +40 -0
  25. data/proto_docs/google/cloud/securitycenter/v1/indicator.rb +41 -0
  26. data/proto_docs/google/cloud/securitycenter/v1/organization_settings.rb +4 -0
  27. data/proto_docs/google/cloud/securitycenter/v1/resource.rb +5 -0
  28. data/proto_docs/google/cloud/securitycenter/v1/security_marks.rb +10 -0
  29. data/proto_docs/google/cloud/securitycenter/v1/securitycenter_service.rb +57 -24
  30. data/proto_docs/google/cloud/securitycenter/v1/source.rb +8 -0
  31. data/proto_docs/google/type/expr.rb +35 -12
  32. metadata +19 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 977b27bf8d5cdc9635deb71175f475ef0d208c7fce2f09af5ae2e29bf7f886bf
4
- data.tar.gz: d6357cf31f5d996ef12c3285525bd0b48a4964d994a60964c09a48a2bf47bead
3
+ metadata.gz: d6cf0e3ef3cc8a50ab83356e628e5bdd41587b6f3b8f411716491013dcff25ab
4
+ data.tar.gz: feab623d462bf650c55eb957ff01dcf5b85c07cbb7539e1f688e2f9409f85e1a
5
5
  SHA512:
6
- metadata.gz: c0de14bba5173b913d6a8b934798e79fb0cfe194b6a5029069ce0bed95c9f8432cbdb66694afafff5e4319157eb80491eae99c1aa50971cc218f7abc68b94f81
7
- data.tar.gz: fc37bd01855c361fc73aa9e4c411fe51f46191c1e466bb415ff20cb4797cbcf5eca4761d5baf12f7a73b2bc4193716a84bfd9141ac2e5feede1064971e664ab2
6
+ metadata.gz: 3bbcbddb45342e566e0452fcc46dbccc8088eb1e9000d08928c21361ac5b655a564cbdff812286d2b651156f49a574ed6f77116c1da80f46aa665d4ddebd5865
7
+ data.tar.gz: 74b50f37bed033ce7c7dbc0c01e83541855f3ddfcdfde0c202e50c0214a357153896dda8bfbd142cd04c76f821ea66b9b6d72c90033486f3cc49b72e7bbc6d8b
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-security_center-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::SecurityCenter::V1::SecurityCenter::Credentials}):
68
68
 
69
- 1. `SECURITY_CENTER_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `SECURITY_CENTER_KEYFILE` - Path to JSON file, or JSON contents
71
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
69
+ * `SECURITY_CENTER_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `SECURITY_CENTER_KEYFILE` - Path to JSON file, or JSON contents
71
+ * `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
+ * `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
+ * `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/security_center/v1"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
82
82
 
83
83
  ### Configuration
84
84
 
85
- The **Credentials JSON** can be configured instead of placing them in
86
- environment variables. Either on an individual client initialization:
85
+ The path to the **Credentials JSON** file can be configured instead of storing
86
+ it in an environment variable. Either on an individual client initialization:
87
87
 
88
88
  ```ruby
89
89
  require "google/cloud/security_center/v1"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new do |con
93
93
  end
94
94
  ```
95
95
 
96
- Or configured globally for all clients:
96
+ Or globally for all clients:
97
97
 
98
98
  ```ruby
99
99
  require "google/cloud/security_center/v1"
data/README.md CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/security_center/v1"
34
34
 
35
35
  client = ::Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::SecurityCenter::V1::CreateSourceRequest.new # (request fields as keyword arguments...)
37
37
  response = client.create_source request
38
38
  ```
39
39
 
@@ -75,82 +75,52 @@ module Google
75
75
 
76
76
  default_config.rpcs.get_iam_policy.timeout = 60.0
77
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: [4, 14]
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
82
79
  }
83
80
 
84
81
  default_config.rpcs.get_notification_config.timeout = 60.0
85
82
  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: [4, 14]
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
90
84
  }
91
85
 
92
86
  default_config.rpcs.get_organization_settings.timeout = 60.0
93
87
  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: [4, 14]
88
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
98
89
  }
99
90
 
100
91
  default_config.rpcs.get_source.timeout = 60.0
101
92
  default_config.rpcs.get_source.retry_policy = {
102
- initial_delay: 0.1,
103
- max_delay: 60.0,
104
- multiplier: 1.3,
105
- retry_codes: [4, 14]
93
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
106
94
  }
107
95
 
108
96
  default_config.rpcs.group_assets.timeout = 480.0
109
97
  default_config.rpcs.group_assets.retry_policy = {
110
- initial_delay: 0.1,
111
- max_delay: 60.0,
112
- multiplier: 1.3,
113
- retry_codes: [4, 14]
98
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
114
99
  }
115
100
 
116
101
  default_config.rpcs.group_findings.timeout = 480.0
117
102
  default_config.rpcs.group_findings.retry_policy = {
118
- initial_delay: 0.1,
119
- max_delay: 60.0,
120
- multiplier: 1.3,
121
- retry_codes: [4, 14]
103
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
122
104
  }
123
105
 
124
106
  default_config.rpcs.list_assets.timeout = 480.0
125
107
  default_config.rpcs.list_assets.retry_policy = {
126
- initial_delay: 0.1,
127
- max_delay: 60.0,
128
- multiplier: 1.3,
129
- retry_codes: [4, 14]
108
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
130
109
  }
131
110
 
132
111
  default_config.rpcs.list_findings.timeout = 480.0
133
112
  default_config.rpcs.list_findings.retry_policy = {
134
- initial_delay: 0.1,
135
- max_delay: 60.0,
136
- multiplier: 1.3,
137
- retry_codes: [4, 14]
113
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
138
114
  }
139
115
 
140
116
  default_config.rpcs.list_notification_configs.timeout = 60.0
141
117
  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: [4, 14]
118
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
146
119
  }
147
120
 
148
121
  default_config.rpcs.list_sources.timeout = 60.0
149
122
  default_config.rpcs.list_sources.retry_policy = {
150
- initial_delay: 0.1,
151
- max_delay: 60.0,
152
- multiplier: 1.3,
153
- retry_codes: [4, 14]
123
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
154
124
  }
155
125
 
156
126
  default_config.rpcs.run_asset_discovery.timeout = 60.0
@@ -161,10 +131,7 @@ module Google
161
131
 
162
132
  default_config.rpcs.test_iam_permissions.timeout = 60.0
163
133
  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: [4, 14]
134
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
168
135
  }
169
136
 
170
137
  default_config.rpcs.update_finding.timeout = 60.0
@@ -245,7 +212,7 @@ module Google
245
212
  !@config.endpoint.split(".").first.include?("-")
246
213
  credentials ||= Credentials.default scope: @config.scope,
247
214
  enable_self_signed_jwt: enable_self_signed_jwt
248
- if credentials.is_a?(String) || credentials.is_a?(Hash)
215
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
249
216
  credentials = Credentials.new credentials, scope: @config.scope
250
217
  end
251
218
  @quota_project_id = @config.quota_project
@@ -853,7 +820,8 @@ module Google
853
820
  #
854
821
  # @param parent [::String]
855
822
  # Required. Name of the organization to groupBy. Its format is
856
- # "organizations/[organization_id]".
823
+ # "organizations/[organization_id], folders/[folder_id], or
824
+ # projects/[project_id]".
857
825
  # @param filter [::String]
858
826
  # Expression that defines the filter to apply across assets.
859
827
  # The expression is a list of zero or more restrictions combined via logical
@@ -1028,7 +996,9 @@ module Google
1028
996
  # specified properties.
1029
997
  #
1030
998
  # To group across all sources provide a `-` as the source id.
1031
- # Example: /v1/organizations/\\{organization_id}/sources/-/findings
999
+ # Example: /v1/organizations/\\{organization_id}/sources/-/findings,
1000
+ # /v1/folders/\\{folder_id}/sources/-/findings,
1001
+ # /v1/projects/\\{project_id}/sources/-/findings
1032
1002
  #
1033
1003
  # @overload group_findings(request, options = nil)
1034
1004
  # Pass arguments to `group_findings` via a request object, either of type
@@ -1047,9 +1017,12 @@ module Google
1047
1017
  #
1048
1018
  # @param parent [::String]
1049
1019
  # Required. Name of the source to groupBy. Its format is
1050
- # "organizations/[organization_id]/sources/[source_id]". To groupBy across
1051
- # all sources provide a source_id of `-`. For example:
1052
- # organizations/\\{organization_id}/sources/-
1020
+ # "organizations/[organization_id]/sources/[source_id]",
1021
+ # folders/[folder_id]/sources/[source_id], or
1022
+ # projects/[project_id]/sources/[source_id]. To groupBy across all sources
1023
+ # provide a source_id of `-`. For example:
1024
+ # organizations/\\{organization_id}/sources/-, folders/\\{folder_id}/sources/-,
1025
+ # or projects/\\{project_id}/sources/-
1053
1026
  # @param filter [::String]
1054
1027
  # Expression that defines the filter to apply across findings.
1055
1028
  # The expression is a list of one or more restrictions combined via logical
@@ -1084,23 +1057,32 @@ module Google
1084
1057
  # * category: `=`, `:`
1085
1058
  # * external_uri: `=`, `:`
1086
1059
  # * event_time: `=`, `>`, `<`, `>=`, `<=`
1087
- # * severity: `=`, `:`
1088
1060
  #
1089
1061
  # Usage: This should be milliseconds since epoch or an RFC3339 string.
1090
1062
  # Examples:
1091
1063
  # `event_time = "2019-06-10T16:07:18-07:00"`
1092
1064
  # `event_time = 1560208038000`
1093
1065
  #
1066
+ # * severity: `=`, `:`
1067
+ # * workflow_state: `=`, `:`
1094
1068
  # * security_marks.marks: `=`, `:`
1095
1069
  # * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1096
1070
  #
1097
- # For example, `source_properties.size = 100` is a valid filter string.
1071
+ # For example, `source_properties.size = 100` is a valid filter string.
1098
1072
  #
1099
- # Use a partial match on the empty string to filter based on a property
1100
- # existing: `source_properties.my_property : ""`
1073
+ # Use a partial match on the empty string to filter based on a property
1074
+ # existing: `source_properties.my_property : ""`
1101
1075
  #
1102
- # Use a negated partial match on the empty string to filter based on a
1103
- # property not existing: `-source_properties.my_property : ""`
1076
+ # Use a negated partial match on the empty string to filter based on a
1077
+ # property not existing: `-source_properties.my_property : ""`
1078
+ #
1079
+ # * resource:
1080
+ # * resource.name: `=`, `:`
1081
+ # * resource.parent_name: `=`, `:`
1082
+ # * resource.parent_display_name: `=`, `:`
1083
+ # * resource.project_name: `=`, `:`
1084
+ # * resource.project_display_name: `=`, `:`
1085
+ # * resource.type: `=`, `:`
1104
1086
  # @param group_by [::String]
1105
1087
  # Required. Expression that defines what assets fields to use for grouping (including
1106
1088
  # `state_change`). The string value should follow SQL syntax: comma separated
@@ -1229,7 +1211,8 @@ module Google
1229
1211
  #
1230
1212
  # @param parent [::String]
1231
1213
  # Required. Name of the organization assets should belong to. Its format is
1232
- # "organizations/[organization_id]".
1214
+ # "organizations/[organization_id], folders/[folder_id], or
1215
+ # projects/[project_id]".
1233
1216
  # @param filter [::String]
1234
1217
  # Expression that defines the filter to apply across assets.
1235
1218
  # The expression is a list of zero or more restrictions combined via logical
@@ -1426,9 +1409,12 @@ module Google
1426
1409
  #
1427
1410
  # @param parent [::String]
1428
1411
  # Required. Name of the source the findings belong to. Its format is
1429
- # "organizations/[organization_id]/sources/[source_id]". To list across all
1430
- # sources provide a source_id of `-`. For example:
1431
- # organizations/\\{organization_id}/sources/-
1412
+ # "organizations/[organization_id]/sources/[source_id],
1413
+ # folders/[folder_id]/sources/[source_id], or
1414
+ # projects/[project_id]/sources/[source_id]". To list across all sources
1415
+ # provide a source_id of `-`. For example:
1416
+ # organizations/\\{organization_id}/sources/-, folders/\\{folder_id}/sources/- or
1417
+ # projects/\\{projects_id}/sources/-
1432
1418
  # @param filter [::String]
1433
1419
  # Expression that defines the filter to apply across findings.
1434
1420
  # The expression is a list of one or more restrictions combined via logical
@@ -1463,23 +1449,33 @@ module Google
1463
1449
  # * category: `=`, `:`
1464
1450
  # * external_uri: `=`, `:`
1465
1451
  # * event_time: `=`, `>`, `<`, `>=`, `<=`
1466
- # * severity: `=`, `:`
1467
1452
  #
1468
1453
  # Usage: This should be milliseconds since epoch or an RFC3339 string.
1469
1454
  # Examples:
1470
1455
  # `event_time = "2019-06-10T16:07:18-07:00"`
1471
1456
  # `event_time = 1560208038000`
1472
1457
  #
1473
- # security_marks.marks: `=`, `:`
1474
- # source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1458
+ # * severity: `=`, `:`
1459
+ # * workflow_state: `=`, `:`
1460
+ # * security_marks.marks: `=`, `:`
1461
+ # * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1475
1462
  #
1476
- # For example, `source_properties.size = 100` is a valid filter string.
1463
+ # For example, `source_properties.size = 100` is a valid filter string.
1477
1464
  #
1478
- # Use a partial match on the empty string to filter based on a property
1479
- # existing: `source_properties.my_property : ""`
1465
+ # Use a partial match on the empty string to filter based on a property
1466
+ # existing: `source_properties.my_property : ""`
1480
1467
  #
1481
- # Use a negated partial match on the empty string to filter based on a
1482
- # property not existing: `-source_properties.my_property : ""`
1468
+ # Use a negated partial match on the empty string to filter based on a
1469
+ # property not existing: `-source_properties.my_property : ""`
1470
+ #
1471
+ # * resource:
1472
+ # * resource.name: `=`, `:`
1473
+ # * resource.parent_name: `=`, `:`
1474
+ # * resource.parent_display_name: `=`, `:`
1475
+ # * resource.project_name: `=`, `:`
1476
+ # * resource.project_display_name: `=`, `:`
1477
+ # * resource.type: `=`, `:`
1478
+ # * resource.folders.resource_folder: `=`, `:`
1483
1479
  # @param order_by [::String]
1484
1480
  # Expression that defines what fields and order to use for sorting. The
1485
1481
  # string value should follow SQL syntax: comma separated list of fields. For
@@ -1686,8 +1682,9 @@ module Google
1686
1682
  # the default parameter values, pass an empty Hash as a request object (see above).
1687
1683
  #
1688
1684
  # @param parent [::String]
1689
- # Required. Resource name of the parent of sources to list. Its format should
1690
- # be "organizations/[organization_id]".
1685
+ # Required. Resource name of the parent of sources to list. Its format should be
1686
+ # "organizations/[organization_id], folders/[folder_id], or
1687
+ # projects/[project_id]".
1691
1688
  # @param page_token [::String]
1692
1689
  # The value returned by the last `ListSourcesResponse`; indicates
1693
1690
  # that this is a continuation of a prior `ListSources` call, and
@@ -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
@@ -396,9 +396,9 @@ module Google
396
396
  end
397
397
 
398
398
  ##
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
399
+ # Waits until the specified long-running operation is done or reaches at most
400
+ # a specified timeout, returning the latest state. If the operation is
401
+ # already done, the latest state is immediately returned. If the timeout
402
402
  # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
403
  # timeout is used. If the server does not support this method, it returns
404
404
  # `google.rpc.Code.UNIMPLEMENTED`.
@@ -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
  ##