google-cloud-functions-v1 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/google/cloud/functions/v1/bindings_override.rb +91 -0
- data/lib/google/cloud/functions/v1/cloud_functions_service/client.rb +39 -11
- data/lib/google/cloud/functions/v1/cloud_functions_service/operations.rb +2 -2
- data/lib/google/cloud/functions/v1/cloud_functions_service/rest/client.rb +1215 -0
- data/lib/google/cloud/functions/v1/cloud_functions_service/rest/operations.rb +791 -0
- data/lib/google/cloud/functions/v1/cloud_functions_service/rest/service_stub.rb +704 -0
- data/lib/google/cloud/functions/v1/cloud_functions_service/rest.rb +54 -0
- data/lib/google/cloud/functions/v1/cloud_functions_service.rb +6 -0
- data/lib/google/cloud/functions/v1/functions_pb.rb +2 -0
- data/lib/google/cloud/functions/v1/functions_services_pb.rb +7 -7
- data/lib/google/cloud/functions/v1/rest.rb +38 -0
- data/lib/google/cloud/functions/v1/version.rb +1 -1
- data/lib/google/cloud/functions/v1.rb +5 -0
- data/proto_docs/google/api/client.rb +67 -4
- data/proto_docs/google/cloud/functions/v1/functions.rb +69 -68
- metadata +42 -13
- data/proto_docs/google/iam/v1/iam_policy.rb +0 -87
- data/proto_docs/google/iam/v1/options.rb +0 -50
- data/proto_docs/google/iam/v1/policy.rb +0 -418
@@ -0,0 +1,1215 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://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,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/functions/v1/functions_pb"
|
21
|
+
require "google/cloud/functions/v1/cloud_functions_service/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
require "google/iam/v1/rest"
|
24
|
+
|
25
|
+
module Google
|
26
|
+
module Cloud
|
27
|
+
module Functions
|
28
|
+
module V1
|
29
|
+
module CloudFunctionsService
|
30
|
+
module Rest
|
31
|
+
##
|
32
|
+
# REST client for the CloudFunctionsService service.
|
33
|
+
#
|
34
|
+
# A service that application uses to manipulate triggers and functions.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :cloud_functions_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the CloudFunctionsService Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all CloudFunctionsService clients
|
51
|
+
# ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "Functions", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.list_functions.timeout = 600.0
|
72
|
+
default_config.rpcs.list_functions.retry_policy = {
|
73
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config.rpcs.get_function.timeout = 600.0
|
77
|
+
default_config.rpcs.get_function.retry_policy = {
|
78
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
79
|
+
}
|
80
|
+
|
81
|
+
default_config.rpcs.create_function.timeout = 600.0
|
82
|
+
|
83
|
+
default_config.rpcs.update_function.timeout = 600.0
|
84
|
+
default_config.rpcs.update_function.retry_policy = {
|
85
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
86
|
+
}
|
87
|
+
|
88
|
+
default_config.rpcs.delete_function.timeout = 600.0
|
89
|
+
default_config.rpcs.delete_function.retry_policy = {
|
90
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
91
|
+
}
|
92
|
+
|
93
|
+
default_config.rpcs.call_function.timeout = 600.0
|
94
|
+
|
95
|
+
default_config
|
96
|
+
end
|
97
|
+
yield @configure if block_given?
|
98
|
+
@configure
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Configure the CloudFunctionsService Client instance.
|
103
|
+
#
|
104
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
105
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
106
|
+
# should be made on {Client.configure}.
|
107
|
+
#
|
108
|
+
# See {::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client::Configuration}
|
109
|
+
# for a description of the configuration fields.
|
110
|
+
#
|
111
|
+
# @yield [config] Configure the Client client.
|
112
|
+
# @yieldparam config [Client::Configuration]
|
113
|
+
#
|
114
|
+
# @return [Client::Configuration]
|
115
|
+
#
|
116
|
+
def configure
|
117
|
+
yield @config if block_given?
|
118
|
+
@config
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Create a new CloudFunctionsService REST client object.
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
#
|
126
|
+
# # Create a client using the default configuration
|
127
|
+
# client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client.new
|
128
|
+
#
|
129
|
+
# # Create a client using a custom configuration
|
130
|
+
# client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client.new do |config|
|
131
|
+
# config.timeout = 10.0
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# @yield [config] Configure the CloudFunctionsService client.
|
135
|
+
# @yieldparam config [Client::Configuration]
|
136
|
+
#
|
137
|
+
def initialize
|
138
|
+
# Create the configuration object
|
139
|
+
@config = Configuration.new Client.configure
|
140
|
+
|
141
|
+
# Yield the configuration if needed
|
142
|
+
yield @config if block_given?
|
143
|
+
|
144
|
+
# Create credentials
|
145
|
+
credentials = @config.credentials
|
146
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
147
|
+
# but only if the default endpoint does not have a region prefix.
|
148
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
149
|
+
!@config.endpoint.split(".").first.include?("-")
|
150
|
+
credentials ||= Credentials.default scope: @config.scope,
|
151
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
152
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
153
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
154
|
+
end
|
155
|
+
|
156
|
+
@quota_project_id = @config.quota_project
|
157
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
158
|
+
|
159
|
+
@operations_client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Operations.new do |config|
|
160
|
+
config.credentials = credentials
|
161
|
+
config.quota_project = @quota_project_id
|
162
|
+
config.endpoint = @config.endpoint
|
163
|
+
end
|
164
|
+
|
165
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
166
|
+
config.credentials = credentials
|
167
|
+
config.quota_project = @quota_project_id
|
168
|
+
config.endpoint = @config.endpoint
|
169
|
+
config.bindings_override = @config.bindings_override
|
170
|
+
end
|
171
|
+
|
172
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
173
|
+
config.credentials = credentials
|
174
|
+
config.quota_project = @quota_project_id
|
175
|
+
config.endpoint = @config.endpoint
|
176
|
+
end
|
177
|
+
|
178
|
+
@cloud_functions_service_stub = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# Get the associated client for long-running operations.
|
183
|
+
#
|
184
|
+
# @return [::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Operations]
|
185
|
+
#
|
186
|
+
attr_reader :operations_client
|
187
|
+
|
188
|
+
##
|
189
|
+
# Get the associated client for mix-in of the Locations.
|
190
|
+
#
|
191
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
192
|
+
#
|
193
|
+
attr_reader :location_client
|
194
|
+
|
195
|
+
##
|
196
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
197
|
+
#
|
198
|
+
# @return [Google::Iam::V1::IAMPolicy::Rest::Client]
|
199
|
+
#
|
200
|
+
attr_reader :iam_policy_client
|
201
|
+
|
202
|
+
# Service calls
|
203
|
+
|
204
|
+
##
|
205
|
+
# Returns a list of functions that belong to the requested project.
|
206
|
+
#
|
207
|
+
# @overload list_functions(request, options = nil)
|
208
|
+
# Pass arguments to `list_functions` via a request object, either of type
|
209
|
+
# {::Google::Cloud::Functions::V1::ListFunctionsRequest} or an equivalent Hash.
|
210
|
+
#
|
211
|
+
# @param request [::Google::Cloud::Functions::V1::ListFunctionsRequest, ::Hash]
|
212
|
+
# A request object representing the call parameters. Required. To specify no
|
213
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
214
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
215
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
216
|
+
#
|
217
|
+
# @overload list_functions(parent: nil, page_size: nil, page_token: nil)
|
218
|
+
# Pass arguments to `list_functions` via keyword arguments. Note that at
|
219
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
220
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
221
|
+
#
|
222
|
+
# @param parent [::String]
|
223
|
+
# The project and location from which the function should be listed,
|
224
|
+
# specified in the format `projects/*/locations/*`
|
225
|
+
# If you want to list functions in all locations, use "-" in place of a
|
226
|
+
# location. When listing functions in all locations, if one or more
|
227
|
+
# location(s) are unreachable, the response will contain functions from all
|
228
|
+
# reachable locations along with the names of any unreachable locations.
|
229
|
+
# @param page_size [::Integer]
|
230
|
+
# Maximum number of functions to return per call.
|
231
|
+
# @param page_token [::String]
|
232
|
+
# The value returned by the last
|
233
|
+
# `ListFunctionsResponse`; indicates that
|
234
|
+
# this is a continuation of a prior `ListFunctions` call, and that the
|
235
|
+
# system should return the next page of data.
|
236
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
237
|
+
# @yieldparam result [::Google::Cloud::Functions::V1::ListFunctionsResponse]
|
238
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
239
|
+
#
|
240
|
+
# @return [::Google::Cloud::Functions::V1::ListFunctionsResponse]
|
241
|
+
#
|
242
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
243
|
+
def list_functions request, options = nil
|
244
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
245
|
+
|
246
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::ListFunctionsRequest
|
247
|
+
|
248
|
+
# Converts hash and nil to an options object
|
249
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
250
|
+
|
251
|
+
# Customize the options with defaults
|
252
|
+
call_metadata = @config.rpcs.list_functions.metadata.to_h
|
253
|
+
|
254
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
255
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
256
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
257
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
258
|
+
transports_version_send: [:rest]
|
259
|
+
|
260
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
261
|
+
|
262
|
+
options.apply_defaults timeout: @config.rpcs.list_functions.timeout,
|
263
|
+
metadata: call_metadata,
|
264
|
+
retry_policy: @config.rpcs.list_functions.retry_policy
|
265
|
+
|
266
|
+
options.apply_defaults timeout: @config.timeout,
|
267
|
+
metadata: @config.metadata,
|
268
|
+
retry_policy: @config.retry_policy
|
269
|
+
|
270
|
+
@cloud_functions_service_stub.list_functions request, options do |result, operation|
|
271
|
+
yield result, operation if block_given?
|
272
|
+
return result
|
273
|
+
end
|
274
|
+
rescue ::Gapic::Rest::Error => e
|
275
|
+
raise ::Google::Cloud::Error.from_error(e)
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# Returns a function with the given name from the requested project.
|
280
|
+
#
|
281
|
+
# @overload get_function(request, options = nil)
|
282
|
+
# Pass arguments to `get_function` via a request object, either of type
|
283
|
+
# {::Google::Cloud::Functions::V1::GetFunctionRequest} or an equivalent Hash.
|
284
|
+
#
|
285
|
+
# @param request [::Google::Cloud::Functions::V1::GetFunctionRequest, ::Hash]
|
286
|
+
# A request object representing the call parameters. Required. To specify no
|
287
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
288
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
289
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
290
|
+
#
|
291
|
+
# @overload get_function(name: nil)
|
292
|
+
# Pass arguments to `get_function` via keyword arguments. Note that at
|
293
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
294
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
295
|
+
#
|
296
|
+
# @param name [::String]
|
297
|
+
# Required. The name of the function which details should be obtained.
|
298
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
299
|
+
# @yieldparam result [::Google::Cloud::Functions::V1::CloudFunction]
|
300
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
301
|
+
#
|
302
|
+
# @return [::Google::Cloud::Functions::V1::CloudFunction]
|
303
|
+
#
|
304
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
305
|
+
def get_function request, options = nil
|
306
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
307
|
+
|
308
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GetFunctionRequest
|
309
|
+
|
310
|
+
# Converts hash and nil to an options object
|
311
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
312
|
+
|
313
|
+
# Customize the options with defaults
|
314
|
+
call_metadata = @config.rpcs.get_function.metadata.to_h
|
315
|
+
|
316
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
317
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
318
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
319
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
320
|
+
transports_version_send: [:rest]
|
321
|
+
|
322
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
323
|
+
|
324
|
+
options.apply_defaults timeout: @config.rpcs.get_function.timeout,
|
325
|
+
metadata: call_metadata,
|
326
|
+
retry_policy: @config.rpcs.get_function.retry_policy
|
327
|
+
|
328
|
+
options.apply_defaults timeout: @config.timeout,
|
329
|
+
metadata: @config.metadata,
|
330
|
+
retry_policy: @config.retry_policy
|
331
|
+
|
332
|
+
@cloud_functions_service_stub.get_function request, options do |result, operation|
|
333
|
+
yield result, operation if block_given?
|
334
|
+
return result
|
335
|
+
end
|
336
|
+
rescue ::Gapic::Rest::Error => e
|
337
|
+
raise ::Google::Cloud::Error.from_error(e)
|
338
|
+
end
|
339
|
+
|
340
|
+
##
|
341
|
+
# Creates a new function. If a function with the given name already exists in
|
342
|
+
# the specified project, the long running operation returns an
|
343
|
+
# `ALREADY_EXISTS` error.
|
344
|
+
#
|
345
|
+
# @overload create_function(request, options = nil)
|
346
|
+
# Pass arguments to `create_function` via a request object, either of type
|
347
|
+
# {::Google::Cloud::Functions::V1::CreateFunctionRequest} or an equivalent Hash.
|
348
|
+
#
|
349
|
+
# @param request [::Google::Cloud::Functions::V1::CreateFunctionRequest, ::Hash]
|
350
|
+
# A request object representing the call parameters. Required. To specify no
|
351
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
352
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
353
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
354
|
+
#
|
355
|
+
# @overload create_function(location: nil, function: nil)
|
356
|
+
# Pass arguments to `create_function` via keyword arguments. Note that at
|
357
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
358
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
359
|
+
#
|
360
|
+
# @param location [::String]
|
361
|
+
# Required. The project and location in which the function should be created,
|
362
|
+
# specified in the format `projects/*/locations/*`
|
363
|
+
# @param function [::Google::Cloud::Functions::V1::CloudFunction, ::Hash]
|
364
|
+
# Required. Function to be created.
|
365
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
366
|
+
# @yieldparam result [::Gapic::Operation]
|
367
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
368
|
+
#
|
369
|
+
# @return [::Gapic::Operation]
|
370
|
+
#
|
371
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
372
|
+
def create_function request, options = nil
|
373
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
374
|
+
|
375
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::CreateFunctionRequest
|
376
|
+
|
377
|
+
# Converts hash and nil to an options object
|
378
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
379
|
+
|
380
|
+
# Customize the options with defaults
|
381
|
+
call_metadata = @config.rpcs.create_function.metadata.to_h
|
382
|
+
|
383
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
384
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
385
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
386
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
387
|
+
transports_version_send: [:rest]
|
388
|
+
|
389
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
390
|
+
|
391
|
+
options.apply_defaults timeout: @config.rpcs.create_function.timeout,
|
392
|
+
metadata: call_metadata,
|
393
|
+
retry_policy: @config.rpcs.create_function.retry_policy
|
394
|
+
|
395
|
+
options.apply_defaults timeout: @config.timeout,
|
396
|
+
metadata: @config.metadata,
|
397
|
+
retry_policy: @config.retry_policy
|
398
|
+
|
399
|
+
@cloud_functions_service_stub.create_function request, options do |result, operation|
|
400
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
401
|
+
yield result, operation if block_given?
|
402
|
+
return result
|
403
|
+
end
|
404
|
+
rescue ::Gapic::Rest::Error => e
|
405
|
+
raise ::Google::Cloud::Error.from_error(e)
|
406
|
+
end
|
407
|
+
|
408
|
+
##
|
409
|
+
# Updates existing function.
|
410
|
+
#
|
411
|
+
# @overload update_function(request, options = nil)
|
412
|
+
# Pass arguments to `update_function` via a request object, either of type
|
413
|
+
# {::Google::Cloud::Functions::V1::UpdateFunctionRequest} or an equivalent Hash.
|
414
|
+
#
|
415
|
+
# @param request [::Google::Cloud::Functions::V1::UpdateFunctionRequest, ::Hash]
|
416
|
+
# A request object representing the call parameters. Required. To specify no
|
417
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
418
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
419
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
420
|
+
#
|
421
|
+
# @overload update_function(function: nil, update_mask: nil)
|
422
|
+
# Pass arguments to `update_function` via keyword arguments. Note that at
|
423
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
424
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
425
|
+
#
|
426
|
+
# @param function [::Google::Cloud::Functions::V1::CloudFunction, ::Hash]
|
427
|
+
# Required. New version of the function.
|
428
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
429
|
+
# Required. The list of fields in `CloudFunction` that have to be updated.
|
430
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
431
|
+
# @yieldparam result [::Gapic::Operation]
|
432
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
433
|
+
#
|
434
|
+
# @return [::Gapic::Operation]
|
435
|
+
#
|
436
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
437
|
+
def update_function request, options = nil
|
438
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
439
|
+
|
440
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::UpdateFunctionRequest
|
441
|
+
|
442
|
+
# Converts hash and nil to an options object
|
443
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
444
|
+
|
445
|
+
# Customize the options with defaults
|
446
|
+
call_metadata = @config.rpcs.update_function.metadata.to_h
|
447
|
+
|
448
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
449
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
450
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
451
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
452
|
+
transports_version_send: [:rest]
|
453
|
+
|
454
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.update_function.timeout,
|
457
|
+
metadata: call_metadata,
|
458
|
+
retry_policy: @config.rpcs.update_function.retry_policy
|
459
|
+
|
460
|
+
options.apply_defaults timeout: @config.timeout,
|
461
|
+
metadata: @config.metadata,
|
462
|
+
retry_policy: @config.retry_policy
|
463
|
+
|
464
|
+
@cloud_functions_service_stub.update_function request, options do |result, operation|
|
465
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
466
|
+
yield result, operation if block_given?
|
467
|
+
return result
|
468
|
+
end
|
469
|
+
rescue ::Gapic::Rest::Error => e
|
470
|
+
raise ::Google::Cloud::Error.from_error(e)
|
471
|
+
end
|
472
|
+
|
473
|
+
##
|
474
|
+
# Deletes a function with the given name from the specified project. If the
|
475
|
+
# given function is used by some trigger, the trigger is updated to
|
476
|
+
# remove this function.
|
477
|
+
#
|
478
|
+
# @overload delete_function(request, options = nil)
|
479
|
+
# Pass arguments to `delete_function` via a request object, either of type
|
480
|
+
# {::Google::Cloud::Functions::V1::DeleteFunctionRequest} or an equivalent Hash.
|
481
|
+
#
|
482
|
+
# @param request [::Google::Cloud::Functions::V1::DeleteFunctionRequest, ::Hash]
|
483
|
+
# A request object representing the call parameters. Required. To specify no
|
484
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
485
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
486
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
487
|
+
#
|
488
|
+
# @overload delete_function(name: nil)
|
489
|
+
# Pass arguments to `delete_function` via keyword arguments. Note that at
|
490
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
491
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
492
|
+
#
|
493
|
+
# @param name [::String]
|
494
|
+
# Required. The name of the function which should be deleted.
|
495
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
496
|
+
# @yieldparam result [::Gapic::Operation]
|
497
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
498
|
+
#
|
499
|
+
# @return [::Gapic::Operation]
|
500
|
+
#
|
501
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
502
|
+
def delete_function request, options = nil
|
503
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
504
|
+
|
505
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::DeleteFunctionRequest
|
506
|
+
|
507
|
+
# Converts hash and nil to an options object
|
508
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
509
|
+
|
510
|
+
# Customize the options with defaults
|
511
|
+
call_metadata = @config.rpcs.delete_function.metadata.to_h
|
512
|
+
|
513
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
514
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
515
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
516
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
517
|
+
transports_version_send: [:rest]
|
518
|
+
|
519
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
520
|
+
|
521
|
+
options.apply_defaults timeout: @config.rpcs.delete_function.timeout,
|
522
|
+
metadata: call_metadata,
|
523
|
+
retry_policy: @config.rpcs.delete_function.retry_policy
|
524
|
+
|
525
|
+
options.apply_defaults timeout: @config.timeout,
|
526
|
+
metadata: @config.metadata,
|
527
|
+
retry_policy: @config.retry_policy
|
528
|
+
|
529
|
+
@cloud_functions_service_stub.delete_function request, options do |result, operation|
|
530
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
531
|
+
yield result, operation if block_given?
|
532
|
+
return result
|
533
|
+
end
|
534
|
+
rescue ::Gapic::Rest::Error => e
|
535
|
+
raise ::Google::Cloud::Error.from_error(e)
|
536
|
+
end
|
537
|
+
|
538
|
+
##
|
539
|
+
# Synchronously invokes a deployed Cloud Function. To be used for testing
|
540
|
+
# purposes as very limited traffic is allowed. For more information on
|
541
|
+
# the actual limits, refer to
|
542
|
+
# [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
|
543
|
+
#
|
544
|
+
# @overload call_function(request, options = nil)
|
545
|
+
# Pass arguments to `call_function` via a request object, either of type
|
546
|
+
# {::Google::Cloud::Functions::V1::CallFunctionRequest} or an equivalent Hash.
|
547
|
+
#
|
548
|
+
# @param request [::Google::Cloud::Functions::V1::CallFunctionRequest, ::Hash]
|
549
|
+
# A request object representing the call parameters. Required. To specify no
|
550
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
551
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
552
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
553
|
+
#
|
554
|
+
# @overload call_function(name: nil, data: nil)
|
555
|
+
# Pass arguments to `call_function` via keyword arguments. Note that at
|
556
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
557
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
558
|
+
#
|
559
|
+
# @param name [::String]
|
560
|
+
# Required. The name of the function to be called.
|
561
|
+
# @param data [::String]
|
562
|
+
# Required. Input to be passed to the function.
|
563
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
564
|
+
# @yieldparam result [::Google::Cloud::Functions::V1::CallFunctionResponse]
|
565
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
566
|
+
#
|
567
|
+
# @return [::Google::Cloud::Functions::V1::CallFunctionResponse]
|
568
|
+
#
|
569
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
570
|
+
def call_function request, options = nil
|
571
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
572
|
+
|
573
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::CallFunctionRequest
|
574
|
+
|
575
|
+
# Converts hash and nil to an options object
|
576
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
577
|
+
|
578
|
+
# Customize the options with defaults
|
579
|
+
call_metadata = @config.rpcs.call_function.metadata.to_h
|
580
|
+
|
581
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
582
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
583
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
584
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
585
|
+
transports_version_send: [:rest]
|
586
|
+
|
587
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
588
|
+
|
589
|
+
options.apply_defaults timeout: @config.rpcs.call_function.timeout,
|
590
|
+
metadata: call_metadata,
|
591
|
+
retry_policy: @config.rpcs.call_function.retry_policy
|
592
|
+
|
593
|
+
options.apply_defaults timeout: @config.timeout,
|
594
|
+
metadata: @config.metadata,
|
595
|
+
retry_policy: @config.retry_policy
|
596
|
+
|
597
|
+
@cloud_functions_service_stub.call_function request, options do |result, operation|
|
598
|
+
yield result, operation if block_given?
|
599
|
+
return result
|
600
|
+
end
|
601
|
+
rescue ::Gapic::Rest::Error => e
|
602
|
+
raise ::Google::Cloud::Error.from_error(e)
|
603
|
+
end
|
604
|
+
|
605
|
+
##
|
606
|
+
# Returns a signed URL for uploading a function source code.
|
607
|
+
# For more information about the signed URL usage see:
|
608
|
+
# https://cloud.google.com/storage/docs/access-control/signed-urls.
|
609
|
+
# Once the function source code upload is complete, the used signed
|
610
|
+
# URL should be provided in CreateFunction or UpdateFunction request
|
611
|
+
# as a reference to the function source code.
|
612
|
+
#
|
613
|
+
# When uploading source code to the generated signed URL, please follow
|
614
|
+
# these restrictions:
|
615
|
+
#
|
616
|
+
# * Source file type should be a zip file.
|
617
|
+
# * Source file size should not exceed 100MB limit.
|
618
|
+
# * No credentials should be attached - the signed URLs provide access to the
|
619
|
+
# target bucket using internal service identity; if credentials were
|
620
|
+
# attached, the identity from the credentials would be used, but that
|
621
|
+
# identity does not have permissions to upload files to the URL.
|
622
|
+
#
|
623
|
+
# When making an HTTP PUT request, these two headers must be specified:
|
624
|
+
#
|
625
|
+
# * `content-type: application/zip`
|
626
|
+
# * `x-goog-content-length-range: 0,104857600`
|
627
|
+
#
|
628
|
+
# And this header must NOT be specified:
|
629
|
+
#
|
630
|
+
# * `Authorization: Bearer YOUR_TOKEN`
|
631
|
+
#
|
632
|
+
# @overload generate_upload_url(request, options = nil)
|
633
|
+
# Pass arguments to `generate_upload_url` via a request object, either of type
|
634
|
+
# {::Google::Cloud::Functions::V1::GenerateUploadUrlRequest} or an equivalent Hash.
|
635
|
+
#
|
636
|
+
# @param request [::Google::Cloud::Functions::V1::GenerateUploadUrlRequest, ::Hash]
|
637
|
+
# A request object representing the call parameters. Required. To specify no
|
638
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
639
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
640
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
641
|
+
#
|
642
|
+
# @overload generate_upload_url(parent: nil, kms_key_name: nil)
|
643
|
+
# Pass arguments to `generate_upload_url` via keyword arguments. Note that at
|
644
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
645
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
646
|
+
#
|
647
|
+
# @param parent [::String]
|
648
|
+
# The project and location in which the Google Cloud Storage signed URL
|
649
|
+
# should be generated, specified in the format `projects/*/locations/*`.
|
650
|
+
# @param kms_key_name [::String]
|
651
|
+
# Resource name of a KMS crypto key (managed by the user) used to
|
652
|
+
# encrypt/decrypt function source code objects in staging Cloud Storage
|
653
|
+
# buckets. When you generate an upload url and upload your source code, it
|
654
|
+
# gets copied to a staging Cloud Storage bucket in an internal regional
|
655
|
+
# project. The source code is then copied to a versioned directory in the
|
656
|
+
# sources bucket in the consumer project during the function deployment.
|
657
|
+
#
|
658
|
+
# It must match the pattern
|
659
|
+
# `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
|
660
|
+
#
|
661
|
+
# The Google Cloud Functions service account
|
662
|
+
# (service-\\{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
|
663
|
+
# granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
|
664
|
+
# (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
|
665
|
+
# Key/KeyRing/Project/Organization (least access preferred). GCF will
|
666
|
+
# delegate access to the Google Storage service account in the internal
|
667
|
+
# project.
|
668
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
669
|
+
# @yieldparam result [::Google::Cloud::Functions::V1::GenerateUploadUrlResponse]
|
670
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
671
|
+
#
|
672
|
+
# @return [::Google::Cloud::Functions::V1::GenerateUploadUrlResponse]
|
673
|
+
#
|
674
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
675
|
+
def generate_upload_url request, options = nil
|
676
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
677
|
+
|
678
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GenerateUploadUrlRequest
|
679
|
+
|
680
|
+
# Converts hash and nil to an options object
|
681
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
682
|
+
|
683
|
+
# Customize the options with defaults
|
684
|
+
call_metadata = @config.rpcs.generate_upload_url.metadata.to_h
|
685
|
+
|
686
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
687
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
688
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
689
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
690
|
+
transports_version_send: [:rest]
|
691
|
+
|
692
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
693
|
+
|
694
|
+
options.apply_defaults timeout: @config.rpcs.generate_upload_url.timeout,
|
695
|
+
metadata: call_metadata,
|
696
|
+
retry_policy: @config.rpcs.generate_upload_url.retry_policy
|
697
|
+
|
698
|
+
options.apply_defaults timeout: @config.timeout,
|
699
|
+
metadata: @config.metadata,
|
700
|
+
retry_policy: @config.retry_policy
|
701
|
+
|
702
|
+
@cloud_functions_service_stub.generate_upload_url request, options do |result, operation|
|
703
|
+
yield result, operation if block_given?
|
704
|
+
return result
|
705
|
+
end
|
706
|
+
rescue ::Gapic::Rest::Error => e
|
707
|
+
raise ::Google::Cloud::Error.from_error(e)
|
708
|
+
end
|
709
|
+
|
710
|
+
##
|
711
|
+
# Returns a signed URL for downloading deployed function source code.
|
712
|
+
# The URL is only valid for a limited period and must be used within
|
713
|
+
# minutes after generation.
|
714
|
+
# For more information about the signed URL usage, see:
|
715
|
+
# https://cloud.google.com/storage/docs/access-control/signed-urls
|
716
|
+
#
|
717
|
+
# @overload generate_download_url(request, options = nil)
|
718
|
+
# Pass arguments to `generate_download_url` via a request object, either of type
|
719
|
+
# {::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest} or an equivalent Hash.
|
720
|
+
#
|
721
|
+
# @param request [::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest, ::Hash]
|
722
|
+
# A request object representing the call parameters. Required. To specify no
|
723
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
724
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
725
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
726
|
+
#
|
727
|
+
# @overload generate_download_url(name: nil, version_id: nil)
|
728
|
+
# Pass arguments to `generate_download_url` via keyword arguments. Note that at
|
729
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
730
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
731
|
+
#
|
732
|
+
# @param name [::String]
|
733
|
+
# The name of function for which source code Google Cloud Storage signed
|
734
|
+
# URL should be generated.
|
735
|
+
# @param version_id [::Integer]
|
736
|
+
# The optional version of function. If not set, default, current version
|
737
|
+
# is used.
|
738
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
739
|
+
# @yieldparam result [::Google::Cloud::Functions::V1::GenerateDownloadUrlResponse]
|
740
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
741
|
+
#
|
742
|
+
# @return [::Google::Cloud::Functions::V1::GenerateDownloadUrlResponse]
|
743
|
+
#
|
744
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
745
|
+
def generate_download_url request, options = nil
|
746
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
747
|
+
|
748
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest
|
749
|
+
|
750
|
+
# Converts hash and nil to an options object
|
751
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
752
|
+
|
753
|
+
# Customize the options with defaults
|
754
|
+
call_metadata = @config.rpcs.generate_download_url.metadata.to_h
|
755
|
+
|
756
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
757
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
758
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
759
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
760
|
+
transports_version_send: [:rest]
|
761
|
+
|
762
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
763
|
+
|
764
|
+
options.apply_defaults timeout: @config.rpcs.generate_download_url.timeout,
|
765
|
+
metadata: call_metadata,
|
766
|
+
retry_policy: @config.rpcs.generate_download_url.retry_policy
|
767
|
+
|
768
|
+
options.apply_defaults timeout: @config.timeout,
|
769
|
+
metadata: @config.metadata,
|
770
|
+
retry_policy: @config.retry_policy
|
771
|
+
|
772
|
+
@cloud_functions_service_stub.generate_download_url request, options do |result, operation|
|
773
|
+
yield result, operation if block_given?
|
774
|
+
return result
|
775
|
+
end
|
776
|
+
rescue ::Gapic::Rest::Error => e
|
777
|
+
raise ::Google::Cloud::Error.from_error(e)
|
778
|
+
end
|
779
|
+
|
780
|
+
##
|
781
|
+
# Sets the IAM access control policy on the specified function.
|
782
|
+
# Replaces any existing policy.
|
783
|
+
#
|
784
|
+
# @overload set_iam_policy(request, options = nil)
|
785
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
786
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
787
|
+
#
|
788
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
789
|
+
# A request object representing the call parameters. Required. To specify no
|
790
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
791
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
792
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
793
|
+
#
|
794
|
+
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
795
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
796
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
797
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
798
|
+
#
|
799
|
+
# @param resource [::String]
|
800
|
+
# REQUIRED: The resource for which the policy is being specified.
|
801
|
+
# See the operation documentation for the appropriate value for this field.
|
802
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
803
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
804
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
805
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
806
|
+
# might reject them.
|
807
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
808
|
+
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
809
|
+
# the fields in the mask will be modified. If no mask is provided, the
|
810
|
+
# following default mask is used:
|
811
|
+
#
|
812
|
+
# `paths: "bindings, etag"`
|
813
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
814
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
815
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
816
|
+
#
|
817
|
+
# @return [::Google::Iam::V1::Policy]
|
818
|
+
#
|
819
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
820
|
+
def set_iam_policy request, options = nil
|
821
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
822
|
+
|
823
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
824
|
+
|
825
|
+
# Converts hash and nil to an options object
|
826
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
827
|
+
|
828
|
+
# Customize the options with defaults
|
829
|
+
call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
830
|
+
|
831
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
832
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
833
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
834
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
835
|
+
transports_version_send: [:rest]
|
836
|
+
|
837
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
838
|
+
|
839
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
840
|
+
metadata: call_metadata,
|
841
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
842
|
+
|
843
|
+
options.apply_defaults timeout: @config.timeout,
|
844
|
+
metadata: @config.metadata,
|
845
|
+
retry_policy: @config.retry_policy
|
846
|
+
|
847
|
+
@cloud_functions_service_stub.set_iam_policy request, options do |result, operation|
|
848
|
+
yield result, operation if block_given?
|
849
|
+
return result
|
850
|
+
end
|
851
|
+
rescue ::Gapic::Rest::Error => e
|
852
|
+
raise ::Google::Cloud::Error.from_error(e)
|
853
|
+
end
|
854
|
+
|
855
|
+
##
|
856
|
+
# Gets the IAM access control policy for a function.
|
857
|
+
# Returns an empty policy if the function exists and does not have a policy
|
858
|
+
# set.
|
859
|
+
#
|
860
|
+
# @overload get_iam_policy(request, options = nil)
|
861
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
862
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
863
|
+
#
|
864
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
865
|
+
# A request object representing the call parameters. Required. To specify no
|
866
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
867
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
868
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
869
|
+
#
|
870
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
871
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
872
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
873
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
874
|
+
#
|
875
|
+
# @param resource [::String]
|
876
|
+
# REQUIRED: The resource for which the policy is being requested.
|
877
|
+
# See the operation documentation for the appropriate value for this field.
|
878
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
879
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
880
|
+
# `GetIamPolicy`.
|
881
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
882
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
883
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
884
|
+
#
|
885
|
+
# @return [::Google::Iam::V1::Policy]
|
886
|
+
#
|
887
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
888
|
+
def get_iam_policy request, options = nil
|
889
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
890
|
+
|
891
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
892
|
+
|
893
|
+
# Converts hash and nil to an options object
|
894
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
895
|
+
|
896
|
+
# Customize the options with defaults
|
897
|
+
call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
898
|
+
|
899
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
900
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
901
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
902
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
903
|
+
transports_version_send: [:rest]
|
904
|
+
|
905
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
906
|
+
|
907
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
908
|
+
metadata: call_metadata,
|
909
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
910
|
+
|
911
|
+
options.apply_defaults timeout: @config.timeout,
|
912
|
+
metadata: @config.metadata,
|
913
|
+
retry_policy: @config.retry_policy
|
914
|
+
|
915
|
+
@cloud_functions_service_stub.get_iam_policy request, options do |result, operation|
|
916
|
+
yield result, operation if block_given?
|
917
|
+
return result
|
918
|
+
end
|
919
|
+
rescue ::Gapic::Rest::Error => e
|
920
|
+
raise ::Google::Cloud::Error.from_error(e)
|
921
|
+
end
|
922
|
+
|
923
|
+
##
|
924
|
+
# Tests the specified permissions against the IAM access control policy
|
925
|
+
# for a function.
|
926
|
+
# If the function does not exist, this returns an empty set of
|
927
|
+
# permissions, not a NOT_FOUND error.
|
928
|
+
#
|
929
|
+
# @overload test_iam_permissions(request, options = nil)
|
930
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
931
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
932
|
+
#
|
933
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
934
|
+
# A request object representing the call parameters. Required. To specify no
|
935
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
936
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
937
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
938
|
+
#
|
939
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
940
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
941
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
942
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
943
|
+
#
|
944
|
+
# @param resource [::String]
|
945
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
946
|
+
# See the operation documentation for the appropriate value for this field.
|
947
|
+
# @param permissions [::Array<::String>]
|
948
|
+
# The set of permissions to check for the `resource`. Permissions with
|
949
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
950
|
+
# information see
|
951
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
952
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
953
|
+
# @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
|
954
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
955
|
+
#
|
956
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
957
|
+
#
|
958
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
959
|
+
def test_iam_permissions request, options = nil
|
960
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
961
|
+
|
962
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
963
|
+
|
964
|
+
# Converts hash and nil to an options object
|
965
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
966
|
+
|
967
|
+
# Customize the options with defaults
|
968
|
+
call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
969
|
+
|
970
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
971
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
972
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
973
|
+
gapic_version: ::Google::Cloud::Functions::V1::VERSION,
|
974
|
+
transports_version_send: [:rest]
|
975
|
+
|
976
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
977
|
+
|
978
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
979
|
+
metadata: call_metadata,
|
980
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
981
|
+
|
982
|
+
options.apply_defaults timeout: @config.timeout,
|
983
|
+
metadata: @config.metadata,
|
984
|
+
retry_policy: @config.retry_policy
|
985
|
+
|
986
|
+
@cloud_functions_service_stub.test_iam_permissions request, options do |result, operation|
|
987
|
+
yield result, operation if block_given?
|
988
|
+
return result
|
989
|
+
end
|
990
|
+
rescue ::Gapic::Rest::Error => e
|
991
|
+
raise ::Google::Cloud::Error.from_error(e)
|
992
|
+
end
|
993
|
+
|
994
|
+
##
|
995
|
+
# Configuration class for the CloudFunctionsService REST API.
|
996
|
+
#
|
997
|
+
# This class represents the configuration for CloudFunctionsService REST,
|
998
|
+
# providing control over timeouts, retry behavior, logging, transport
|
999
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1000
|
+
# applied individually to specific RPCs. See
|
1001
|
+
# {::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client::Configuration::Rpcs}
|
1002
|
+
# for a list of RPCs that can be configured independently.
|
1003
|
+
#
|
1004
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1005
|
+
# on construction.
|
1006
|
+
#
|
1007
|
+
# @example
|
1008
|
+
#
|
1009
|
+
# # Modify the global config, setting the timeout for
|
1010
|
+
# # list_functions to 20 seconds,
|
1011
|
+
# # and all remaining timeouts to 10 seconds.
|
1012
|
+
# ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client.configure do |config|
|
1013
|
+
# config.timeout = 10.0
|
1014
|
+
# config.rpcs.list_functions.timeout = 20.0
|
1015
|
+
# end
|
1016
|
+
#
|
1017
|
+
# # Apply the above configuration only to a new client.
|
1018
|
+
# client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::Client.new do |config|
|
1019
|
+
# config.timeout = 10.0
|
1020
|
+
# config.rpcs.list_functions.timeout = 20.0
|
1021
|
+
# end
|
1022
|
+
#
|
1023
|
+
# @!attribute [rw] endpoint
|
1024
|
+
# The hostname or hostname:port of the service endpoint.
|
1025
|
+
# Defaults to `"cloudfunctions.googleapis.com"`.
|
1026
|
+
# @return [::String]
|
1027
|
+
# @!attribute [rw] credentials
|
1028
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1029
|
+
# * (`String`) The path to a service account key file in JSON format
|
1030
|
+
# * (`Hash`) A service account key as a Hash
|
1031
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1032
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1033
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1034
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1035
|
+
# * (`nil`) indicating no credentials
|
1036
|
+
# @return [::Object]
|
1037
|
+
# @!attribute [rw] scope
|
1038
|
+
# The OAuth scopes
|
1039
|
+
# @return [::Array<::String>]
|
1040
|
+
# @!attribute [rw] lib_name
|
1041
|
+
# The library name as recorded in instrumentation and logging
|
1042
|
+
# @return [::String]
|
1043
|
+
# @!attribute [rw] lib_version
|
1044
|
+
# The library version as recorded in instrumentation and logging
|
1045
|
+
# @return [::String]
|
1046
|
+
# @!attribute [rw] timeout
|
1047
|
+
# The call timeout in seconds.
|
1048
|
+
# @return [::Numeric]
|
1049
|
+
# @!attribute [rw] metadata
|
1050
|
+
# Additional headers to be sent with the call.
|
1051
|
+
# @return [::Hash{::Symbol=>::String}]
|
1052
|
+
# @!attribute [rw] retry_policy
|
1053
|
+
# The retry policy. The value is a hash with the following keys:
|
1054
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1055
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1056
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1057
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1058
|
+
# trigger a retry.
|
1059
|
+
# @return [::Hash]
|
1060
|
+
# @!attribute [rw] quota_project
|
1061
|
+
# A separate project against which to charge quota.
|
1062
|
+
# @return [::String]
|
1063
|
+
#
|
1064
|
+
class Configuration
|
1065
|
+
extend ::Gapic::Config
|
1066
|
+
|
1067
|
+
config_attr :endpoint, "cloudfunctions.googleapis.com", ::String
|
1068
|
+
config_attr :credentials, nil do |value|
|
1069
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1070
|
+
allowed.any? { |klass| klass === value }
|
1071
|
+
end
|
1072
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1073
|
+
config_attr :lib_name, nil, ::String, nil
|
1074
|
+
config_attr :lib_version, nil, ::String, nil
|
1075
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1076
|
+
config_attr :metadata, nil, ::Hash, nil
|
1077
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1078
|
+
config_attr :quota_project, nil, ::String, nil
|
1079
|
+
|
1080
|
+
# @private
|
1081
|
+
# Overrides for http bindings for the RPCs of this service
|
1082
|
+
# are only used when this service is used as mixin, and only
|
1083
|
+
# by the host service.
|
1084
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
1085
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
1086
|
+
|
1087
|
+
# @private
|
1088
|
+
def initialize parent_config = nil
|
1089
|
+
@parent_config = parent_config unless parent_config.nil?
|
1090
|
+
|
1091
|
+
yield self if block_given?
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
##
|
1095
|
+
# Configurations for individual RPCs
|
1096
|
+
# @return [Rpcs]
|
1097
|
+
#
|
1098
|
+
def rpcs
|
1099
|
+
@rpcs ||= begin
|
1100
|
+
parent_rpcs = nil
|
1101
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1102
|
+
Rpcs.new parent_rpcs
|
1103
|
+
end
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
##
|
1107
|
+
# Configuration RPC class for the CloudFunctionsService API.
|
1108
|
+
#
|
1109
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1110
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1111
|
+
# the following configuration fields:
|
1112
|
+
#
|
1113
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1114
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
1115
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1116
|
+
# include the following keys:
|
1117
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1118
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1119
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1120
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1121
|
+
# trigger a retry.
|
1122
|
+
#
|
1123
|
+
class Rpcs
|
1124
|
+
##
|
1125
|
+
# RPC-specific configuration for `list_functions`
|
1126
|
+
# @return [::Gapic::Config::Method]
|
1127
|
+
#
|
1128
|
+
attr_reader :list_functions
|
1129
|
+
##
|
1130
|
+
# RPC-specific configuration for `get_function`
|
1131
|
+
# @return [::Gapic::Config::Method]
|
1132
|
+
#
|
1133
|
+
attr_reader :get_function
|
1134
|
+
##
|
1135
|
+
# RPC-specific configuration for `create_function`
|
1136
|
+
# @return [::Gapic::Config::Method]
|
1137
|
+
#
|
1138
|
+
attr_reader :create_function
|
1139
|
+
##
|
1140
|
+
# RPC-specific configuration for `update_function`
|
1141
|
+
# @return [::Gapic::Config::Method]
|
1142
|
+
#
|
1143
|
+
attr_reader :update_function
|
1144
|
+
##
|
1145
|
+
# RPC-specific configuration for `delete_function`
|
1146
|
+
# @return [::Gapic::Config::Method]
|
1147
|
+
#
|
1148
|
+
attr_reader :delete_function
|
1149
|
+
##
|
1150
|
+
# RPC-specific configuration for `call_function`
|
1151
|
+
# @return [::Gapic::Config::Method]
|
1152
|
+
#
|
1153
|
+
attr_reader :call_function
|
1154
|
+
##
|
1155
|
+
# RPC-specific configuration for `generate_upload_url`
|
1156
|
+
# @return [::Gapic::Config::Method]
|
1157
|
+
#
|
1158
|
+
attr_reader :generate_upload_url
|
1159
|
+
##
|
1160
|
+
# RPC-specific configuration for `generate_download_url`
|
1161
|
+
# @return [::Gapic::Config::Method]
|
1162
|
+
#
|
1163
|
+
attr_reader :generate_download_url
|
1164
|
+
##
|
1165
|
+
# RPC-specific configuration for `set_iam_policy`
|
1166
|
+
# @return [::Gapic::Config::Method]
|
1167
|
+
#
|
1168
|
+
attr_reader :set_iam_policy
|
1169
|
+
##
|
1170
|
+
# RPC-specific configuration for `get_iam_policy`
|
1171
|
+
# @return [::Gapic::Config::Method]
|
1172
|
+
#
|
1173
|
+
attr_reader :get_iam_policy
|
1174
|
+
##
|
1175
|
+
# RPC-specific configuration for `test_iam_permissions`
|
1176
|
+
# @return [::Gapic::Config::Method]
|
1177
|
+
#
|
1178
|
+
attr_reader :test_iam_permissions
|
1179
|
+
|
1180
|
+
# @private
|
1181
|
+
def initialize parent_rpcs = nil
|
1182
|
+
list_functions_config = parent_rpcs.list_functions if parent_rpcs.respond_to? :list_functions
|
1183
|
+
@list_functions = ::Gapic::Config::Method.new list_functions_config
|
1184
|
+
get_function_config = parent_rpcs.get_function if parent_rpcs.respond_to? :get_function
|
1185
|
+
@get_function = ::Gapic::Config::Method.new get_function_config
|
1186
|
+
create_function_config = parent_rpcs.create_function if parent_rpcs.respond_to? :create_function
|
1187
|
+
@create_function = ::Gapic::Config::Method.new create_function_config
|
1188
|
+
update_function_config = parent_rpcs.update_function if parent_rpcs.respond_to? :update_function
|
1189
|
+
@update_function = ::Gapic::Config::Method.new update_function_config
|
1190
|
+
delete_function_config = parent_rpcs.delete_function if parent_rpcs.respond_to? :delete_function
|
1191
|
+
@delete_function = ::Gapic::Config::Method.new delete_function_config
|
1192
|
+
call_function_config = parent_rpcs.call_function if parent_rpcs.respond_to? :call_function
|
1193
|
+
@call_function = ::Gapic::Config::Method.new call_function_config
|
1194
|
+
generate_upload_url_config = parent_rpcs.generate_upload_url if parent_rpcs.respond_to? :generate_upload_url
|
1195
|
+
@generate_upload_url = ::Gapic::Config::Method.new generate_upload_url_config
|
1196
|
+
generate_download_url_config = parent_rpcs.generate_download_url if parent_rpcs.respond_to? :generate_download_url
|
1197
|
+
@generate_download_url = ::Gapic::Config::Method.new generate_download_url_config
|
1198
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
1199
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1200
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
1201
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
1202
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1203
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1204
|
+
|
1205
|
+
yield self if block_given?
|
1206
|
+
end
|
1207
|
+
end
|
1208
|
+
end
|
1209
|
+
end
|
1210
|
+
end
|
1211
|
+
end
|
1212
|
+
end
|
1213
|
+
end
|
1214
|
+
end
|
1215
|
+
end
|