Eventing functions

class couchbase.management.eventing.EventingFunction(name: str | None = None, code: str | None = None, version: str | None = None, enforce_schema: bool | None = None, handler_uuid: int | None = None, function_instance_id: str | None = None, metadata_keyspace: EventingFunctionKeyspace | None = None, source_keyspace: EventingFunctionKeyspace | None = None, bucket_bindings: list[EventingFunctionBucketBinding] | None = None, url_bindings: list[EventingFunctionUrlBinding] | None = None, constant_bindings: list[EventingFunctionConstantBinding] | None = None, settings: EventingFunctionSettings | None = None)

Object representation for settings relevant to an eventing function.

Parameters:
class couchbase.management.eventing.EventingFunctionBucketAccess(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Indicates the bucket access of the eventing function.

Values:

ReadOnly

The eventing function has read-only bucket access

ReadWrite (default)

The eventing function has read and write bucket access.

Unknown

Couchbase Server returned an access the SDK does not recognize.

ReadOnly = 'r'
ReadWrite = 'rw'
Unknown = 'unknown'
class couchbase.management.eventing.EventingFunctionBucketBinding(alias: str | None = None, name: EventingFunctionKeyspace | None = None, access: EventingFunctionBucketAccess | None = None)

Object representation for an eventing function bucket binding.

Parameters:
class couchbase.management.eventing.EventingFunctionConstantBinding(alias: str | None = None, literal: str | None = None)

Object representation for an eventing function constant binding.

Parameters:
  • alias (str) – binding’s alias

  • literal (str) – binding’s value

class couchbase.management.eventing.EventingFunctionDcpBoundary(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Indicates where to start DCP stream from.

Values:

Everything (default)

Start DCP stream from the beginning.

FromNow

Start DCP stream from present point.

Unknown

Couchbase Server returned a boundary the SDK does not recognize.

Everything = 'everything'
FromNow = 'from_now'
Unknown = 'unknown'
class couchbase.management.eventing.EventingFunctionDeploymentStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Indicates the eventing function’s deployment status.

Values:

Undeployed (default)

Indicates the function is not deployed.

Deployed

Indicates the function is deployed.

Unknown

Couchbase Server returned a status the SDK does not recognize.

Deployed = True
Undeployed = False
Unknown = 'unknown'
class couchbase.management.eventing.EventingFunctionKeyspace(bucket: str | None = None, scope: str | None = None, collection: str | None = None)

Object representation for a Couchbase Server eventing keyspace.

A keyspace is a triple consisting of the following components: bucket (required), scope (optional) and collection (optional)

Parameters:
  • bucket (str) – bucket name

  • scope (str, optional) – scope name

  • collection (str, optional) – collection name

class couchbase.management.eventing.EventingFunctionLanguageCompatibility(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Eventing language version the eventing function assumes with respect to syntax and behavior.

Unknown means Couchbase Server returned a version the SDK does not recognize.

Unknown = 'unknown'
Version_6_0_0 = '6.0.0'
Version_6_5_0 = '6.5.0'
Version_6_6_2 = '6.6.2'
Version_7_2_0 = '7.2.0'
class couchbase.management.eventing.EventingFunctionLogLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

The level of detail an eventing function writes to its system log.

Info is the default, and Error, Warning, Debug and Trace are the others. Unknown is a level Couchbase Server returned that the SDK does not recognize.

Debug = 'DEBUG'
Error = 'ERROR'
Info = 'INFO'
Trace = 'TRACE'
Unknown = 'UNKNOWN'
Warning = 'WARNING'
class couchbase.management.eventing.EventingFunctionManager(impl: EventingFunctionMgmtInterface)

Performs management operations on eventing functions.

For managing the eventing functions of a scope, ScopeEventingFunctionManager should be used.

deploy_function(name: str, options: DeployFunctionOptions | None = None, **kwargs: Unpack[DeployFunctionOptionsKwargs]) → None

Deploys an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (DeployFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
drop_function(name: str, options: DropFunctionOptions | None = None, **kwargs: Unpack[DropFunctionOptionsKwargs]) → None

Drops an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (DropFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
functions_status(options: FunctionsStatusOptions | None = None, **kwargs: Unpack[FunctionsStatusOptionsKwargs]) → EventingFunctionsStatus

Returns the status of every eventing function.

Parameters:
  • options (FunctionsStatusOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The status of each function.

Return type:

EventingFunctionsStatus

get_all_functions(options: GetAllFunctionOptions | None = None, **kwargs: Unpack[GetAllFunctionOptionsKwargs]) → list[EventingFunction]

Returns every eventing function.

Parameters:
  • options (GetAllFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The functions.

Return type:

list[EventingFunction]

get_function(name: str, options: GetFunctionOptions | None = None, **kwargs: Unpack[GetFunctionOptionsKwargs]) → EventingFunction

Returns an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (GetFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The function.

Return type:

EventingFunction

Raises:

EventingFunctionNotFoundException – If the function does not exist.

pause_function(name: str, options: PauseFunctionOptions | None = None, **kwargs: Unpack[PauseFunctionOptionsKwargs]) → None

Pauses a deployed eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (PauseFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
resume_function(name: str, options: ResumeFunctionOptions | None = None, **kwargs: Unpack[ResumeFunctionOptionsKwargs]) → None

Resumes a paused eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (ResumeFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
undeploy_function(name: str, options: UndeployFunctionOptions | None = None, **kwargs: Unpack[UndeployFunctionOptionsKwargs]) → None

Undeploys an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (UndeployFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
upsert_function(function: EventingFunction, options: UpsertFunctionOptions | None = None, **kwargs: Unpack[UpsertFunctionOptionsKwargs]) → None

Creates an eventing function, or replaces one of the same name.

Parameters:
  • function (EventingFunction) – The function to create or replace.

  • options (UpsertFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
class couchbase.management.eventing.EventingFunctionProcessingStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Indicates if the eventing function is running.

Allowed values:

Paused (default)

Indicates the eventing function is not running.

Running

Indicates the eventing function is running.

Unknown

Couchbase Server returned a status the SDK does not recognize.

Paused = False
Running = True
Unknown = 'unknown'
class couchbase.management.eventing.EventingFunctionSettings(cpp_worker_thread_count: int | None = None, description: str | None = None, execution_timeout: timedelta | None = None, lcb_inst_capacity: int | None = None, lcb_retry_count: int | None = None, lcb_timeout: timedelta | None = None, num_timer_partitions: int | None = None, sock_batch_size: int | None = None, tick_duration: timedelta | None = None, timer_context_size: int | None = None, user_prefix: str | None = None, bucket_cache_size: int | None = None, bucket_cache_age: timedelta | None = None, curl_max_allowed_resp_size: int | None = None, query_prepare_all: bool | None = None, worker_count: int | None = None, enable_applog_rotation: bool | None = None, app_log_dir: str | None = None, app_log_max_size: int | None = None, app_log_max_files: int | None = None, checkpoint_interval: timedelta | None = None, dcp_stream_boundary: EventingFunctionDcpBoundary | None = None, deployment_status: EventingFunctionDeploymentStatus | None = None, processing_status: EventingFunctionProcessingStatus | None = None, language_compatibility: EventingFunctionLanguageCompatibility | None = None, log_level: EventingFunctionLogLevel | None = None, query_consistency: QueryScanConsistency | None = None, handler_headers: list[str] | None = None, handler_footers: list[str] | None = None)

Object representation for an settings relevant to an eventing function.

Parameters:
  • cpp_worker_thread_count (int) – Number of threads each worker utilizes

  • description (str) – Free form text for user to describe the eventing function

  • execution_timeout (timedelta) – Maximum time the eventing function can run before it is forcefully terminated (in seconds)

  • lcb_inst_capacity (int) – Maximum number of libcouchbase connections that may be opened and pooled

  • lcb_retry_count (int) – Number of retries of retriable libcouchbase failures, 0 keeps trying till execution_timeout

  • lcb_timeout (timedelta) – Maximum time the lcb command is waited until completion before we terminate the request (in seconds)

  • num_timer_partitions (int) – Number of timer shards, defaults to number of vbuckets

  • sock_batch_size (int) – Batch size for messages from producer to consumer, normally not specified

  • tick_duration (timedelta) – Duration to log stats from this eventing function, in milliseconds

  • timer_context_size (int) – Size limit of timer context object

  • user_prefix (str) – Key prefix for all data stored in metadata by this eventing function

  • bucket_cache_size (int) – Maximum size in bytes the bucket cache can grow to

  • bucket_cache_age (timedelta) – Time in milliseconds after which a cached bucket object is considered stale

  • curl_max_allowed_resp_size (int) – maximum allowable curl call response in MegaBytes

  • worker_count (int) – Number of worker processes eventing function utilizes on each eventing node

  • query_prepare_all (bool) – Automatically prepare all N1QL statements in the eventing function

  • enable_applog_rotation (bool) – Enable rotating this eventing function’s log() message files

  • app_log_dir (str) – Directory to write content of log() message files

  • app_log_max_size (int) – Rotate logs when file grows to this size in bytes approximately

  • app_log_max_files (int) – Number of log() message files to retain when rotating

  • checkpoint_interval (timedelta) – Number of seconds before writing a progress checkpoint

  • dcp_stream_boundary (EventingFunctionDcpBoundary) – indicates where to start dcp stream from (beginning of time or present point)

  • deployment_status (EventingFunctionDeploymentStatus) – Indicates if the function is deployed

  • processing_status (EventingFunctionProcessingStatus) – Indicates if the function is running

  • language_compatibility (EventingFunctionLanguageCompatibility) – Eventing language version this eventing function assumes in terms of syntax and behavior

  • log_level (EventingFunctionLogLevel) – Level of detail in system logging

  • query_consistency (QueryScanConsistency) – Consistency level used by n1ql statements in the eventing function

  • handler_headers (list[str]) – Code to automatically prepend to top of eventing function code

  • handler_footers (list[str]) – Code to automatically prepend to top of eventing function code

classmethod new_settings(**kwargs: Any) → EventingFunctionSettings

Returns a new EventingFunctionSettings object.

Parameters:

kwargs (dict) – Keyword arguments to populate EventingFunctionSettings object

Returns:

new EventingFunctionSettings object

Return type:

EventingFunctionSettings

class couchbase.management.eventing.EventingFunctionState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Indicates the eventing function’s composite status.

Values:

Undeployed (default)

Indicates the function is not deployed.

Deploying

Indicates the function is deploying.

Deployed

Indicates the function is deployed.

Undeploying

Indicates the function is undeploying.

Paused

Indicates the function is paused.

Pausing

Indicates the function is pausing.

Resuming

Indicates the function is resuming.

Unknown

Indicates the function is in an unknown state.

Deployed = 'deployed'
Deploying = 'deploying'
Paused = 'paused'
Pausing = 'pausing'
Resuming = 'resuming'
Undeployed = 'undeployed'
Undeploying = 'undeploying'
Unknown = 'unknown'
class couchbase.management.eventing.EventingFunctionStatus(name: str | None = None, num_bootstrapping_nodes: int | None = None, num_deployed_nodes: int | None = None, state: EventingFunctionState | None = None, deployment_status: EventingFunctionDeploymentStatus | None = None, processing_status: EventingFunctionProcessingStatus | None = None, redeploy_required: bool | None = None, function_scope: dict[str, Any] | None = None)

Object representation for the status of an eventing function.

Particularly useful when determining an interim state of an evening function (i.e, deploying, pausing, undeploying).

Parameters:
  • name (str) – eventing function’s name

  • num_bootstrapping_nodes (int) – number of nodes for bootstrapping

  • num_deployed_nodes (int) – number of nodes eventing function is deployed on

  • state (EventingFunctionState) – composite status of eventing function

  • deployment_status (EventingFunctionDeploymentStatus) – Indicates if the function is deployed

  • processing_status (EventingFunctionProcessingStatus) – Indicates if the function is running

  • redeploy_required (bool) – Indicates if function needs to be redeployed

  • function_scope (dict[str, Any]) – Indicates the eventing function’s scope

class couchbase.management.eventing.EventingFunctionUrlAuth

How an eventing function authenticates to the endpoint of a URL binding.

Use one of EventingFunctionUrlNoAuth, EventingFunctionUrlAuthBasic, EventingFunctionUrlAuthDigest or EventingFunctionUrlAuthBearer.

class couchbase.management.eventing.EventingFunctionUrlAuthBasic(username: str | None = None, password: str | None = None)

A URL binding that authenticates with HTTP basic authentication.

Parameters:
  • username (str) – The username to authenticate with.

  • password (str) – The password to authenticate with.

class couchbase.management.eventing.EventingFunctionUrlAuthBearer(key: str | None = None)

A URL binding that authenticates with a bearer token.

Parameters:

key (str) – The bearer token.

class couchbase.management.eventing.EventingFunctionUrlAuthDigest(username: str | None = None, password: str | None = None)

A URL binding that authenticates with HTTP digest authentication.

Parameters:
  • username (str) – The username to authenticate with.

  • password (str) – The password to authenticate with.

class couchbase.management.eventing.EventingFunctionUrlBinding(hostname: str | None = None, alias: str | None = None, allow_cookies: bool | None = None, validate_ssl_certificate: bool | None = None, auth: EventingFunctionUrlAuth | None = None)

Object representation for an eventing function URL binding.

Parameters:
  • hostname (str) – binding’s hostname

  • alias (str) – binding’s alias

  • allow_cookies (bool) – If the binding should allow cookies

  • validate_ssl_certificate (bool) – If the binding should validate SSL cert

  • auth (EventingFunctionUrlAuth) – binding’s authorization type

class couchbase.management.eventing.EventingFunctionUrlNoAuth

A URL binding that sends no credentials.

class couchbase.management.eventing.EventingFunctionsStatus(num_eventing_nodes: int | None = None, functions: list[EventingFunctionStatus] | None = None)

Object representation for statuses for all eventing functions.

Parameters:
class couchbase.management.eventing.ScopeEventingFunctionManager(impl: EventingFunctionMgmtInterface)

Performs management operations on the eventing functions of a scope.

deploy_function(name: str, options: DeployFunctionOptions | None = None, **kwargs: Unpack[DeployFunctionOptionsKwargs]) → None

Deploys an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (DeployFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
drop_function(name: str, options: DropFunctionOptions | None = None, **kwargs: Unpack[DropFunctionOptionsKwargs]) → None

Drops an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (DropFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
functions_status(options: FunctionsStatusOptions | None = None, **kwargs: Unpack[FunctionsStatusOptionsKwargs]) → EventingFunctionsStatus

Returns the status of every eventing function.

Parameters:
  • options (FunctionsStatusOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The status of each function.

Return type:

EventingFunctionsStatus

get_all_functions(options: GetAllFunctionOptions | None = None, **kwargs: Unpack[GetAllFunctionOptionsKwargs]) → list[EventingFunction]

Returns every eventing function.

Parameters:
  • options (GetAllFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The functions.

Return type:

list[EventingFunction]

get_function(name: str, options: GetFunctionOptions | None = None, **kwargs: Unpack[GetFunctionOptionsKwargs]) → EventingFunction

Returns an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (GetFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The function.

Return type:

EventingFunction

Raises:

EventingFunctionNotFoundException – If the function does not exist.

pause_function(name: str, options: PauseFunctionOptions | None = None, **kwargs: Unpack[PauseFunctionOptionsKwargs]) → None

Pauses a deployed eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (PauseFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
resume_function(name: str, options: ResumeFunctionOptions | None = None, **kwargs: Unpack[ResumeFunctionOptionsKwargs]) → None

Resumes a paused eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (ResumeFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
undeploy_function(name: str, options: UndeployFunctionOptions | None = None, **kwargs: Unpack[UndeployFunctionOptionsKwargs]) → None

Undeploys an eventing function.

Parameters:
  • name (str) – The name of the eventing function.

  • options (UndeployFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:
upsert_function(function: EventingFunction, options: UpsertFunctionOptions | None = None, **kwargs: Unpack[UpsertFunctionOptionsKwargs]) → None

Creates an eventing function, or replaces one of the same name.

Parameters:
  • function (EventingFunction) – The function to create or replace.

  • options (UpsertFunctionOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises: