google-apis-cloudfunctions_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,594 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudfunctionsV1
23
+ # Cloud Functions API
24
+ #
25
+ # Manages lightweight user-provided functions executed in response to events.
26
+ #
27
+ # @example
28
+ # require 'google/apis/cloudfunctions_v1'
29
+ #
30
+ # Cloudfunctions = Google::Apis::CloudfunctionsV1 # Alias the module
31
+ # service = Cloudfunctions::CloudFunctionsService.new
32
+ #
33
+ # @see https://cloud.google.com/functions
34
+ class CloudFunctionsService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://cloudfunctions.googleapis.com/', '',
47
+ client_name: 'google-apis-cloudfunctions_v1',
48
+ client_version: Google::Apis::CloudfunctionsV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Gets the latest state of a long-running operation. Clients can use this method
53
+ # to poll the operation result at intervals as recommended by the API service.
54
+ # @param [String] name
55
+ # The name of the operation resource.
56
+ # @param [String] fields
57
+ # Selector specifying which fields to include in a partial response.
58
+ # @param [String] quota_user
59
+ # Available to use for quota purposes for server-side applications. Can be any
60
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
61
+ # @param [Google::Apis::RequestOptions] options
62
+ # Request-specific options
63
+ #
64
+ # @yield [result, err] Result & error if block supplied
65
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::Operation] parsed result object
66
+ # @yieldparam err [StandardError] error object if request failed
67
+ #
68
+ # @return [Google::Apis::CloudfunctionsV1::Operation]
69
+ #
70
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
71
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
72
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
73
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
74
+ command = make_simple_command(:get, 'v1/{+name}', options)
75
+ command.response_representation = Google::Apis::CloudfunctionsV1::Operation::Representation
76
+ command.response_class = Google::Apis::CloudfunctionsV1::Operation
77
+ command.params['name'] = name unless name.nil?
78
+ command.query['fields'] = fields unless fields.nil?
79
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
80
+ execute_or_queue_command(command, &block)
81
+ end
82
+
83
+ # Lists operations that match the specified filter in the request. If the server
84
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
85
+ # binding allows API services to override the binding to use different resource
86
+ # name schemes, such as `users/*/operations`. To override the binding, API
87
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
88
+ # service configuration. For backwards compatibility, the default name includes
89
+ # the operations collection id, however overriding users must ensure the name
90
+ # binding is the parent resource, without the operations collection id.
91
+ # @param [String] filter
92
+ # Required. A filter for matching the requested operations. The supported
93
+ # formats of *filter* are: To query for a specific function: project:*,location:*
94
+ # ,function:* To query for all of the latest operations for a project: project:*,
95
+ # latest:true
96
+ # @param [String] name
97
+ # Must not be set.
98
+ # @param [Fixnum] page_size
99
+ # The maximum number of records that should be returned. Requested page size
100
+ # cannot exceed 100. If not set, the default page size is 100. Pagination is
101
+ # only supported when querying for a specific function.
102
+ # @param [String] page_token
103
+ # Token identifying which result to start with, which is returned by a previous
104
+ # list call. Pagination is only supported when querying for a specific function.
105
+ # @param [String] fields
106
+ # Selector specifying which fields to include in a partial response.
107
+ # @param [String] quota_user
108
+ # Available to use for quota purposes for server-side applications. Can be any
109
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
110
+ # @param [Google::Apis::RequestOptions] options
111
+ # Request-specific options
112
+ #
113
+ # @yield [result, err] Result & error if block supplied
114
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::ListOperationsResponse] parsed result object
115
+ # @yieldparam err [StandardError] error object if request failed
116
+ #
117
+ # @return [Google::Apis::CloudfunctionsV1::ListOperationsResponse]
118
+ #
119
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
120
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
121
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
122
+ def list_operations(filter: nil, name: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
123
+ command = make_simple_command(:get, 'v1/operations', options)
124
+ command.response_representation = Google::Apis::CloudfunctionsV1::ListOperationsResponse::Representation
125
+ command.response_class = Google::Apis::CloudfunctionsV1::ListOperationsResponse
126
+ command.query['filter'] = filter unless filter.nil?
127
+ command.query['name'] = name unless name.nil?
128
+ command.query['pageSize'] = page_size unless page_size.nil?
129
+ command.query['pageToken'] = page_token unless page_token.nil?
130
+ command.query['fields'] = fields unless fields.nil?
131
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
132
+ execute_or_queue_command(command, &block)
133
+ end
134
+
135
+ # Lists information about the supported locations for this service.
136
+ # @param [String] name
137
+ # The resource that owns the locations collection, if applicable.
138
+ # @param [String] filter
139
+ # The standard list filter.
140
+ # @param [Fixnum] page_size
141
+ # The standard list page size.
142
+ # @param [String] page_token
143
+ # The standard list page token.
144
+ # @param [String] fields
145
+ # Selector specifying which fields to include in a partial response.
146
+ # @param [String] quota_user
147
+ # Available to use for quota purposes for server-side applications. Can be any
148
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
149
+ # @param [Google::Apis::RequestOptions] options
150
+ # Request-specific options
151
+ #
152
+ # @yield [result, err] Result & error if block supplied
153
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::ListLocationsResponse] parsed result object
154
+ # @yieldparam err [StandardError] error object if request failed
155
+ #
156
+ # @return [Google::Apis::CloudfunctionsV1::ListLocationsResponse]
157
+ #
158
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
159
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
160
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
161
+ def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
162
+ command = make_simple_command(:get, 'v1/{+name}/locations', options)
163
+ command.response_representation = Google::Apis::CloudfunctionsV1::ListLocationsResponse::Representation
164
+ command.response_class = Google::Apis::CloudfunctionsV1::ListLocationsResponse
165
+ command.params['name'] = name unless name.nil?
166
+ command.query['filter'] = filter unless filter.nil?
167
+ command.query['pageSize'] = page_size unless page_size.nil?
168
+ command.query['pageToken'] = page_token unless page_token.nil?
169
+ command.query['fields'] = fields unless fields.nil?
170
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
171
+ execute_or_queue_command(command, &block)
172
+ end
173
+
174
+ # Synchronously invokes a deployed Cloud Function. To be used for testing
175
+ # purposes as very limited traffic is allowed. For more information on the
176
+ # actual limits, refer to [Rate Limits](https://cloud.google.com/functions/
177
+ # quotas#rate_limits).
178
+ # @param [String] name
179
+ # Required. The name of the function to be called.
180
+ # @param [Google::Apis::CloudfunctionsV1::CallFunctionRequest] call_function_request_object
181
+ # @param [String] fields
182
+ # Selector specifying which fields to include in a partial response.
183
+ # @param [String] quota_user
184
+ # Available to use for quota purposes for server-side applications. Can be any
185
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
186
+ # @param [Google::Apis::RequestOptions] options
187
+ # Request-specific options
188
+ #
189
+ # @yield [result, err] Result & error if block supplied
190
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::CallFunctionResponse] parsed result object
191
+ # @yieldparam err [StandardError] error object if request failed
192
+ #
193
+ # @return [Google::Apis::CloudfunctionsV1::CallFunctionResponse]
194
+ #
195
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
196
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
197
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
198
+ def call_function(name, call_function_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
199
+ command = make_simple_command(:post, 'v1/{+name}:call', options)
200
+ command.request_representation = Google::Apis::CloudfunctionsV1::CallFunctionRequest::Representation
201
+ command.request_object = call_function_request_object
202
+ command.response_representation = Google::Apis::CloudfunctionsV1::CallFunctionResponse::Representation
203
+ command.response_class = Google::Apis::CloudfunctionsV1::CallFunctionResponse
204
+ command.params['name'] = name unless name.nil?
205
+ command.query['fields'] = fields unless fields.nil?
206
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
207
+ execute_or_queue_command(command, &block)
208
+ end
209
+
210
+ # Creates a new function. If a function with the given name already exists in
211
+ # the specified project, the long running operation will return `ALREADY_EXISTS`
212
+ # error.
213
+ # @param [String] location
214
+ # Required. The project and location in which the function should be created,
215
+ # specified in the format `projects/*/locations/*`
216
+ # @param [Google::Apis::CloudfunctionsV1::CloudFunction] cloud_function_object
217
+ # @param [String] fields
218
+ # Selector specifying which fields to include in a partial response.
219
+ # @param [String] quota_user
220
+ # Available to use for quota purposes for server-side applications. Can be any
221
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
222
+ # @param [Google::Apis::RequestOptions] options
223
+ # Request-specific options
224
+ #
225
+ # @yield [result, err] Result & error if block supplied
226
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::Operation] parsed result object
227
+ # @yieldparam err [StandardError] error object if request failed
228
+ #
229
+ # @return [Google::Apis::CloudfunctionsV1::Operation]
230
+ #
231
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
232
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
233
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
234
+ def create_project_location_function(location, cloud_function_object = nil, fields: nil, quota_user: nil, options: nil, &block)
235
+ command = make_simple_command(:post, 'v1/{+location}/functions', options)
236
+ command.request_representation = Google::Apis::CloudfunctionsV1::CloudFunction::Representation
237
+ command.request_object = cloud_function_object
238
+ command.response_representation = Google::Apis::CloudfunctionsV1::Operation::Representation
239
+ command.response_class = Google::Apis::CloudfunctionsV1::Operation
240
+ command.params['location'] = location unless location.nil?
241
+ command.query['fields'] = fields unless fields.nil?
242
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
243
+ execute_or_queue_command(command, &block)
244
+ end
245
+
246
+ # Deletes a function with the given name from the specified project. If the
247
+ # given function is used by some trigger, the trigger will be updated to remove
248
+ # this function.
249
+ # @param [String] name
250
+ # Required. The name of the function which should be deleted.
251
+ # @param [String] fields
252
+ # Selector specifying which fields to include in a partial response.
253
+ # @param [String] quota_user
254
+ # Available to use for quota purposes for server-side applications. Can be any
255
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
256
+ # @param [Google::Apis::RequestOptions] options
257
+ # Request-specific options
258
+ #
259
+ # @yield [result, err] Result & error if block supplied
260
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::Operation] parsed result object
261
+ # @yieldparam err [StandardError] error object if request failed
262
+ #
263
+ # @return [Google::Apis::CloudfunctionsV1::Operation]
264
+ #
265
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
266
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
267
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
268
+ def delete_project_location_function(name, fields: nil, quota_user: nil, options: nil, &block)
269
+ command = make_simple_command(:delete, 'v1/{+name}', options)
270
+ command.response_representation = Google::Apis::CloudfunctionsV1::Operation::Representation
271
+ command.response_class = Google::Apis::CloudfunctionsV1::Operation
272
+ command.params['name'] = name unless name.nil?
273
+ command.query['fields'] = fields unless fields.nil?
274
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
275
+ execute_or_queue_command(command, &block)
276
+ end
277
+
278
+ # Returns a signed URL for downloading deployed function source code. The URL is
279
+ # only valid for a limited period and should be used within minutes after
280
+ # generation. For more information about the signed URL usage see: https://cloud.
281
+ # google.com/storage/docs/access-control/signed-urls
282
+ # @param [String] name
283
+ # The name of function for which source code Google Cloud Storage signed URL
284
+ # should be generated.
285
+ # @param [Google::Apis::CloudfunctionsV1::GenerateDownloadUrlRequest] generate_download_url_request_object
286
+ # @param [String] fields
287
+ # Selector specifying which fields to include in a partial response.
288
+ # @param [String] quota_user
289
+ # Available to use for quota purposes for server-side applications. Can be any
290
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
291
+ # @param [Google::Apis::RequestOptions] options
292
+ # Request-specific options
293
+ #
294
+ # @yield [result, err] Result & error if block supplied
295
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::GenerateDownloadUrlResponse] parsed result object
296
+ # @yieldparam err [StandardError] error object if request failed
297
+ #
298
+ # @return [Google::Apis::CloudfunctionsV1::GenerateDownloadUrlResponse]
299
+ #
300
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
301
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
302
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
303
+ def generate_function_download_url(name, generate_download_url_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
304
+ command = make_simple_command(:post, 'v1/{+name}:generateDownloadUrl', options)
305
+ command.request_representation = Google::Apis::CloudfunctionsV1::GenerateDownloadUrlRequest::Representation
306
+ command.request_object = generate_download_url_request_object
307
+ command.response_representation = Google::Apis::CloudfunctionsV1::GenerateDownloadUrlResponse::Representation
308
+ command.response_class = Google::Apis::CloudfunctionsV1::GenerateDownloadUrlResponse
309
+ command.params['name'] = name unless name.nil?
310
+ command.query['fields'] = fields unless fields.nil?
311
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
312
+ execute_or_queue_command(command, &block)
313
+ end
314
+
315
+ # Returns a signed URL for uploading a function source code. For more
316
+ # information about the signed URL usage see: https://cloud.google.com/storage/
317
+ # docs/access-control/signed-urls. Once the function source code upload is
318
+ # complete, the used signed URL should be provided in CreateFunction or
319
+ # UpdateFunction request as a reference to the function source code. When
320
+ # uploading source code to the generated signed URL, please follow these
321
+ # restrictions: * Source file type should be a zip file. * Source file size
322
+ # should not exceed 100MB limit. * No credentials should be attached - the
323
+ # signed URLs provide access to the target bucket using internal service
324
+ # identity; if credentials were attached, the identity from the credentials
325
+ # would be used, but that identity does not have permissions to upload files to
326
+ # the URL. When making a HTTP PUT request, these two headers need to be
327
+ # specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,
328
+ # 104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer
329
+ # YOUR_TOKEN`
330
+ # @param [String] parent
331
+ # The project and location in which the Google Cloud Storage signed URL should
332
+ # be generated, specified in the format `projects/*/locations/*`.
333
+ # @param [Google::Apis::CloudfunctionsV1::GenerateUploadUrlRequest] generate_upload_url_request_object
334
+ # @param [String] fields
335
+ # Selector specifying which fields to include in a partial response.
336
+ # @param [String] quota_user
337
+ # Available to use for quota purposes for server-side applications. Can be any
338
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
339
+ # @param [Google::Apis::RequestOptions] options
340
+ # Request-specific options
341
+ #
342
+ # @yield [result, err] Result & error if block supplied
343
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::GenerateUploadUrlResponse] parsed result object
344
+ # @yieldparam err [StandardError] error object if request failed
345
+ #
346
+ # @return [Google::Apis::CloudfunctionsV1::GenerateUploadUrlResponse]
347
+ #
348
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
349
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
350
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
351
+ def generate_function_upload_url(parent, generate_upload_url_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
352
+ command = make_simple_command(:post, 'v1/{+parent}/functions:generateUploadUrl', options)
353
+ command.request_representation = Google::Apis::CloudfunctionsV1::GenerateUploadUrlRequest::Representation
354
+ command.request_object = generate_upload_url_request_object
355
+ command.response_representation = Google::Apis::CloudfunctionsV1::GenerateUploadUrlResponse::Representation
356
+ command.response_class = Google::Apis::CloudfunctionsV1::GenerateUploadUrlResponse
357
+ command.params['parent'] = parent unless parent.nil?
358
+ command.query['fields'] = fields unless fields.nil?
359
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
360
+ execute_or_queue_command(command, &block)
361
+ end
362
+
363
+ # Returns a function with the given name from the requested project.
364
+ # @param [String] name
365
+ # Required. The name of the function which details should be obtained.
366
+ # @param [String] fields
367
+ # Selector specifying which fields to include in a partial response.
368
+ # @param [String] quota_user
369
+ # Available to use for quota purposes for server-side applications. Can be any
370
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
371
+ # @param [Google::Apis::RequestOptions] options
372
+ # Request-specific options
373
+ #
374
+ # @yield [result, err] Result & error if block supplied
375
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::CloudFunction] parsed result object
376
+ # @yieldparam err [StandardError] error object if request failed
377
+ #
378
+ # @return [Google::Apis::CloudfunctionsV1::CloudFunction]
379
+ #
380
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
381
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
382
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
383
+ def get_project_location_function(name, fields: nil, quota_user: nil, options: nil, &block)
384
+ command = make_simple_command(:get, 'v1/{+name}', options)
385
+ command.response_representation = Google::Apis::CloudfunctionsV1::CloudFunction::Representation
386
+ command.response_class = Google::Apis::CloudfunctionsV1::CloudFunction
387
+ command.params['name'] = name unless name.nil?
388
+ command.query['fields'] = fields unless fields.nil?
389
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
390
+ execute_or_queue_command(command, &block)
391
+ end
392
+
393
+ # Gets the IAM access control policy for a function. Returns an empty policy if
394
+ # the function exists and does not have a policy set.
395
+ # @param [String] resource
396
+ # REQUIRED: The resource for which the policy is being requested. See the
397
+ # operation documentation for the appropriate value for this field.
398
+ # @param [Fixnum] options_requested_policy_version
399
+ # Optional. The policy format version to be returned. Valid values are 0, 1, and
400
+ # 3. Requests specifying an invalid value will be rejected. Requests for
401
+ # policies with any conditional bindings must specify version 3. Policies
402
+ # without any conditional bindings may specify any valid value or leave the
403
+ # field unset. To learn which resources support conditions in their IAM policies,
404
+ # see the [IAM documentation](https://cloud.google.com/iam/help/conditions/
405
+ # resource-policies).
406
+ # @param [String] fields
407
+ # Selector specifying which fields to include in a partial response.
408
+ # @param [String] quota_user
409
+ # Available to use for quota purposes for server-side applications. Can be any
410
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
411
+ # @param [Google::Apis::RequestOptions] options
412
+ # Request-specific options
413
+ #
414
+ # @yield [result, err] Result & error if block supplied
415
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::Policy] parsed result object
416
+ # @yieldparam err [StandardError] error object if request failed
417
+ #
418
+ # @return [Google::Apis::CloudfunctionsV1::Policy]
419
+ #
420
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
421
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
422
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
423
+ def get_project_location_function_iam_policy(resource, options_requested_policy_version: nil, fields: nil, quota_user: nil, options: nil, &block)
424
+ command = make_simple_command(:get, 'v1/{+resource}:getIamPolicy', options)
425
+ command.response_representation = Google::Apis::CloudfunctionsV1::Policy::Representation
426
+ command.response_class = Google::Apis::CloudfunctionsV1::Policy
427
+ command.params['resource'] = resource unless resource.nil?
428
+ command.query['options.requestedPolicyVersion'] = options_requested_policy_version unless options_requested_policy_version.nil?
429
+ command.query['fields'] = fields unless fields.nil?
430
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
431
+ execute_or_queue_command(command, &block)
432
+ end
433
+
434
+ # Returns a list of functions that belong to the requested project.
435
+ # @param [String] parent
436
+ # The project and location from which the function should be listed, specified
437
+ # in the format `projects/*/locations/*` If you want to list functions in all
438
+ # locations, use "-" in place of a location. When listing functions in all
439
+ # locations, if one or more location(s) are unreachable, the response will
440
+ # contain functions from all reachable locations along with the names of any
441
+ # unreachable locations.
442
+ # @param [Fixnum] page_size
443
+ # Maximum number of functions to return per call.
444
+ # @param [String] page_token
445
+ # The value returned by the last `ListFunctionsResponse`; indicates that this is
446
+ # a continuation of a prior `ListFunctions` call, and that the system should
447
+ # return the next page of data.
448
+ # @param [String] fields
449
+ # Selector specifying which fields to include in a partial response.
450
+ # @param [String] quota_user
451
+ # Available to use for quota purposes for server-side applications. Can be any
452
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
453
+ # @param [Google::Apis::RequestOptions] options
454
+ # Request-specific options
455
+ #
456
+ # @yield [result, err] Result & error if block supplied
457
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::ListFunctionsResponse] parsed result object
458
+ # @yieldparam err [StandardError] error object if request failed
459
+ #
460
+ # @return [Google::Apis::CloudfunctionsV1::ListFunctionsResponse]
461
+ #
462
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
463
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
464
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
465
+ def list_project_location_functions(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
466
+ command = make_simple_command(:get, 'v1/{+parent}/functions', options)
467
+ command.response_representation = Google::Apis::CloudfunctionsV1::ListFunctionsResponse::Representation
468
+ command.response_class = Google::Apis::CloudfunctionsV1::ListFunctionsResponse
469
+ command.params['parent'] = parent unless parent.nil?
470
+ command.query['pageSize'] = page_size unless page_size.nil?
471
+ command.query['pageToken'] = page_token unless page_token.nil?
472
+ command.query['fields'] = fields unless fields.nil?
473
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
474
+ execute_or_queue_command(command, &block)
475
+ end
476
+
477
+ # Updates existing function.
478
+ # @param [String] name
479
+ # A user-defined name of the function. Function names must be unique globally
480
+ # and match pattern `projects/*/locations/*/functions/*`
481
+ # @param [Google::Apis::CloudfunctionsV1::CloudFunction] cloud_function_object
482
+ # @param [String] update_mask
483
+ # Required list of fields to be updated in this request.
484
+ # @param [String] fields
485
+ # Selector specifying which fields to include in a partial response.
486
+ # @param [String] quota_user
487
+ # Available to use for quota purposes for server-side applications. Can be any
488
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
489
+ # @param [Google::Apis::RequestOptions] options
490
+ # Request-specific options
491
+ #
492
+ # @yield [result, err] Result & error if block supplied
493
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::Operation] parsed result object
494
+ # @yieldparam err [StandardError] error object if request failed
495
+ #
496
+ # @return [Google::Apis::CloudfunctionsV1::Operation]
497
+ #
498
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
499
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
500
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
501
+ def patch_project_location_function(name, cloud_function_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
502
+ command = make_simple_command(:patch, 'v1/{+name}', options)
503
+ command.request_representation = Google::Apis::CloudfunctionsV1::CloudFunction::Representation
504
+ command.request_object = cloud_function_object
505
+ command.response_representation = Google::Apis::CloudfunctionsV1::Operation::Representation
506
+ command.response_class = Google::Apis::CloudfunctionsV1::Operation
507
+ command.params['name'] = name unless name.nil?
508
+ command.query['updateMask'] = update_mask unless update_mask.nil?
509
+ command.query['fields'] = fields unless fields.nil?
510
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
511
+ execute_or_queue_command(command, &block)
512
+ end
513
+
514
+ # Sets the IAM access control policy on the specified function. Replaces any
515
+ # existing policy.
516
+ # @param [String] resource
517
+ # REQUIRED: The resource for which the policy is being specified. See the
518
+ # operation documentation for the appropriate value for this field.
519
+ # @param [Google::Apis::CloudfunctionsV1::SetIamPolicyRequest] set_iam_policy_request_object
520
+ # @param [String] fields
521
+ # Selector specifying which fields to include in a partial response.
522
+ # @param [String] quota_user
523
+ # Available to use for quota purposes for server-side applications. Can be any
524
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
525
+ # @param [Google::Apis::RequestOptions] options
526
+ # Request-specific options
527
+ #
528
+ # @yield [result, err] Result & error if block supplied
529
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::Policy] parsed result object
530
+ # @yieldparam err [StandardError] error object if request failed
531
+ #
532
+ # @return [Google::Apis::CloudfunctionsV1::Policy]
533
+ #
534
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
535
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
536
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
537
+ def set_function_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
538
+ command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
539
+ command.request_representation = Google::Apis::CloudfunctionsV1::SetIamPolicyRequest::Representation
540
+ command.request_object = set_iam_policy_request_object
541
+ command.response_representation = Google::Apis::CloudfunctionsV1::Policy::Representation
542
+ command.response_class = Google::Apis::CloudfunctionsV1::Policy
543
+ command.params['resource'] = resource unless resource.nil?
544
+ command.query['fields'] = fields unless fields.nil?
545
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
546
+ execute_or_queue_command(command, &block)
547
+ end
548
+
549
+ # Tests the specified permissions against the IAM access control policy for a
550
+ # function. If the function does not exist, this will return an empty set of
551
+ # permissions, not a NOT_FOUND error.
552
+ # @param [String] resource
553
+ # REQUIRED: The resource for which the policy detail is being requested. See the
554
+ # operation documentation for the appropriate value for this field.
555
+ # @param [Google::Apis::CloudfunctionsV1::TestIamPermissionsRequest] test_iam_permissions_request_object
556
+ # @param [String] fields
557
+ # Selector specifying which fields to include in a partial response.
558
+ # @param [String] quota_user
559
+ # Available to use for quota purposes for server-side applications. Can be any
560
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
561
+ # @param [Google::Apis::RequestOptions] options
562
+ # Request-specific options
563
+ #
564
+ # @yield [result, err] Result & error if block supplied
565
+ # @yieldparam result [Google::Apis::CloudfunctionsV1::TestIamPermissionsResponse] parsed result object
566
+ # @yieldparam err [StandardError] error object if request failed
567
+ #
568
+ # @return [Google::Apis::CloudfunctionsV1::TestIamPermissionsResponse]
569
+ #
570
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
571
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
572
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
573
+ def test_function_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
574
+ command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
575
+ command.request_representation = Google::Apis::CloudfunctionsV1::TestIamPermissionsRequest::Representation
576
+ command.request_object = test_iam_permissions_request_object
577
+ command.response_representation = Google::Apis::CloudfunctionsV1::TestIamPermissionsResponse::Representation
578
+ command.response_class = Google::Apis::CloudfunctionsV1::TestIamPermissionsResponse
579
+ command.params['resource'] = resource unless resource.nil?
580
+ command.query['fields'] = fields unless fields.nil?
581
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
582
+ execute_or_queue_command(command, &block)
583
+ end
584
+
585
+ protected
586
+
587
+ def apply_command_defaults(command)
588
+ command.query['key'] = key unless key.nil?
589
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
590
+ end
591
+ end
592
+ end
593
+ end
594
+ end