Function Class

The function object represents a function in Function App. It encapsulates function metadata and callable and used in the worker function indexing model. Ref: https://aka.ms/azure-function-ref

Constructor of <xref:azure.functions.FunctionBuilder> object.

Inheritance
builtins.object
Function

Constructor

Function(func: Callable[[...], Any], script_file: str)

Parameters

Name Description
func
Required

User defined python function instance.

script_file
Required

File name indexed by worker to find function.

trigger
Required

The trigger object of the function.

bindings
Required

The list of binding objects of a function.

settings
Required

The list of setting objects of a function.

http_type
Required

Http function type.

is_http_function
Required

Whether the function is a http function.

Methods

add_binding

Add a binding instance to the function.

add_setting

Add a setting instance to the function.

add_trigger

Add a trigger instance to the function.

get_bindings

Get all the bindings attached to the function.

get_bindings_dict

Get dictionary representation of the bindings of the function.

get_dict_repr

Get the dictionary representation of the function.

get_function_json

Get the json stringified form of function.

get_function_name

Get the name of the function. :return: The name of the function.

get_raw_bindings
get_setting

Get a specific setting attached to the function.

get_settings_dict

Get a dictionary representation of a setting.

found).

get_trigger

Get attached trigger instance of the function.

get_user_function

Get the python function customer defined.

is_http_function
set_http_type

Set or update the http type for the function if >>:param:http_type<< . :param http_type: Http function type.

add_binding

Add a binding instance to the function.

add_binding(binding: Binding) -> None

Parameters

Name Description
binding
Required

The binding object to add.

add_setting

Add a setting instance to the function.

add_setting(setting: Setting) -> None

Parameters

Name Description
setting
Required

The setting object to add

add_trigger

Add a trigger instance to the function.

add_trigger(trigger: Trigger) -> None

Parameters

Name Description
trigger
Required

The trigger object to add.

Exceptions

Type Description

Raises trigger already exists error if a trigger is being added to a function which has trigger attached.

get_bindings

Get all the bindings attached to the function.

get_bindings() -> List[Binding]

Returns

Type Description

Bindings attached to the function.

get_bindings_dict

Get dictionary representation of the bindings of the function.

get_bindings_dict() -> Dict

Returns

Type Description

Dictionary representation of the bindings.

get_dict_repr

Get the dictionary representation of the function.

get_dict_repr() -> Dict

Returns

Type Description

The dictionary representation of the function.

get_function_json

Get the json stringified form of function.

get_function_json() -> str

Returns

Type Description

The json stringified form of function.

get_function_name

Get the name of the function. :return: The name of the function.

get_function_name() -> str | None

get_raw_bindings

get_raw_bindings() -> List[str]

get_setting

Get a specific setting attached to the function.

get_setting(setting_name: str) -> Setting | None

Parameters

Name Description
setting_name
Required

The name of the setting to search for.

Returns

Type Description

The setting attached to the function (or None if not found).

get_settings_dict

Get a dictionary representation of a setting.

found).

get_settings_dict(setting_name) -> Dict | None

Parameters

Name Description
setting_name
Required

Returns

Type Description

The dictionary representation of the setting (or None if not

get_trigger

Get attached trigger instance of the function.

get_trigger() -> Trigger | None

Returns

Type Description

Trigger instance or None.

get_user_function

Get the python function customer defined.

get_user_function() -> Callable[[...], Any]

Returns

Type Description

The python function customer defined.

is_http_function

is_http_function() -> bool

set_http_type

Set or update the http type for the function if >>:param:http_type<< . :param http_type: Http function type.

set_http_type(http_type: str) -> None

Parameters

Name Description
http_type
Required