FunctionGraph API¶
Function Service Class¶
The nat high-level interface is available through the functiongraph
member of a Connection
object. The
functiongraph
member will only be added if the
otcextensions.sdk.register_otc_extensions(conn)
method is called.
Function Operations¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_function(**attrs)
Create a new function from attributes.
- Parameters:
attrs (dict) – Keyword arguments to create a Function.
- Returns:
The created Function instance.
- Return type:
- delete_function(function, ignore_missing=True)
Delete a function.
- Parameters:
ignore_missing
function – The instance of the Function to delete.
- Returns:
None
- functions(**query)
List all functions with optional filters.
- Parameters:
query (dict) – Query parameters to filter the function list.
- Returns:
A generator of Function instances.
- get_function_code(function)
Get details of a function code.
- Parameters:
function – The URN or instance of the Function to retrieve.
- Returns:
The Function instance.
- Return type:
- get_function_metadata(function)
Get details of a function metadata.
- Parameters:
function – The URN or instance of the Function to retrieve.
- Returns:
The Function instance.
- Return type:
- get_resource_tags(function)
Get a function resource tags.
- Parameters:
function – The URN or instance of the Function to retrieve.
- Returns:
The Function instance.
- Return type:
- create_resource_tags(function, tags)
Create function resource tags.
- Parameters:
tags – list of tags
function – The URN or instance of the Function to create tags.
- Returns:
None
- delete_resource_tags(function, tags)
Delete function resource tags.
- Parameters:
tags – list of tags
function – The URN or instance of the Function from which need to delete tags.
- Returns:
None
- update_pin_status(function)
Update a function’s pin status.
- Parameters:
function – The URN or instance of the Function to update.
- Returns:
The updated Function pin status.
- Returns:
None
- update_function_code(function, **attrs)
Update a function code.
- Parameters:
function – The URN or instance of the Function to update.
attrs –
Attributes for updating the function code. These include: code_type: Function code type. Options: * inline: Inline code. * zip: ZIP file. * obs: Function code stored in an OBS bucket. * jar: JAR file (mainly for Java functions).
code_url: If code_type is set to obs, enter the OBS URL of the function code package. Leave this parameter blank if code_type is not obs.
code_filename: Name of the function file. This parameter is mandatory only when code_type is set to jar or zip.
func_code: Response body of the FuncCode struct.
depend_version_list: Dependency version IDs.
- Return type:
- update_function_metadata(function, **attrs)
Update a function metadata.
- Parameters:
function – The URN or instance of the Function to update.
- Returns:
The updated Function pin status.
- Return type:
- update_max_instances(function, instances)
Update a function max instances number.
- Parameters:
instances – Maximum number of instances.
function – The URN or instance of the Function to update.
- Returns:
The updated Function pin status.
- Return type:
Function Invocation Operations¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- executing_function_synchronously(func_urn, **attrs)
Execute a function synchronously.
- Parameters:
func_urn – The URN of the Function to run
attrs – The request parameter as a key pair (“k”:”v”)
- Return type:
FunctionInvocation
- executing_function_asynchronously(func_urn, **attrs)
Execute a function asynchronously.
- Parameters:
func_urn – The URN of the Function to run
attrs – The request parameter as a key pair (“k”:”v”)
- Return type:
FunctionInvocation
Function Quotas¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- quotas()
List all quotas.
- Returns:
A generator of Quota instances.
Dependencies¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- dependencies(**query)
List all dependencies.
- Parameters:
query (dict) – Query parameters to filter the dependencies list.
- Returns:
A generator of Dependency instances.
- create_dependency_version(**attrs)
Create a new dependency from attributes.
- Parameters:
attrs (dict) – Keyword arguments to create a Function.
- Returns:
The created Dependency instance.
- Return type:
- delete_dependency_version(dependency, ignore_missing=True)
Delete a dependency.
- Parameters:
ignore_missing
dependency – The instance of the Dependency to delete.
- Returns:
None
- dependency_versions(dependency, **query)
List all dependency versions.
- Parameters:
dependency – Dependency instance
query (dict) – Query parameters to filter the versions list.
- Returns:
A generator of Dependency instances.
- get_dependency_version(dependency)
List all dependency versions.
- Parameters:
dependency – Dependency instance
- Returns:
A generator of Dependency instances.
Events¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_event(function, **attrs)
Create a new event from attributes.
- Parameters:
function – The URN or instance of the Function to create event in.
attrs (dict) – Keyword arguments to create an Event.
- Returns:
The created Event instance.
- Return type:
- delete_event(function, event, ignore_missing=True)
Delete an event.
- Parameters:
function – The URN or instance of the Function to delete event from.
ignore_missing – When False, openstack.exceptions.ResourceNotFound will be raised when the tag does not exist. When True, no exception will be set when attempting to delete a nonexistent event.
event – The instance of the Event to delete.
- Returns:
None
- events(func_urn)
List all events.
- Parameters:
func_urn – The URN of the Function to fetch events from.
- Returns:
A generator of Event instances.
- get_event(function, event)
Get one event by ID.
Versions¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- versions(func_urn)
List all published versions.
- Parameters:
func_urn – The URN of the Function to fetch events from.
- Returns:
A generator of Version instances.
- publish_version(function, **attrs)
Publish a new version from attributes.
- Parameters:
function – The URN or instance of the Function to create event in.
attrs (dict) – Keyword arguments to publish a Version.
- Returns:
The created Version instance.
- Return type:
Aliases¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- aliases(func_urn)
List all aliases.
- Parameters:
func_urn – The URN of the Function to fetch events from.
- Returns:
A generator of Alias instances.
- create_alias(function, **attrs)
Create a new alias from attributes.
- Parameters:
function – The URN or instance of the Function to create event in.
attrs (dict) – Keyword arguments to create an Alias.
- Returns:
The created Event instance.
- Return type:
- delete_alias(function, alias, ignore_missing=True)
Delete an alias.
- Parameters:
function – The URN or instance of the Function to delete alias from.
ignore_missing – When False, openstack.exceptions.ResourceNotFound will be raised when the tag does not exist. When True, no exception will be set when attempting to delete a nonexistent event.
alias – The instance of the Alias to delete.
- Returns:
None
- update_alias(function, alias, **attrs)
Update an alias from attributes.
Metrics¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- metrics(**query)
List all tenant-level function statistics.
- Returns:
A generator of Metric instances.
- function_metrics(function, period)
List all metrics of a function in a specified period.
- Returns:
A generator of Metric instances.
Logs¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- get_lts_log_settings(function)
Get log group and stream settings of a function.
- enable_lts_log()
Enable log reporting to LTS.
- Returns:
The created Log instance.
- Return type:
Templates¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- get_template(template_id)
Get one template by ID.
- Parameters:
template_id – id of template
- Returns:
instance of
Template
Reserved Instances¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- update_instances_number(function, **attrs)
Update a number of reserved instances from attributes.
- Parameters:
function – The URN or instance of the Function to update event in.
attrs (dict) – Keyword arguments to update a reserved instances.
- Returns:
The updated ReservedInstance instance.
- reserved_instances_config(**query)
List all reserved instances of a function.
- Returns:
A generator of ReservedInstance instances.
- reserved_instances(**query)
List all query the number of instances reserved for a function.
- Returns:
A generator of ReservedInstance instances.
Export¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- export_function(function, **query)
Export a function.
- Parameters:
function – The URN or instance of the Function to export.
- Returns:
instance of :class: ~otcextensions.sdk.function_graph.v2.export_function.Export
Import¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- import_function(**attrs)
Import a function.
- Parameters:
attrs (dict) – Keyword arguments to import Function.
- Returns:
The Import instance.
Function Triggers¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- create_trigger(function, **attrs)
Create a new function trigger from attributes.
- Parameters:
attrs (dict) – Keyword arguments to create a Function.
- Returns:
The created Trigger instance.
- Return type:
- delete_trigger(function_urn, trigger_type_code, trigger_id, ignore_missing=True)
Delete a function trigger.
- Parameters:
trigger_id – Trigger ID.
trigger_type_code – Trigger type code.
function_urn – Function URN
ignore_missing
- Returns:
None
- delete_all_triggers(function_urn, ignore_missing=True)
Delete all function triggers.
- Parameters:
function_urn – Function URN
ignore_missing
- Returns:
None
- triggers(function_urn)
List all triggers of a function.
- Parameters:
function_urn – Function URN
- Returns:
A generator of Trigger instances.
- get_trigger(function_urn, trigger_type_code, trigger_id)
Get one trigger.
- Parameters:
trigger_id – Trigger ID.
trigger_type_code – Trigger type code.
function_urn – Function URN.
- Returns:
instance of
Trigger
- update_trigger(function_urn, trigger_type_code, trigger_id, **attrs)
Update a number of reserved instances from attributes.
- Parameters:
function_urn – Function URN.
trigger_id – Trigger ID.
trigger_type_code – Trigger type code.
attrs (dict) – Keyword arguments to update a trigger.
- Returns:
The updated Trigger instance.
Asynchronous Invocation Notification¶
- class otcextensions.sdk.function_graph.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
- async_notifications(function)
List asynchronous invocation setting of a function version.
- Parameters:
function – Function instance or function URN
- Returns:
A generator of Notification instances.
- configure_async_notification(function, **attrs)
Configure asynchronous execution notification for a function.
- Parameters:
function – Function instance or function URN
attrs (dict) – Keyword arguments to update a notifications settings.
- Returns:
The updated Notification instance.
- delete_async_notification(function, ignore_missing=True)
Delete asynchronous execution notification for a function.
- Parameters:
function – The URN or instance of the Function to delete alias from.
ignore_missing – When False, openstack.exceptions.ResourceNotFound will be raised when the tag does not exist. When True, no exception will be set when attempting to delete a nonexistent event.
- Returns:
None
- all_versions_async_notifications(function, **query)
List asynchronous invocation setting of all function versions.
- Parameters:
function – Function instance or function URN
- Returns:
A generator of Notification instances.
- async_invocation_requests(function, **query)
Get asynchronous invocation requests of a function.
- Parameters:
function – Function instance or function URN
- Returns:
instance of Requests
- stop_async_invocation_request(function, **attrs)
Stop asynchronous invocation request of a function.
- Parameters:
function – Function instance or function URN
- Returns:
instance of Requests