Module libnova.common.api.Trigger

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


# Define main object structure
class Trigger(Serializable):
    """Trigger

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

    id:          int = 0
    name:        str
    type:        str
    regex:       str
    cron:        bool
    function_id: int


def get(id):
    """Retrieve a trigger by its `id`

    Args:
        id (int): The `trigger` id

    Returns:
        Trigger: A `Trigger` if exists
    """

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


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

Functions

def get(id)

Retrieve a trigger by its id

Args

id : int
The trigger id

Returns

Trigger
A Trigger if exists
Expand source code
def get(id):
    """Retrieve a trigger by its `id`

    Args:
        id (int): The `trigger` id

    Returns:
        Trigger: A `Trigger` if exists
    """

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

Classes

class Trigger (**entries: dict)

Trigger

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

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

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

    id:          int = 0
    name:        str
    type:        str
    regex:       str
    cron:        bool
    function_id: int

Ancestors

Class variables

var cron : bool
var function_id : int
var id : int
var name : str
var regex : str
var type : str