Method: Appwrite::Functions#create_deployment
- Defined in:
- lib/appwrite/services/functions.rb
#create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: nil, on_progress: nil) ⇒ Deployment
Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you’ll need to update the function’s deployment to use your new deployment UID.
This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](appwrite.io/docs/functions).
Use the “command” param to set the entrypoint used to execute your code.
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 382 383 384 385 |
# File 'lib/appwrite/services/functions.rb', line 346 def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: nil, on_progress: nil) api_path = '/functions/{functionId}/deployments' .gsub('{functionId}', function_id) if function_id.nil? raise Appwrite::Exception.new('Missing required parameter: "functionId"') end if code.nil? raise Appwrite::Exception.new('Missing required parameter: "code"') end if activate.nil? raise Appwrite::Exception.new('Missing required parameter: "activate"') end api_params = { entrypoint: entrypoint, commands: commands, code: code, activate: activate, } api_headers = { "content-type": 'multipart/form-data', } id_param_name = nil param_name = 'code' @client.chunked_upload( path: api_path, headers: api_headers, params: api_params, param_name: param_name, id_param_name: id_param_name, on_progress: on_progress, response_type: Models::Deployment ) end |