Module libnova.common.api.Function

Expand source code
#!/usr/bin/env python
# coding: utf-8

import datetime
from enum import Enum
from libnova.common import api

# Define Enum structs
from libnova.common.api.Serializable import Serializable


class FunctionCodeEntryType(Enum):
    """Function Code Entry Type
    """
    SOURCE = 1


class Function(Serializable):
    """Function

    The main methods allows the interaction with the main structures related to functions hosted in the platform
    """

    id:              int                   = 0
    name:            str
    description:     str
    enabled:         bool
    code_entry_type: FunctionCodeEntryType = 1
    runtime:         str
    handler:         str
    source:          str
    order:           int
    date_create:     datetime.datetime
    date_execution:  datetime.datetime
    core:            bool
    triggers:        []
    parameters:      []


def get(id):
    """Get an existing function

    Args:
        id: The id of the `Function` to retrieve

    Returns:
        Function: An existing `Function` if exists, None otherwise
    """

    api_driver = api.Driver.get_instance()
    return api_driver.serialize(
        api_driver.get(
            url_segment='function/v2/' + str(id)
        ),
        Function
    )


if __name__ == "__main__":
    print('This file cannot be executed directly!')

Functions

def get(id)

Get an existing function

Args

id
The id of the Function to retrieve

Returns

Function
An existing Function if exists, None otherwise
Expand source code
def get(id):
    """Get an existing function

    Args:
        id: The id of the `Function` to retrieve

    Returns:
        Function: An existing `Function` if exists, None otherwise
    """

    api_driver = api.Driver.get_instance()
    return api_driver.serialize(
        api_driver.get(
            url_segment='function/v2/' + str(id)
        ),
        Function
    )

Classes

class Function (**entries: dict)

Function

The main methods allows the interaction with the main structures related to functions hosted in the platform

Expand source code
class Function(Serializable):
    """Function

    The main methods allows the interaction with the main structures related to functions hosted in the platform
    """

    id:              int                   = 0
    name:            str
    description:     str
    enabled:         bool
    code_entry_type: FunctionCodeEntryType = 1
    runtime:         str
    handler:         str
    source:          str
    order:           int
    date_create:     datetime.datetime
    date_execution:  datetime.datetime
    core:            bool
    triggers:        []
    parameters:      []

Ancestors

Class variables

var code_entry_typeFunctionCodeEntryType
var core : bool
var date_create : datetime.datetime
var date_execution : datetime.datetime
var description : str
var enabled : bool
var handler : str
var id : int
var name : str
var order : int
var parameters
var runtime : str
var source : str
var triggers
class FunctionCodeEntryType (value, names=None, *, module=None, qualname=None, type=None, start=1)

Function Code Entry Type

Expand source code
class FunctionCodeEntryType(Enum):
    """Function Code Entry Type
    """
    SOURCE = 1

Ancestors

  • enum.Enum

Class variables

var SOURCE