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\BatchCreateNotesRequest;
21 use Google\Service\ContainerAnalysis\BatchCreateNotesResponse;
22 use Google\Service\ContainerAnalysis\ContaineranalysisEmpty;
23 use Google\Service\ContainerAnalysis\GetIamPolicyRequest;
24 use Google\Service\ContainerAnalysis\ListNotesResponse;
25 use Google\Service\ContainerAnalysis\Note;
26 use Google\Service\ContainerAnalysis\Policy;
27 use Google\Service\ContainerAnalysis\SetIamPolicyRequest;
28 use Google\Service\ContainerAnalysis\TestIamPermissionsRequest;
29 use Google\Service\ContainerAnalysis\TestIamPermissionsResponse;
30 
31 /**
32  * The "notes" collection of methods.
33  * Typical usage is:
34  *  <code>
35  *   $containeranalysisService = new Google\Service\ContainerAnalysis(...);
36  *   $notes = $containeranalysisService->notes;
37  *  </code>
38  */
39 class ProjectsNotes extends \Google\Service\Resource
40 {
41   /**
42    * Creates new notes in batch. (notes.batchCreate)
43    *
44    * @param string $parent Required. The name of the project in the form of
45    * `projects/[PROJECT_ID]`, under which the notes are to be created.
46    * @param BatchCreateNotesRequest $postBody
47    * @param array $optParams Optional parameters.
48    * @return BatchCreateNotesResponse
49    */
50   public function batchCreate($parent, BatchCreateNotesRequest $postBody, $optParams = [])
51   {
52     $params = ['parent' => $parent, 'postBody' => $postBody];
53     $params = array_merge($params, $optParams);
54     return $this->call('batchCreate', [$params], BatchCreateNotesResponse::class);
55   }
56   /**
57    * Creates a new note. (notes.create)
58    *
59    * @param string $parent Required. The name of the project in the form of
60    * `projects/[PROJECT_ID]`, under which the note is to be created.
61    * @param Note $postBody
62    * @param array $optParams Optional parameters.
63    *
64    * @opt_param string noteId Required. The ID to use for this note.
65    * @return Note
66    */
67   public function create($parent, Note $postBody, $optParams = [])
68   {
69     $params = ['parent' => $parent, 'postBody' => $postBody];
70     $params = array_merge($params, $optParams);
71     return $this->call('create', [$params], Note::class);
72   }
73   /**
74    * Deletes the specified note. (notes.delete)
75    *
76    * @param string $name Required. The name of the note in the form of
77    * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
78    * @param array $optParams Optional parameters.
79    * @return ContaineranalysisEmpty
80    */
81   public function delete($name, $optParams = [])
82   {
83     $params = ['name' => $name];
84     $params = array_merge($params, $optParams);
85     return $this->call('delete', [$params], ContaineranalysisEmpty::class);
86   }
87   /**
88    * Gets the specified note. (notes.get)
89    *
90    * @param string $name Required. The name of the note in the form of
91    * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
92    * @param array $optParams Optional parameters.
93    * @return Note
94    */
95   public function get($name, $optParams = [])
96   {
97     $params = ['name' => $name];
98     $params = array_merge($params, $optParams);
99     return $this->call('get', [$params], Note::class);
100   }
101   /**
102    * Gets the access control policy for a note or an occurrence resource. Requires
103    * `containeranalysis.notes.setIamPolicy` or
104    * `containeranalysis.occurrences.setIamPolicy` permission if the resource is a
105    * note or occurrence, respectively. The resource takes the format
106    * `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
107    * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
108    * (notes.getIamPolicy)
109    *
110    * @param string $resource REQUIRED: The resource for which the policy is being
111    * requested. See the operation documentation for the appropriate value for this
112    * field.
113    * @param GetIamPolicyRequest $postBody
114    * @param array $optParams Optional parameters.
115    * @return Policy
116    */
117   public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
118   {
119     $params = ['resource' => $resource, 'postBody' => $postBody];
120     $params = array_merge($params, $optParams);
121     return $this->call('getIamPolicy', [$params], Policy::class);
122   }
123   /**
124    * Lists notes for the specified project. (notes.listProjectsNotes)
125    *
126    * @param string $parent Required. The name of the project to list notes for in
127    * the form of `projects/[PROJECT_ID]`.
128    * @param array $optParams Optional parameters.
129    *
130    * @opt_param string filter The filter expression.
131    * @opt_param int pageSize Number of notes to return in the list. Must be
132    * positive. Max allowed page size is 1000. If not specified, page size defaults
133    * to 20.
134    * @opt_param string pageToken Token to provide to skip to a particular spot in
135    * the list.
136    * @return ListNotesResponse
137    */
138   public function listProjectsNotes($parent, $optParams = [])
139   {
140     $params = ['parent' => $parent];
141     $params = array_merge($params, $optParams);
142     return $this->call('list', [$params], ListNotesResponse::class);
143   }
144   /**
145    * Updates the specified note. (notes.patch)
146    *
147    * @param string $name Required. The name of the note in the form of
148    * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
149    * @param Note $postBody
150    * @param array $optParams Optional parameters.
151    *
152    * @opt_param string updateMask The fields to update.
153    * @return Note
154    */
155   public function patch($name, Note $postBody, $optParams = [])
156   {
157     $params = ['name' => $name, 'postBody' => $postBody];
158     $params = array_merge($params, $optParams);
159     return $this->call('patch', [$params], Note::class);
160   }
161   /**
162    * Sets the access control policy on the specified note or occurrence. Requires
163    * `containeranalysis.notes.setIamPolicy` or
164    * `containeranalysis.occurrences.setIamPolicy` permission if the resource is a
165    * note or an occurrence, respectively. The resource takes the format
166    * `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
167    * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
168    * (notes.setIamPolicy)
169    *
170    * @param string $resource REQUIRED: The resource for which the policy is being
171    * specified. See the operation documentation for the appropriate value for this
172    * field.
173    * @param SetIamPolicyRequest $postBody
174    * @param array $optParams Optional parameters.
175    * @return Policy
176    */
177   public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
178   {
179     $params = ['resource' => $resource, 'postBody' => $postBody];
180     $params = array_merge($params, $optParams);
181     return $this->call('setIamPolicy', [$params], Policy::class);
182   }
183   /**
184    * Returns the permissions that a caller has on the specified note or
185    * occurrence. Requires list permission on the project (for example,
186    * `containeranalysis.notes.list`). The resource takes the format
187    * `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and
188    * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
189    * (notes.testIamPermissions)
190    *
191    * @param string $resource REQUIRED: The resource for which the policy detail is
192    * being requested. See the operation documentation for the appropriate value
193    * for this field.
194    * @param TestIamPermissionsRequest $postBody
195    * @param array $optParams Optional parameters.
196    * @return TestIamPermissionsResponse
197    */
198   public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
199   {
200     $params = ['resource' => $resource, 'postBody' => $postBody];
201     $params = array_merge($params, $optParams);
202     return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
203   }
204 }
205 
206 // Adding a class alias for backwards compatibility with the previous class name.
207 class_alias(ProjectsNotes::class, 'Google_Service_ContainerAnalysis_Resource_ProjectsNotes');
208