source: vendor/google/apiclient-services/src/CloudFunctions/Resource/ProjectsLocationsFunctions.php@ f9c482b

Last change on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 9 days ago

Upload new project files

  • Property mode set to 100644
File size: 17.7 KB
Line 
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
18namespace Google\Service\CloudFunctions\Resource;
19
20use Google\Service\CloudFunctions\AbortFunctionUpgradeRequest;
21use Google\Service\CloudFunctions\CloudfunctionsFunction;
22use Google\Service\CloudFunctions\CommitFunctionUpgradeRequest;
23use Google\Service\CloudFunctions\GenerateDownloadUrlRequest;
24use Google\Service\CloudFunctions\GenerateDownloadUrlResponse;
25use Google\Service\CloudFunctions\GenerateUploadUrlRequest;
26use Google\Service\CloudFunctions\GenerateUploadUrlResponse;
27use Google\Service\CloudFunctions\ListFunctionsResponse;
28use Google\Service\CloudFunctions\Operation;
29use Google\Service\CloudFunctions\Policy;
30use Google\Service\CloudFunctions\RedirectFunctionUpgradeTrafficRequest;
31use Google\Service\CloudFunctions\RollbackFunctionUpgradeTrafficRequest;
32use Google\Service\CloudFunctions\SetIamPolicyRequest;
33use Google\Service\CloudFunctions\SetupFunctionUpgradeConfigRequest;
34use Google\Service\CloudFunctions\TestIamPermissionsRequest;
35use Google\Service\CloudFunctions\TestIamPermissionsResponse;
36
37/**
38 * The "functions" collection of methods.
39 * Typical usage is:
40 * <code>
41 * $cloudfunctionsService = new Google\Service\CloudFunctions(...);
42 * $functions = $cloudfunctionsService->projects_locations_functions;
43 * </code>
44 */
45class ProjectsLocationsFunctions extends \Google\Service\Resource
46{
47 /**
48 * Aborts generation upgrade process for a function with the given name from the
49 * specified project. Deletes all 2nd Gen copy related configuration and
50 * resources which were created during the upgrade process.
51 * (functions.abortFunctionUpgrade)
52 *
53 * @param string $name Required. The name of the function for which upgrade
54 * should be aborted.
55 * @param AbortFunctionUpgradeRequest $postBody
56 * @param array $optParams Optional parameters.
57 * @return Operation
58 * @throws \Google\Service\Exception
59 */
60 public function abortFunctionUpgrade($name, AbortFunctionUpgradeRequest $postBody, $optParams = [])
61 {
62 $params = ['name' => $name, 'postBody' => $postBody];
63 $params = array_merge($params, $optParams);
64 return $this->call('abortFunctionUpgrade', [$params], Operation::class);
65 }
66 /**
67 * Finalizes the upgrade after which function upgrade can not be rolled back.
68 * This is the last step of the multi step process to upgrade 1st Gen functions
69 * to 2nd Gen. Deletes all original 1st Gen related configuration and resources.
70 * (functions.commitFunctionUpgrade)
71 *
72 * @param string $name Required. The name of the function for which upgrade
73 * should be finalized.
74 * @param CommitFunctionUpgradeRequest $postBody
75 * @param array $optParams Optional parameters.
76 * @return Operation
77 * @throws \Google\Service\Exception
78 */
79 public function commitFunctionUpgrade($name, CommitFunctionUpgradeRequest $postBody, $optParams = [])
80 {
81 $params = ['name' => $name, 'postBody' => $postBody];
82 $params = array_merge($params, $optParams);
83 return $this->call('commitFunctionUpgrade', [$params], Operation::class);
84 }
85 /**
86 * Creates a new function. If a function with the given name already exists in
87 * the specified project, the long running operation will return
88 * `ALREADY_EXISTS` error. (functions.create)
89 *
90 * @param string $parent Required. The project and location in which the
91 * function should be created, specified in the format `projects/locations`
92 * @param CloudfunctionsFunction $postBody
93 * @param array $optParams Optional parameters.
94 *
95 * @opt_param string functionId The ID to use for the function, which will
96 * become the final component of the function's resource name. This value should
97 * be 4-63 characters, and valid characters are /a-z-/.
98 * @return Operation
99 * @throws \Google\Service\Exception
100 */
101 public function create($parent, CloudfunctionsFunction $postBody, $optParams = [])
102 {
103 $params = ['parent' => $parent, 'postBody' => $postBody];
104 $params = array_merge($params, $optParams);
105 return $this->call('create', [$params], Operation::class);
106 }
107 /**
108 * Deletes a function with the given name from the specified project. If the
109 * given function is used by some trigger, the trigger will be updated to remove
110 * this function. (functions.delete)
111 *
112 * @param string $name Required. The name of the function which should be
113 * deleted.
114 * @param array $optParams Optional parameters.
115 * @return Operation
116 * @throws \Google\Service\Exception
117 */
118 public function delete($name, $optParams = [])
119 {
120 $params = ['name' => $name];
121 $params = array_merge($params, $optParams);
122 return $this->call('delete', [$params], Operation::class);
123 }
124 /**
125 * Returns a signed URL for downloading deployed function source code. The URL
126 * is only valid for a limited period and should be used within 30 minutes of
127 * generation. For more information about the signed URL usage see:
128 * https://cloud.google.com/storage/docs/access-control/signed-urls
129 * (functions.generateDownloadUrl)
130 *
131 * @param string $name Required. The name of function for which source code
132 * Google Cloud Storage signed URL should be generated.
133 * @param GenerateDownloadUrlRequest $postBody
134 * @param array $optParams Optional parameters.
135 * @return GenerateDownloadUrlResponse
136 * @throws \Google\Service\Exception
137 */
138 public function generateDownloadUrl($name, GenerateDownloadUrlRequest $postBody, $optParams = [])
139 {
140 $params = ['name' => $name, 'postBody' => $postBody];
141 $params = array_merge($params, $optParams);
142 return $this->call('generateDownloadUrl', [$params], GenerateDownloadUrlResponse::class);
143 }
144 /**
145 * Returns a signed URL for uploading a function source code. For more
146 * information about the signed URL usage see:
147 * https://cloud.google.com/storage/docs/access-control/signed-urls. Once the
148 * function source code upload is complete, the used signed URL should be
149 * provided in CreateFunction or UpdateFunction request as a reference to the
150 * function source code. When uploading source code to the generated signed URL,
151 * please follow these restrictions: * Source file type should be a zip file. *
152 * No credentials should be attached - the signed URLs provide access to the
153 * target bucket using internal service identity; if credentials were attached,
154 * the identity from the credentials would be used, but that identity does not
155 * have permissions to upload files to the URL. When making a HTTP PUT request,
156 * specify this header: * `content-type: application/zip` Do not specify this
157 * header: * `Authorization: Bearer YOUR_TOKEN` (functions.generateUploadUrl)
158 *
159 * @param string $parent Required. The project and location in which the Google
160 * Cloud Storage signed URL should be generated, specified in the format
161 * `projects/locations`.
162 * @param GenerateUploadUrlRequest $postBody
163 * @param array $optParams Optional parameters.
164 * @return GenerateUploadUrlResponse
165 * @throws \Google\Service\Exception
166 */
167 public function generateUploadUrl($parent, GenerateUploadUrlRequest $postBody, $optParams = [])
168 {
169 $params = ['parent' => $parent, 'postBody' => $postBody];
170 $params = array_merge($params, $optParams);
171 return $this->call('generateUploadUrl', [$params], GenerateUploadUrlResponse::class);
172 }
173 /**
174 * Returns a function with the given name from the requested project.
175 * (functions.get)
176 *
177 * @param string $name Required. The name of the function which details should
178 * be obtained.
179 * @param array $optParams Optional parameters.
180 *
181 * @opt_param string revision Optional. The optional version of the 1st gen
182 * function whose details should be obtained. The version of a 1st gen function
183 * is an integer that starts from 1 and gets incremented on redeployments. GCF
184 * may keep historical configs for old versions of 1st gen function. This field
185 * can be specified to fetch the historical configs. This field is valid only
186 * for GCF 1st gen function.
187 * @return CloudfunctionsFunction
188 * @throws \Google\Service\Exception
189 */
190 public function get($name, $optParams = [])
191 {
192 $params = ['name' => $name];
193 $params = array_merge($params, $optParams);
194 return $this->call('get', [$params], CloudfunctionsFunction::class);
195 }
196 /**
197 * Gets the access control policy for a resource. Returns an empty policy if the
198 * resource exists and does not have a policy set. (functions.getIamPolicy)
199 *
200 * @param string $resource REQUIRED: The resource for which the policy is being
201 * requested. See [Resource
202 * names](https://cloud.google.com/apis/design/resource_names) for the
203 * appropriate value for this field.
204 * @param array $optParams Optional parameters.
205 *
206 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
207 * version that will be used to format the policy. Valid values are 0, 1, and 3.
208 * Requests specifying an invalid value will be rejected. Requests for policies
209 * with any conditional role bindings must specify version 3. Policies with no
210 * conditional role bindings may specify any valid value or leave the field
211 * unset. The policy in the response might use the policy version that you
212 * specified, or it might use a lower policy version. For example, if you
213 * specify version 3, but the policy has no conditional role bindings, the
214 * response uses version 1. To learn which resources support conditions in their
215 * IAM policies, see the [IAM
216 * documentation](https://cloud.google.com/iam/help/conditions/resource-
217 * policies).
218 * @return Policy
219 * @throws \Google\Service\Exception
220 */
221 public function getIamPolicy($resource, $optParams = [])
222 {
223 $params = ['resource' => $resource];
224 $params = array_merge($params, $optParams);
225 return $this->call('getIamPolicy', [$params], Policy::class);
226 }
227 /**
228 * Returns a list of functions that belong to the requested project.
229 * (functions.listProjectsLocationsFunctions)
230 *
231 * @param string $parent Required. The project and location from which the
232 * function should be listed, specified in the format `projects/locations` If
233 * you want to list functions in all locations, use "-" in place of a location.
234 * When listing functions in all locations, if one or more location(s) are
235 * unreachable, the response will contain functions from all reachable locations
236 * along with the names of any unreachable locations.
237 * @param array $optParams Optional parameters.
238 *
239 * @opt_param string filter The filter for Functions that match the filter
240 * expression, following the syntax outlined in https://google.aip.dev/160.
241 * @opt_param string orderBy The sorting order of the resources returned. Value
242 * should be a comma separated list of fields. The default sorting oder is
243 * ascending. See https://google.aip.dev/132#ordering.
244 * @opt_param int pageSize Maximum number of functions to return per call. The
245 * largest allowed page_size is 1,000, if the page_size is omitted or specified
246 * as greater than 1,000 then it will be replaced as 1,000. The size of the list
247 * response can be less than specified when used with filters.
248 * @opt_param string pageToken The value returned by the last
249 * `ListFunctionsResponse`; indicates that this is a continuation of a prior
250 * `ListFunctions` call, and that the system should return the next page of
251 * data.
252 * @return ListFunctionsResponse
253 * @throws \Google\Service\Exception
254 */
255 public function listProjectsLocationsFunctions($parent, $optParams = [])
256 {
257 $params = ['parent' => $parent];
258 $params = array_merge($params, $optParams);
259 return $this->call('list', [$params], ListFunctionsResponse::class);
260 }
261 /**
262 * Updates existing function. (functions.patch)
263 *
264 * @param string $name A user-defined name of the function. Function names must
265 * be unique globally and match pattern `projects/locations/functions`
266 * @param CloudfunctionsFunction $postBody
267 * @param array $optParams Optional parameters.
268 *
269 * @opt_param string updateMask The list of fields to be updated. If no field
270 * mask is provided, all fields will be updated.
271 * @return Operation
272 * @throws \Google\Service\Exception
273 */
274 public function patch($name, CloudfunctionsFunction $postBody, $optParams = [])
275 {
276 $params = ['name' => $name, 'postBody' => $postBody];
277 $params = array_merge($params, $optParams);
278 return $this->call('patch', [$params], Operation::class);
279 }
280 /**
281 * Changes the traffic target of a function from the original 1st Gen function
282 * to the 2nd Gen copy. This is the second step of the multi step process to
283 * upgrade 1st Gen functions to 2nd Gen. After this operation, all new traffic
284 * will be served by 2nd Gen copy. (functions.redirectFunctionUpgradeTraffic)
285 *
286 * @param string $name Required. The name of the function for which traffic
287 * target should be changed to 2nd Gen from 1st Gen.
288 * @param RedirectFunctionUpgradeTrafficRequest $postBody
289 * @param array $optParams Optional parameters.
290 * @return Operation
291 * @throws \Google\Service\Exception
292 */
293 public function redirectFunctionUpgradeTraffic($name, RedirectFunctionUpgradeTrafficRequest $postBody, $optParams = [])
294 {
295 $params = ['name' => $name, 'postBody' => $postBody];
296 $params = array_merge($params, $optParams);
297 return $this->call('redirectFunctionUpgradeTraffic', [$params], Operation::class);
298 }
299 /**
300 * Reverts the traffic target of a function from the 2nd Gen copy to the
301 * original 1st Gen function. After this operation, all new traffic would be
302 * served by the 1st Gen. (functions.rollbackFunctionUpgradeTraffic)
303 *
304 * @param string $name Required. The name of the function for which traffic
305 * target should be changed back to 1st Gen from 2nd Gen.
306 * @param RollbackFunctionUpgradeTrafficRequest $postBody
307 * @param array $optParams Optional parameters.
308 * @return Operation
309 * @throws \Google\Service\Exception
310 */
311 public function rollbackFunctionUpgradeTraffic($name, RollbackFunctionUpgradeTrafficRequest $postBody, $optParams = [])
312 {
313 $params = ['name' => $name, 'postBody' => $postBody];
314 $params = array_merge($params, $optParams);
315 return $this->call('rollbackFunctionUpgradeTraffic', [$params], Operation::class);
316 }
317 /**
318 * Sets the access control policy on the specified resource. Replaces any
319 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
320 * `PERMISSION_DENIED` errors. (functions.setIamPolicy)
321 *
322 * @param string $resource REQUIRED: The resource for which the policy is being
323 * specified. See [Resource
324 * names](https://cloud.google.com/apis/design/resource_names) for the
325 * appropriate value for this field.
326 * @param SetIamPolicyRequest $postBody
327 * @param array $optParams Optional parameters.
328 * @return Policy
329 * @throws \Google\Service\Exception
330 */
331 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
332 {
333 $params = ['resource' => $resource, 'postBody' => $postBody];
334 $params = array_merge($params, $optParams);
335 return $this->call('setIamPolicy', [$params], Policy::class);
336 }
337 /**
338 * Creates a 2nd Gen copy of the function configuration based on the 1st Gen
339 * function with the given name. This is the first step of the multi step
340 * process to upgrade 1st Gen functions to 2nd Gen. Only 2nd Gen configuration
341 * is setup as part of this request and traffic continues to be served by 1st
342 * Gen. (functions.setupFunctionUpgradeConfig)
343 *
344 * @param string $name Required. The name of the function which should have
345 * configuration copied for upgrade.
346 * @param SetupFunctionUpgradeConfigRequest $postBody
347 * @param array $optParams Optional parameters.
348 * @return Operation
349 * @throws \Google\Service\Exception
350 */
351 public function setupFunctionUpgradeConfig($name, SetupFunctionUpgradeConfigRequest $postBody, $optParams = [])
352 {
353 $params = ['name' => $name, 'postBody' => $postBody];
354 $params = array_merge($params, $optParams);
355 return $this->call('setupFunctionUpgradeConfig', [$params], Operation::class);
356 }
357 /**
358 * Returns permissions that a caller has on the specified resource. If the
359 * resource does not exist, this will return an empty set of permissions, not a
360 * `NOT_FOUND` error. Note: This operation is designed to be used for building
361 * permission-aware UIs and command-line tools, not for authorization checking.
362 * This operation may "fail open" without warning.
363 * (functions.testIamPermissions)
364 *
365 * @param string $resource REQUIRED: The resource for which the policy detail is
366 * being requested. See [Resource
367 * names](https://cloud.google.com/apis/design/resource_names) for the
368 * appropriate value for this field.
369 * @param TestIamPermissionsRequest $postBody
370 * @param array $optParams Optional parameters.
371 * @return TestIamPermissionsResponse
372 * @throws \Google\Service\Exception
373 */
374 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
375 {
376 $params = ['resource' => $resource, 'postBody' => $postBody];
377 $params = array_merge($params, $optParams);
378 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
379 }
380}
381
382// Adding a class alias for backwards compatibility with the previous class name.
383class_alias(ProjectsLocationsFunctions::class, 'Google_Service_CloudFunctions_Resource_ProjectsLocationsFunctions');
Note: See TracBrowser for help on using the repository browser.