1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://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, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\SecurityCommandCenter\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\SecurityCommandCenter\Finding;
|
---|
21 | use Google\Service\SecurityCommandCenter\GroupFindingsRequest;
|
---|
22 | use Google\Service\SecurityCommandCenter\GroupFindingsResponse;
|
---|
23 | use Google\Service\SecurityCommandCenter\ListFindingsResponse;
|
---|
24 | use Google\Service\SecurityCommandCenter\SecurityMarks;
|
---|
25 | use Google\Service\SecurityCommandCenter\SetFindingStateRequest;
|
---|
26 | use Google\Service\SecurityCommandCenter\SetMuteRequest;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "findings" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $securitycenterService = new Google\Service\SecurityCommandCenter(...);
|
---|
33 | * $findings = $securitycenterService->organizations_sources_findings;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class OrganizationsSourcesFindings extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Creates a finding. The corresponding source must exist for finding creation
|
---|
40 | * to succeed. (findings.create)
|
---|
41 | *
|
---|
42 | * @param string $parent Required. Resource name of the new finding's parent.
|
---|
43 | * Its format should be `organizations/[organization_id]/sources/[source_id]`.
|
---|
44 | * @param Finding $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string findingId Required. Unique identifier provided by the
|
---|
48 | * client within the parent scope. It must be alphanumeric and less than or
|
---|
49 | * equal to 32 characters and greater than 0 characters in length.
|
---|
50 | * @return Finding
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function create($parent, Finding $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('create', [$params], Finding::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Filters an organization or source's findings and groups them by their
|
---|
61 | * specified properties. To group across all sources provide a `-` as the source
|
---|
62 | * id. Example: /v1/organizations/{organization_id}/sources/-/findings,
|
---|
63 | * /v1/folders/{folder_id}/sources/-/findings,
|
---|
64 | * /v1/projects/{project_id}/sources/-/findings (findings.group)
|
---|
65 | *
|
---|
66 | * @param string $parent Required. Name of the source to groupBy. Its format is
|
---|
67 | * `organizations/[organization_id]/sources/[source_id]`,
|
---|
68 | * `folders/[folder_id]/sources/[source_id]`, or
|
---|
69 | * `projects/[project_id]/sources/[source_id]`. To groupBy across all sources
|
---|
70 | * provide a source_id of `-`. For example:
|
---|
71 | * `organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-`,
|
---|
72 | * or `projects/{project_id}/sources/-`
|
---|
73 | * @param GroupFindingsRequest $postBody
|
---|
74 | * @param array $optParams Optional parameters.
|
---|
75 | * @return GroupFindingsResponse
|
---|
76 | * @throws \Google\Service\Exception
|
---|
77 | */
|
---|
78 | public function group($parent, GroupFindingsRequest $postBody, $optParams = [])
|
---|
79 | {
|
---|
80 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
81 | $params = array_merge($params, $optParams);
|
---|
82 | return $this->call('group', [$params], GroupFindingsResponse::class);
|
---|
83 | }
|
---|
84 | /**
|
---|
85 | * Lists an organization or source's findings. To list across all sources
|
---|
86 | * provide a `-` as the source id. Example:
|
---|
87 | * /v1/organizations/{organization_id}/sources/-/findings
|
---|
88 | * (findings.listOrganizationsSourcesFindings)
|
---|
89 | *
|
---|
90 | * @param string $parent Required. Name of the source the findings belong to.
|
---|
91 | * Its format is `organizations/[organization_id]/sources/[source_id]`,
|
---|
92 | * `folders/[folder_id]/sources/[source_id]`, or
|
---|
93 | * `projects/[project_id]/sources/[source_id]`. To list across all sources
|
---|
94 | * provide a source_id of `-`. For example:
|
---|
95 | * `organizations/{organization_id}/sources/-`, `folders/{folder_id}/sources/-`
|
---|
96 | * or `projects/{projects_id}/sources/-`
|
---|
97 | * @param array $optParams Optional parameters.
|
---|
98 | *
|
---|
99 | * @opt_param string compareDuration When compare_duration is set, the
|
---|
100 | * ListFindingsResult's "state_change" attribute is updated to indicate whether
|
---|
101 | * the finding had its state changed, the finding's state remained unchanged, or
|
---|
102 | * if the finding was added in any state during the compare_duration period of
|
---|
103 | * time that precedes the read_time. This is the time between (read_time -
|
---|
104 | * compare_duration) and read_time. The state_change value is derived based on
|
---|
105 | * the presence and state of the finding at the two points in time. Intermediate
|
---|
106 | * state changes between the two times don't affect the result. For example, the
|
---|
107 | * results aren't affected if the finding is made inactive and then active
|
---|
108 | * again. Possible "state_change" values when compare_duration is specified: *
|
---|
109 | * "CHANGED": indicates that the finding was present and matched the given
|
---|
110 | * filter at the start of compare_duration, but changed its state at read_time.
|
---|
111 | * * "UNCHANGED": indicates that the finding was present and matched the given
|
---|
112 | * filter at the start of compare_duration and did not change state at
|
---|
113 | * read_time. * "ADDED": indicates that the finding did not match the given
|
---|
114 | * filter or was not present at the start of compare_duration, but was present
|
---|
115 | * at read_time. * "REMOVED": indicates that the finding was present and matched
|
---|
116 | * the filter at the start of compare_duration, but did not match the filter at
|
---|
117 | * read_time. If compare_duration is not specified, then the only possible
|
---|
118 | * state_change is "UNUSED", which will be the state_change set for all findings
|
---|
119 | * present at read_time.
|
---|
120 | * @opt_param string fieldMask A field mask to specify the Finding fields to be
|
---|
121 | * listed in the response. An empty field mask will list all fields.
|
---|
122 | * @opt_param string filter Expression that defines the filter to apply across
|
---|
123 | * findings. The expression is a list of one or more restrictions combined via
|
---|
124 | * logical operators `AND` and `OR`. Parentheses are supported, and `OR` has
|
---|
125 | * higher precedence than `AND`. Restrictions have the form ` ` and may have a
|
---|
126 | * `-` character in front of them to indicate negation. Examples include: * name
|
---|
127 | * * source_properties.a_property * security_marks.marks.marka The supported
|
---|
128 | * operators are: * `=` for all value types. * `>`, `<`, `>=`, `<=` for integer
|
---|
129 | * values. * `:`, meaning substring matching, for strings. The supported value
|
---|
130 | * types are: * string literals in quotes. * integer literals without quotes. *
|
---|
131 | * boolean literals `true` and `false` without quotes. The following field and
|
---|
132 | * operator combinations are supported: * name: `=` * parent: `=`, `:` *
|
---|
133 | * resource_name: `=`, `:` * state: `=`, `:` * category: `=`, `:` *
|
---|
134 | * external_uri: `=`, `:` * event_time: `=`, `>`, `<`, `>=`, `<=` Usage: This
|
---|
135 | * should be milliseconds since epoch or an RFC3339 string. Examples:
|
---|
136 | * `event_time = "2019-06-10T16:07:18-07:00"` `event_time = 1560208038000` *
|
---|
137 | * severity: `=`, `:` * workflow_state: `=`, `:` * security_marks.marks: `=`,
|
---|
138 | * `:` * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` For example,
|
---|
139 | * `source_properties.size = 100` is a valid filter string. Use a partial match
|
---|
140 | * on the empty string to filter based on a property existing:
|
---|
141 | * `source_properties.my_property : ""` Use a negated partial match on the empty
|
---|
142 | * string to filter based on a property not existing:
|
---|
143 | * `-source_properties.my_property : ""` * resource: * resource.name: `=`, `:` *
|
---|
144 | * resource.parent_name: `=`, `:` * resource.parent_display_name: `=`, `:` *
|
---|
145 | * resource.project_name: `=`, `:` * resource.project_display_name: `=`, `:` *
|
---|
146 | * resource.type: `=`, `:` * resource.folders.resource_folder: `=`, `:` *
|
---|
147 | * resource.display_name: `=`, `:`
|
---|
148 | * @opt_param string orderBy Expression that defines what fields and order to
|
---|
149 | * use for sorting. The string value should follow SQL syntax: comma separated
|
---|
150 | * list of fields. For example: "name,resource_properties.a_property". The
|
---|
151 | * default sorting order is ascending. To specify descending order for a field,
|
---|
152 | * a suffix " desc" should be appended to the field name. For example: "name
|
---|
153 | * desc,source_properties.a_property". Redundant space characters in the syntax
|
---|
154 | * are insignificant. "name desc,source_properties.a_property" and " name desc ,
|
---|
155 | * source_properties.a_property " are equivalent. The following fields are
|
---|
156 | * supported: name parent state category resource_name event_time
|
---|
157 | * source_properties security_marks.marks
|
---|
158 | * @opt_param int pageSize The maximum number of results to return in a single
|
---|
159 | * response. Default is 10, minimum is 1, maximum is 1000.
|
---|
160 | * @opt_param string pageToken The value returned by the last
|
---|
161 | * `ListFindingsResponse`; indicates that this is a continuation of a prior
|
---|
162 | * `ListFindings` call, and that the system should return the next page of data.
|
---|
163 | * @opt_param string readTime Time used as a reference point when filtering
|
---|
164 | * findings. The filter is limited to findings existing at the supplied time and
|
---|
165 | * their values are those at that specific time. Absence of this field will
|
---|
166 | * default to the API's version of NOW.
|
---|
167 | * @return ListFindingsResponse
|
---|
168 | * @throws \Google\Service\Exception
|
---|
169 | */
|
---|
170 | public function listOrganizationsSourcesFindings($parent, $optParams = [])
|
---|
171 | {
|
---|
172 | $params = ['parent' => $parent];
|
---|
173 | $params = array_merge($params, $optParams);
|
---|
174 | return $this->call('list', [$params], ListFindingsResponse::class);
|
---|
175 | }
|
---|
176 | /**
|
---|
177 | * Creates or updates a finding. The corresponding source must exist for a
|
---|
178 | * finding creation to succeed. (findings.patch)
|
---|
179 | *
|
---|
180 | * @param string $name The [relative resource name](https://cloud.google.com/api
|
---|
181 | * s/design/resource_names#relative_resource_name) of the finding. Example:
|
---|
182 | * "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}",
|
---|
183 | * "folders/{folder_id}/sources/{source_id}/findings/{finding_id}",
|
---|
184 | * "projects/{project_id}/sources/{source_id}/findings/{finding_id}".
|
---|
185 | * @param Finding $postBody
|
---|
186 | * @param array $optParams Optional parameters.
|
---|
187 | *
|
---|
188 | * @opt_param string updateMask The FieldMask to use when updating the finding
|
---|
189 | * resource. This field should not be specified when creating a finding. When
|
---|
190 | * updating a finding, an empty mask is treated as updating all mutable fields
|
---|
191 | * and replacing source_properties. Individual source_properties can be
|
---|
192 | * added/updated by using "source_properties." in the field mask.
|
---|
193 | * @return Finding
|
---|
194 | * @throws \Google\Service\Exception
|
---|
195 | */
|
---|
196 | public function patch($name, Finding $postBody, $optParams = [])
|
---|
197 | {
|
---|
198 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
199 | $params = array_merge($params, $optParams);
|
---|
200 | return $this->call('patch', [$params], Finding::class);
|
---|
201 | }
|
---|
202 | /**
|
---|
203 | * Updates the mute state of a finding. (findings.setMute)
|
---|
204 | *
|
---|
205 | * @param string $name Required. The [relative resource name](https://cloud.goog
|
---|
206 | * le.com/apis/design/resource_names#relative_resource_name) of the finding.
|
---|
207 | * Example:
|
---|
208 | * `organizations/{organization_id}/sources/{source_id}/findings/{finding_id}`,
|
---|
209 | * `folders/{folder_id}/sources/{source_id}/findings/{finding_id}`,
|
---|
210 | * `projects/{project_id}/sources/{source_id}/findings/{finding_id}`.
|
---|
211 | * @param SetMuteRequest $postBody
|
---|
212 | * @param array $optParams Optional parameters.
|
---|
213 | * @return Finding
|
---|
214 | * @throws \Google\Service\Exception
|
---|
215 | */
|
---|
216 | public function setMute($name, SetMuteRequest $postBody, $optParams = [])
|
---|
217 | {
|
---|
218 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
219 | $params = array_merge($params, $optParams);
|
---|
220 | return $this->call('setMute', [$params], Finding::class);
|
---|
221 | }
|
---|
222 | /**
|
---|
223 | * Updates the state of a finding. (findings.setState)
|
---|
224 | *
|
---|
225 | * @param string $name Required. The [relative resource name](https://cloud.goog
|
---|
226 | * le.com/apis/design/resource_names#relative_resource_name) of the finding.
|
---|
227 | * Example:
|
---|
228 | * `organizations/{organization_id}/sources/{source_id}/findings/{finding_id}`,
|
---|
229 | * `folders/{folder_id}/sources/{source_id}/findings/{finding_id}`,
|
---|
230 | * `projects/{project_id}/sources/{source_id}/findings/{finding_id}`.
|
---|
231 | * @param SetFindingStateRequest $postBody
|
---|
232 | * @param array $optParams Optional parameters.
|
---|
233 | * @return Finding
|
---|
234 | * @throws \Google\Service\Exception
|
---|
235 | */
|
---|
236 | public function setState($name, SetFindingStateRequest $postBody, $optParams = [])
|
---|
237 | {
|
---|
238 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
239 | $params = array_merge($params, $optParams);
|
---|
240 | return $this->call('setState', [$params], Finding::class);
|
---|
241 | }
|
---|
242 | /**
|
---|
243 | * Updates security marks. (findings.updateSecurityMarks)
|
---|
244 | *
|
---|
245 | * @param string $name The relative resource name of the SecurityMarks. See:
|
---|
246 | * https://cloud.google.com/apis/design/resource_names#relative_resource_name
|
---|
247 | * Examples: "organizations/{organization_id}/assets/{asset_id}/securityMarks" "
|
---|
248 | * organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/sec
|
---|
249 | * urityMarks".
|
---|
250 | * @param SecurityMarks $postBody
|
---|
251 | * @param array $optParams Optional parameters.
|
---|
252 | *
|
---|
253 | * @opt_param string startTime The time at which the updated SecurityMarks take
|
---|
254 | * effect. If not set uses current server time. Updates will be applied to the
|
---|
255 | * SecurityMarks that are active immediately preceding this time. Must be
|
---|
256 | * earlier or equal to the server time.
|
---|
257 | * @opt_param string updateMask The FieldMask to use when updating the security
|
---|
258 | * marks resource. The field mask must not contain duplicate fields. If empty or
|
---|
259 | * set to "marks", all marks will be replaced. Individual marks can be updated
|
---|
260 | * using "marks.".
|
---|
261 | * @return SecurityMarks
|
---|
262 | * @throws \Google\Service\Exception
|
---|
263 | */
|
---|
264 | public function updateSecurityMarks($name, SecurityMarks $postBody, $optParams = [])
|
---|
265 | {
|
---|
266 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
267 | $params = array_merge($params, $optParams);
|
---|
268 | return $this->call('updateSecurityMarks', [$params], SecurityMarks::class);
|
---|
269 | }
|
---|
270 | }
|
---|
271 |
|
---|
272 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
273 | class_alias(OrganizationsSourcesFindings::class, 'Google_Service_SecurityCommandCenter_Resource_OrganizationsSourcesFindings');
|
---|