Class: RocketStackSdk::FunctionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/rocket_stack_sdk/api/functions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FunctionsApi

Returns a new instance of FunctionsApi.



19
20
21
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_function(name, runtime, handler, code, opts = {}) ⇒ CreateFunction202Response

Create a new function Creates a new function and uploads its code bundle in a single request.

Parameters:

  • name (String)

    Function name. Must start with a letter and contain only alphanumeric characters, hyphens, and underscores.

  • runtime (String)

    Runtime for the function.

  • handler (String)

    Handler entrypoint (e.g. index.handler).

  • code (File)

    ZIP file containing function code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :memory_mb (Integer)

    Memory in MB. Default 256.

  • :timeout_seconds (Integer)

    Timeout in seconds. Default 10.

  • :env (String)

    JSON object of env vars, e.g. \"KEY\":\"value\".

  • :reserved_concurrency (Integer)

    Concurrency cap. null = unreserved, 0 = paused, 1-100 = cap.

  • :description (String)

    Optional description.

  • :is_public (String)

    Set to \"true\" to make the function publicly invokable.

  • :public_method (String)

    HTTP method accepted for public invocation (only applies when isPublic is true).

Returns:



37
38
39
40
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 37

def create_function(name, runtime, handler, code, opts = {})
  data, _status_code, _headers = create_function_with_http_info(name, runtime, handler, code, opts)
  data
end

#create_function_with_http_info(name, runtime, handler, code, opts = {}) ⇒ Array<(CreateFunction202Response, Integer, Hash)>

Create a new function Creates a new function and uploads its code bundle in a single request.

Parameters:

  • name (String)

    Function name. Must start with a letter and contain only alphanumeric characters, hyphens, and underscores.

  • runtime (String)

    Runtime for the function.

  • handler (String)

    Handler entrypoint (e.g. index.handler).

  • code (File)

    ZIP file containing function code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :memory_mb (Integer)

    Memory in MB. Default 256.

  • :timeout_seconds (Integer)

    Timeout in seconds. Default 10.

  • :env (String)

    JSON object of env vars, e.g. \&quot;KEY\&quot;:\&quot;value\&quot;.

  • :reserved_concurrency (Integer)

    Concurrency cap. null &#x3D; unreserved, 0 &#x3D; paused, 1-100 &#x3D; cap.

  • :description (String)

    Optional description.

  • :is_public (String)

    Set to \&quot;true\&quot; to make the function publicly invokable.

  • :public_method (String)

    HTTP method accepted for public invocation (only applies when isPublic is true).

Returns:

  • (Array<(CreateFunction202Response, Integer, Hash)>)

    CreateFunction202Response data, response status code and response headers



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 57

def create_function_with_http_info(name, runtime, handler, code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.create_function ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling FunctionsApi.create_function"
  end
  if @api_client.config.client_side_validation && name.to_s.length > 64
    fail ArgumentError, 'invalid value for "name" when calling FunctionsApi.create_function, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && name.to_s.length < 1
    fail ArgumentError, 'invalid value for "name" when calling FunctionsApi.create_function, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z][a-zA-Z0-9-_]*$/)
  if @api_client.config.client_side_validation && name !~ pattern
    fail ArgumentError, "invalid value for 'name' when calling FunctionsApi.create_function, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'runtime' is set
  if @api_client.config.client_side_validation && runtime.nil?
    fail ArgumentError, "Missing the required parameter 'runtime' when calling FunctionsApi.create_function"
  end
  # verify enum value
  allowable_values = ["nodejs20.x", "python3.12"]
  if @api_client.config.client_side_validation && !allowable_values.include?(runtime)
    fail ArgumentError, "invalid value for \"runtime\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'handler' is set
  if @api_client.config.client_side_validation && handler.nil?
    fail ArgumentError, "Missing the required parameter 'handler' when calling FunctionsApi.create_function"
  end
  if @api_client.config.client_side_validation && handler.to_s.length < 1
    fail ArgumentError, 'invalid value for "handler" when calling FunctionsApi.create_function, the character length must be greater than or equal to 1.'
  end

  # verify the required parameter 'code' is set
  if @api_client.config.client_side_validation && code.nil?
    fail ArgumentError, "Missing the required parameter 'code' when calling FunctionsApi.create_function"
  end
  if @api_client.config.client_side_validation && !opts[:'memory_mb'].nil? && opts[:'memory_mb'] > 10240
    fail ArgumentError, 'invalid value for "opts[:"memory_mb"]" when calling FunctionsApi.create_function, must be smaller than or equal to 10240.'
  end

  if @api_client.config.client_side_validation && !opts[:'memory_mb'].nil? && opts[:'memory_mb'] < 128
    fail ArgumentError, 'invalid value for "opts[:"memory_mb"]" when calling FunctionsApi.create_function, must be greater than or equal to 128.'
  end

  if @api_client.config.client_side_validation && !opts[:'timeout_seconds'].nil? && opts[:'timeout_seconds'] > 60
    fail ArgumentError, 'invalid value for "opts[:"timeout_seconds"]" when calling FunctionsApi.create_function, must be smaller than or equal to 60.'
  end

  if @api_client.config.client_side_validation && !opts[:'timeout_seconds'].nil? && opts[:'timeout_seconds'] < 1
    fail ArgumentError, 'invalid value for "opts[:"timeout_seconds"]" when calling FunctionsApi.create_function, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'reserved_concurrency'].nil? && opts[:'reserved_concurrency'] > 100
    fail ArgumentError, 'invalid value for "opts[:"reserved_concurrency"]" when calling FunctionsApi.create_function, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'reserved_concurrency'].nil? && opts[:'reserved_concurrency'] < 0
    fail ArgumentError, 'invalid value for "opts[:"reserved_concurrency"]" when calling FunctionsApi.create_function, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length > 256
    fail ArgumentError, 'invalid value for "opts[:"description"]" when calling FunctionsApi.create_function, the character length must be smaller than or equal to 256.'
  end

  allowable_values = ["GET", "POST", "PATCH", "DELETE"]
  if @api_client.config.client_side_validation && opts[:'public_method'] && !allowable_values.include?(opts[:'public_method'])
    fail ArgumentError, "invalid value for \"public_method\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/functions'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['name'] = name
  form_params['runtime'] = runtime
  form_params['handler'] = handler
  form_params['code'] = code
  form_params['memoryMb'] = opts[:'memory_mb'] if !opts[:'memory_mb'].nil?
  form_params['timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?
  form_params['env'] = opts[:'env'] if !opts[:'env'].nil?
  form_params['reservedConcurrency'] = opts[:'reserved_concurrency'] if !opts[:'reserved_concurrency'].nil?
  form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['isPublic'] = opts[:'is_public'] if !opts[:'is_public'].nil?
  form_params['publicMethod'] = opts[:'public_method'] if !opts[:'public_method'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CreateFunction202Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.create_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#create_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_function(id, opts = {}) ⇒ GetFunction200Response

Get a function by ID Retrieves details of a specific function including its configuration and status.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



192
193
194
195
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 192

def get_function(id, opts = {})
  data, _status_code, _headers = get_function_with_http_info(id, opts)
  data
end

#get_function_code(id, opts = {}) ⇒ GetFunctionCode200Response

Get function code Downloads the actual deployed Lambda code package and returns editable source files.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



255
256
257
258
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 255

def get_function_code(id, opts = {})
  data, _status_code, _headers = get_function_code_with_http_info(id, opts)
  data
end

#get_function_code_with_http_info(id, opts = {}) ⇒ Array<(GetFunctionCode200Response, Integer, Hash)>

Get function code Downloads the actual deployed Lambda code package and returns editable source files.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetFunctionCode200Response, Integer, Hash)>)

    GetFunctionCode200Response data, response status code and response headers



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 265

def get_function_code_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function_code ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling FunctionsApi.get_function_code"
  end
  # resource path
  local_var_path = '/functions/{id}/code'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetFunctionCode200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.get_function_code",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#get_function_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_function_with_http_info(id, opts = {}) ⇒ Array<(GetFunction200Response, Integer, Hash)>

Get a function by ID Retrieves details of a specific function including its configuration and status.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetFunction200Response, Integer, Hash)>)

    GetFunction200Response data, response status code and response headers



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 202

def get_function_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling FunctionsApi.get_function"
  end
  # resource path
  local_var_path = '/functions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetFunction200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.get_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#get_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#invoke_function(id, opts = {}) ⇒ InvokeFunction200Response

Invoke a function Synchronously or asynchronously invokes a deployed function with the provided payload.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



319
320
321
322
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 319

def invoke_function(id, opts = {})
  data, _status_code, _headers = invoke_function_with_http_info(id, opts)
  data
end

#invoke_function_with_http_info(id, opts = {}) ⇒ Array<(InvokeFunction200Response, Integer, Hash)>

Invoke a function Synchronously or asynchronously invokes a deployed function with the provided payload.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(InvokeFunction200Response, Integer, Hash)>)

    InvokeFunction200Response data, response status code and response headers



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 330

def invoke_function_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.invoke_function ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling FunctionsApi.invoke_function"
  end
  # resource path
  local_var_path = '/functions/{id}/invoke'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'invoke_function_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'InvokeFunction200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.invoke_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#invoke_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_functions(opts = {}) ⇒ ListFunctions200Response

List functions Returns a paginated list of functions for the tenant.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)
  • :cursor (String)

Returns:



389
390
391
392
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 389

def list_functions(opts = {})
  data, _status_code, _headers = list_functions_with_http_info(opts)
  data
end

#list_functions_with_http_info(opts = {}) ⇒ Array<(ListFunctions200Response, Integer, Hash)>

List functions Returns a paginated list of functions for the tenant.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)
  • :cursor (String)

Returns:

  • (Array<(ListFunctions200Response, Integer, Hash)>)

    ListFunctions200Response data, response status code and response headers



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 400

def list_functions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.list_functions ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling FunctionsApi.list_functions, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling FunctionsApi.list_functions, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/functions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListFunctions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.list_functions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#list_functions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_function(id, opts = {}) ⇒ GetFunction200Response

Update function settings Updates function configuration (memory, timeout, env, isPublic, etc.). Does not trigger redeployment.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



460
461
462
463
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 460

def update_function(id, opts = {})
  data, _status_code, _headers = update_function_with_http_info(id, opts)
  data
end

#update_function_code(id, code, opts = {}) ⇒ CreateFunction202Response

Update function code Uploads and deploys a new function code bundle in a single request.

Parameters:

  • id (String)
  • code (File)

    ZIP file containing function code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



530
531
532
533
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 530

def update_function_code(id, code, opts = {})
  data, _status_code, _headers = update_function_code_with_http_info(id, code, opts)
  data
end

#update_function_code_with_http_info(id, code, opts = {}) ⇒ Array<(CreateFunction202Response, Integer, Hash)>

Update function code Uploads and deploys a new function code bundle in a single request.

Parameters:

  • id (String)
  • code (File)

    ZIP file containing function code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateFunction202Response, Integer, Hash)>)

    CreateFunction202Response data, response status code and response headers



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 541

def update_function_code_with_http_info(id, code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.update_function_code ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling FunctionsApi.update_function_code"
  end
  # verify the required parameter 'code' is set
  if @api_client.config.client_side_validation && code.nil?
    fail ArgumentError, "Missing the required parameter 'code' when calling FunctionsApi.update_function_code"
  end
  # resource path
  local_var_path = '/functions/{id}/code'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['code'] = code

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CreateFunction202Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.update_function_code",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#update_function_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_function_with_http_info(id, opts = {}) ⇒ Array<(GetFunction200Response, Integer, Hash)>

Update function settings Updates function configuration (memory, timeout, env, isPublic, etc.). Does not trigger redeployment.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(GetFunction200Response, Integer, Hash)>)

    GetFunction200Response data, response status code and response headers



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 471

def update_function_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.update_function ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling FunctionsApi.update_function"
  end
  # resource path
  local_var_path = '/functions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_function_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'GetFunction200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.update_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#update_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end