Serverless Functions

A Serverless Function is a compute service that runs code in respose to events and automatically manages the compute resources required by that code. An example of this would be AWS Lambda. This class inherits from TopLevelResource and has direct access to the resource’s database object. The following attributes are directly accessible:

attr resource_id:
 The primary resource identifier that takes the form of a prefix followed by numbers and letters
attr organization_service_id:
 The ID of the parent organization service (cloud)
attr region_name:
 The region that the serverless function resides in
attr name:The name of the serverless function
attr description:
 A description of the serverless function
attr network_resource_id:
 The resource ID of the parent (network)
attr code_size:Size of your serverless function code in bytes
attr memory_size_mb:
 Memory size of your serverless function in MB
attr timeout:Timeout or limit of the serverless function
attr runtime:The time this serverless function is set to run
attr version:The version this serverless function is running on
attr last_modified:
 When the serverless function was last modified
attr policy:The policy attached to this serverless function
class DivvyResource.Resources.serverlessfunction.ServerlessFunction(resource_id)

Bases: DivvyResource.Resources.toplevelresource.TopLevelResource

Serverless Function operations

static get_db_class()
static get_provider_id_field()
static get_resource_type()
handle_resource_created(user_resource_id=None, project_resource_id=None)

This should be called when a resource is created/discovered after the basic data is added to the database. This gives an opportunity for post-addition hooks (assignment to projects/groups, alerts, etc)


This should be called when a resource is destroyed before the basic data is removed from the database. This gives an opportunity for pre-destruction hooks (removal from projects/groups, alerts, etc)

handle_resource_modified(resource, *args, **kwargs)

This should be called when a resource is modified after the new data has been updated in the DB session. This gives an opportunity for post-modification hooks

top_level_resource = True