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