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\ContainerAnalysis\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ContainerAnalysis\BatchCreateOccurrencesRequest;
|
---|
21 | use Google\Service\ContainerAnalysis\BatchCreateOccurrencesResponse;
|
---|
22 | use Google\Service\ContainerAnalysis\ContaineranalysisEmpty;
|
---|
23 | use Google\Service\ContainerAnalysis\GetIamPolicyRequest;
|
---|
24 | use Google\Service\ContainerAnalysis\ListOccurrencesResponse;
|
---|
25 | use Google\Service\ContainerAnalysis\Note;
|
---|
26 | use Google\Service\ContainerAnalysis\Occurrence;
|
---|
27 | use Google\Service\ContainerAnalysis\Policy;
|
---|
28 | use Google\Service\ContainerAnalysis\SetIamPolicyRequest;
|
---|
29 | use Google\Service\ContainerAnalysis\TestIamPermissionsRequest;
|
---|
30 | use Google\Service\ContainerAnalysis\TestIamPermissionsResponse;
|
---|
31 | use Google\Service\ContainerAnalysis\VulnerabilityOccurrencesSummary;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * The "occurrences" collection of methods.
|
---|
35 | * Typical usage is:
|
---|
36 | * <code>
|
---|
37 | * $containeranalysisService = new Google\Service\ContainerAnalysis(...);
|
---|
38 | * $occurrences = $containeranalysisService->projects_occurrences;
|
---|
39 | * </code>
|
---|
40 | */
|
---|
41 | class ProjectsOccurrences extends \Google\Service\Resource
|
---|
42 | {
|
---|
43 | /**
|
---|
44 | * Creates new occurrences in batch. (occurrences.batchCreate)
|
---|
45 | *
|
---|
46 | * @param string $parent Required. The name of the project in the form of
|
---|
47 | * `projects/[PROJECT_ID]`, under which the occurrences are to be created.
|
---|
48 | * @param BatchCreateOccurrencesRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return BatchCreateOccurrencesResponse
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function batchCreate($parent, BatchCreateOccurrencesRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('batchCreate', [$params], BatchCreateOccurrencesResponse::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Creates a new occurrence. (occurrences.create)
|
---|
61 | *
|
---|
62 | * @param string $parent Required. The name of the project in the form of
|
---|
63 | * `projects/[PROJECT_ID]`, under which the occurrence is to be created.
|
---|
64 | * @param Occurrence $postBody
|
---|
65 | * @param array $optParams Optional parameters.
|
---|
66 | * @return Occurrence
|
---|
67 | * @throws \Google\Service\Exception
|
---|
68 | */
|
---|
69 | public function create($parent, Occurrence $postBody, $optParams = [])
|
---|
70 | {
|
---|
71 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
72 | $params = array_merge($params, $optParams);
|
---|
73 | return $this->call('create', [$params], Occurrence::class);
|
---|
74 | }
|
---|
75 | /**
|
---|
76 | * Deletes the specified occurrence. For example, use this method to delete an
|
---|
77 | * occurrence when the occurrence is no longer applicable for the given
|
---|
78 | * resource. (occurrences.delete)
|
---|
79 | *
|
---|
80 | * @param string $name Required. The name of the occurrence in the form of
|
---|
81 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
|
---|
82 | * @param array $optParams Optional parameters.
|
---|
83 | * @return ContaineranalysisEmpty
|
---|
84 | * @throws \Google\Service\Exception
|
---|
85 | */
|
---|
86 | public function delete($name, $optParams = [])
|
---|
87 | {
|
---|
88 | $params = ['name' => $name];
|
---|
89 | $params = array_merge($params, $optParams);
|
---|
90 | return $this->call('delete', [$params], ContaineranalysisEmpty::class);
|
---|
91 | }
|
---|
92 | /**
|
---|
93 | * Gets the specified occurrence. (occurrences.get)
|
---|
94 | *
|
---|
95 | * @param string $name Required. The name of the occurrence in the form of
|
---|
96 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
|
---|
97 | * @param array $optParams Optional parameters.
|
---|
98 | * @return Occurrence
|
---|
99 | * @throws \Google\Service\Exception
|
---|
100 | */
|
---|
101 | public function get($name, $optParams = [])
|
---|
102 | {
|
---|
103 | $params = ['name' => $name];
|
---|
104 | $params = array_merge($params, $optParams);
|
---|
105 | return $this->call('get', [$params], Occurrence::class);
|
---|
106 | }
|
---|
107 | /**
|
---|
108 | * Gets the access control policy for a note or an occurrence resource. Requires
|
---|
109 | * `containeranalysis.notes.setIamPolicy` or
|
---|
110 | * `containeranalysis.occurrences.setIamPolicy` permission if the resource is a
|
---|
111 | * note or occurrence, respectively. The resource takes the format
|
---|
112 | * `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
|
---|
113 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
|
---|
114 | * (occurrences.getIamPolicy)
|
---|
115 | *
|
---|
116 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
117 | * requested. See [Resource
|
---|
118 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
119 | * appropriate value for this field.
|
---|
120 | * @param GetIamPolicyRequest $postBody
|
---|
121 | * @param array $optParams Optional parameters.
|
---|
122 | * @return Policy
|
---|
123 | * @throws \Google\Service\Exception
|
---|
124 | */
|
---|
125 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
126 | {
|
---|
127 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
128 | $params = array_merge($params, $optParams);
|
---|
129 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
130 | }
|
---|
131 | /**
|
---|
132 | * Gets the note attached to the specified occurrence. Consumer projects can use
|
---|
133 | * this method to get a note that belongs to a provider project.
|
---|
134 | * (occurrences.getNotes)
|
---|
135 | *
|
---|
136 | * @param string $name Required. The name of the occurrence in the form of
|
---|
137 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
|
---|
138 | * @param array $optParams Optional parameters.
|
---|
139 | * @return Note
|
---|
140 | * @throws \Google\Service\Exception
|
---|
141 | */
|
---|
142 | public function getNotes($name, $optParams = [])
|
---|
143 | {
|
---|
144 | $params = ['name' => $name];
|
---|
145 | $params = array_merge($params, $optParams);
|
---|
146 | return $this->call('getNotes', [$params], Note::class);
|
---|
147 | }
|
---|
148 | /**
|
---|
149 | * Gets a summary of the number and severity of occurrences.
|
---|
150 | * (occurrences.getVulnerabilitySummary)
|
---|
151 | *
|
---|
152 | * @param string $parent Required. The name of the project to get a
|
---|
153 | * vulnerability summary for in the form of `projects/[PROJECT_ID]`.
|
---|
154 | * @param array $optParams Optional parameters.
|
---|
155 | *
|
---|
156 | * @opt_param string filter The filter expression.
|
---|
157 | * @return VulnerabilityOccurrencesSummary
|
---|
158 | * @throws \Google\Service\Exception
|
---|
159 | */
|
---|
160 | public function getVulnerabilitySummary($parent, $optParams = [])
|
---|
161 | {
|
---|
162 | $params = ['parent' => $parent];
|
---|
163 | $params = array_merge($params, $optParams);
|
---|
164 | return $this->call('getVulnerabilitySummary', [$params], VulnerabilityOccurrencesSummary::class);
|
---|
165 | }
|
---|
166 | /**
|
---|
167 | * Lists occurrences for the specified project.
|
---|
168 | * (occurrences.listProjectsOccurrences)
|
---|
169 | *
|
---|
170 | * @param string $parent Required. The name of the project to list occurrences
|
---|
171 | * for in the form of `projects/[PROJECT_ID]`.
|
---|
172 | * @param array $optParams Optional parameters.
|
---|
173 | *
|
---|
174 | * @opt_param string filter The filter expression.
|
---|
175 | * @opt_param int pageSize Number of occurrences to return in the list. Must be
|
---|
176 | * positive. Max allowed page size is 1000. If not specified, page size defaults
|
---|
177 | * to 20.
|
---|
178 | * @opt_param string pageToken Token to provide to skip to a particular spot in
|
---|
179 | * the list.
|
---|
180 | * @return ListOccurrencesResponse
|
---|
181 | * @throws \Google\Service\Exception
|
---|
182 | */
|
---|
183 | public function listProjectsOccurrences($parent, $optParams = [])
|
---|
184 | {
|
---|
185 | $params = ['parent' => $parent];
|
---|
186 | $params = array_merge($params, $optParams);
|
---|
187 | return $this->call('list', [$params], ListOccurrencesResponse::class);
|
---|
188 | }
|
---|
189 | /**
|
---|
190 | * Updates the specified occurrence. (occurrences.patch)
|
---|
191 | *
|
---|
192 | * @param string $name Required. The name of the occurrence in the form of
|
---|
193 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
|
---|
194 | * @param Occurrence $postBody
|
---|
195 | * @param array $optParams Optional parameters.
|
---|
196 | *
|
---|
197 | * @opt_param string updateMask The fields to update.
|
---|
198 | * @return Occurrence
|
---|
199 | * @throws \Google\Service\Exception
|
---|
200 | */
|
---|
201 | public function patch($name, Occurrence $postBody, $optParams = [])
|
---|
202 | {
|
---|
203 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
204 | $params = array_merge($params, $optParams);
|
---|
205 | return $this->call('patch', [$params], Occurrence::class);
|
---|
206 | }
|
---|
207 | /**
|
---|
208 | * Sets the access control policy on the specified note or occurrence. Requires
|
---|
209 | * `containeranalysis.notes.setIamPolicy` or
|
---|
210 | * `containeranalysis.occurrences.setIamPolicy` permission if the resource is a
|
---|
211 | * note or an occurrence, respectively. The resource takes the format
|
---|
212 | * `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
|
---|
213 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
|
---|
214 | * (occurrences.setIamPolicy)
|
---|
215 | *
|
---|
216 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
217 | * specified. See [Resource
|
---|
218 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
219 | * appropriate value for this field.
|
---|
220 | * @param SetIamPolicyRequest $postBody
|
---|
221 | * @param array $optParams Optional parameters.
|
---|
222 | * @return Policy
|
---|
223 | * @throws \Google\Service\Exception
|
---|
224 | */
|
---|
225 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
226 | {
|
---|
227 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
228 | $params = array_merge($params, $optParams);
|
---|
229 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
230 | }
|
---|
231 | /**
|
---|
232 | * Returns the permissions that a caller has on the specified note or
|
---|
233 | * occurrence. Requires list permission on the project (for example,
|
---|
234 | * `containeranalysis.notes.list`). The resource takes the format
|
---|
235 | * `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
|
---|
236 | * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
|
---|
237 | * (occurrences.testIamPermissions)
|
---|
238 | *
|
---|
239 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
240 | * being requested. See [Resource
|
---|
241 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
242 | * appropriate value for this field.
|
---|
243 | * @param TestIamPermissionsRequest $postBody
|
---|
244 | * @param array $optParams Optional parameters.
|
---|
245 | * @return TestIamPermissionsResponse
|
---|
246 | * @throws \Google\Service\Exception
|
---|
247 | */
|
---|
248 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
249 | {
|
---|
250 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
251 | $params = array_merge($params, $optParams);
|
---|
252 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
253 | }
|
---|
254 | }
|
---|
255 |
|
---|
256 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
257 | class_alias(ProjectsOccurrences::class, 'Google_Service_ContainerAnalysis_Resource_ProjectsOccurrences');
|
---|