Class: RocketStackSdk::FunctionsApi
- Inherits:
-
Object
- Object
- RocketStackSdk::FunctionsApi
- Defined in:
- lib/rocket_stack_sdk/api/functions_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#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.
-
#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.
-
#get_function(id, opts = {}) ⇒ GetFunction200Response
Get a function by ID Retrieves details of a specific function including its configuration and status.
-
#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.
-
#initialize(api_client = ApiClient.default) ⇒ FunctionsApi
constructor
A new instance of FunctionsApi.
-
#invoke_function(id, opts = {}) ⇒ InvokeFunction200Response
Invoke a function Synchronously or asynchronously invokes a deployed function with the provided payload.
-
#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.
-
#list_functions(opts = {}) ⇒ ListFunctions200Response
List functions Returns a paginated list of functions for the tenant.
-
#list_functions_with_http_info(opts = {}) ⇒ Array<(ListFunctions200Response, Integer, Hash)>
List functions Returns a paginated list of functions for the tenant.
-
#update_function(id, opts = {}) ⇒ GetFunction200Response
Update function settings Updates function configuration (memory, timeout, env, isPublic, etc.).
-
#update_function_code(id, code, opts = {}) ⇒ CreateFunction202Response
Update function code Uploads and deploys a new function code bundle in a single request.
-
#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.
-
#update_function_with_http_info(id, opts = {}) ⇒ Array<(GetFunction200Response, Integer, Hash)>
Update function settings Updates function configuration (memory, timeout, env, isPublic, etc.).
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_client ⇒ Object
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.
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.
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'] = 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, ) 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.
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_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.
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'] = 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, ) 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.
256 257 258 259 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 256 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.
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 312 313 314 315 316 317 318 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 267 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'] = 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, ) 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.
326 327 328 329 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 326 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.
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 382 383 384 385 386 387 388 389 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 337 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'] = 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, ) 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.
397 398 399 400 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 397 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.
467 468 469 470 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 467 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.
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 523 524 525 526 527 528 529 530 531 532 533 534 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 478 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'] = 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, ) 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.
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 453 454 455 456 457 458 459 |
# File 'lib/rocket_stack_sdk/api/functions_api.rb', line 408 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'] = 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, ) 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 |