firebase_functions.params module

Module for params that can make Cloud Functions codebases generic.

Classes

BoolParam

class firebase_functions.params.BoolParam(name: str, default: _T | Expression[_T] | None = None, label: str | None = None, description: str | None = None, immutable: bool | None = None, input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None)

Bases: Param[bool]

A parameter as a bool value.

property value: bool

Returns the Expression's runtime value, based on the CLI's resolution of params.

CompareExpression

class firebase_functions.params.CompareExpression(comparator: str, left: Expression[_T], right: _T)

Bases: Expression[bool], Generic[_T]

A CEL expression that evaluates to boolean true or false based on a comparison between the value of another expression and a literal of that same type.

then(if_true: _T, if_false: _T) TernaryExpression[_T]
comparator: str
left: Expression[_T]
right: _T
property value: bool

Returns the Expression's runtime value, based on the CLI's resolution of params.

Expression

class firebase_functions.params.Expression

Bases: ABC, Generic[_T]

A CEL expression which can be evaluated during function deployment, and resolved to a value of the generic type parameter: i.e, you can pass an Expression<number> as the value of an option that normally accepts numbers.

property value: _T

Returns the Expression's runtime value, based on the CLI's resolution of params.

FloatParam

class firebase_functions.params.FloatParam(name: str, default: _T | Expression[_T] | None = None, label: str | None = None, description: str | None = None, immutable: bool | None = None, input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None)

Bases: Param[float]

A parameter as a float value.

property value: float

Returns the Expression's runtime value, based on the CLI's resolution of params.

IntParam

class firebase_functions.params.IntParam(name: str, default: _T | Expression[_T] | None = None, label: str | None = None, description: str | None = None, immutable: bool | None = None, input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None)

Bases: Param[int]

A parameter as a int value.

property value: int

Returns the Expression's runtime value, based on the CLI's resolution of params.

ListParam

class firebase_functions.params.ListParam(name: str, default: _T | Expression[_T] | None = None, label: str | None = None, description: str | None = None, immutable: bool | None = None, input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None)

Bases: Param[list]

A parameter as a list of strings.

property value: list[str]

Returns the Expression's runtime value, based on the CLI's resolution of params.

MultiSelectInput

class firebase_functions.params.MultiSelectInput(options: list[SelectOption[str]])

Bases: object

Specifies that a Param's value should be determined by having the user select a subset from a list of pre-canned options interactively at deploy-time. Will result in errors if used on Params of type other than string[].

options: list[SelectOption[str]]

A list of user selectable options.

Param

class firebase_functions.params.Param(name: str, default: _T | Expression[_T] | None = None, label: str | None = None, description: str | None = None, immutable: bool | None = None, input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None)

Bases: Expression[_T]

A param is a declared dependency on an external value.

compare(compare: str, right: _T) CompareExpression
equals(right: _T) CompareExpression
default: _T | Expression[_T] | None = None

The default value to assign to this param if none provided.

description: str | None = None

Description of this param that is displayed to the user.

immutable: bool | None = None

Whether the value of this parameter can change between function deployments.

input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None

The type of input that is required for this param, e.g. TextInput.

label: str | None = None

A label that is displayed to the user for this param.

name: str

The environment variable of this parameter. Must be upper case.

property value: _T

Returns the Expression's runtime value, based on the CLI's resolution of params.

ResourceInput

class firebase_functions.params.ResourceInput(type: ResourceType | str)

Bases: object

Specifies that a Param's value should be determined by having the user select from a list containing all the project's resources of a certain type. Currently, only type:"storage.googleapis.com/Bucket" is supported.

type: ResourceType | str

"storage.googleapis.com/Bucket" is supported.

Type:

The resource type. Currently, only type

ResourceType

class firebase_functions.params.ResourceType(value)

Bases: str, Enum

The type of resource that a picker should pick.

STORAGE_BUCKET = 'storage.googleapis.com/Bucket'

SecretParam

class firebase_functions.params.SecretParam(name: str, label: str | None = None, description: str | None = None, immutable: bool | None = None)

Bases: Expression[str]

A secret param is a declared dependency on an external secret.

compare(compare: str, right: _T) CompareExpression
equals(right: _T) CompareExpression
description: str | None = None

Description of this param that is displayed to the user.

immutable: bool | None = None

Whether the value of this parameter can change between function deployments.

label: str | None = None

A label that is displayed to the user for this param.

name: str

The environment variable of this parameter. Must be upper case.

property value: str

Current value of this parameter.

SelectInput

class firebase_functions.params.SelectInput(options: list[SelectOption[_T]])

Bases: Generic[_T]

Specifies that a Param's value should be determined by having the user select from a list of pre-canned options interactively at deploy-time.

options: list[SelectOption[_T]]

A list of user selectable options.

SelectOption

class firebase_functions.params.SelectOption(value: _T, label: str | None = None)

Bases: Generic[_T]

A representation of an option that can be selected via a SelectInput.

label: str | None = None

The displayed label for the option.

value: _T

The value of the option.

StringParam

class firebase_functions.params.StringParam(name: str, default: _T | Expression[_T] | None = None, label: str | None = None, description: str | None = None, immutable: bool | None = None, input: TextInput | ResourceInput | SelectInput[_T] | MultiSelectInput | None = None)

Bases: Param[str]

A parameter as a string value.

property value: str

Returns the Expression's runtime value, based on the CLI's resolution of params.

TernaryExpression

class firebase_functions.params.TernaryExpression(test: Expression[bool], if_true: _T, if_false: _T)

Bases: Expression[_T], Generic[_T]

A CEL expression that evaluates to one of two values based on the value of another expression.

if_false: _T
if_true: _T
test: Expression[bool]
property value: _T

Returns the Expression's runtime value, based on the CLI's resolution of params.

TextInput

class firebase_functions.params.TextInput(example: str | None = None, validation_regex: str | None = None, validation_error_message: str | None = None)

Bases: object

Specifies that a Param's value should be determined by prompting the user to type it in interactively at deploy-time. Input that does not match the provided validation_regex, if present, is retried.

example: str | None = None

An example of the input required that is displayed alongside the input prompt.

validation_error_message: str | None = None

An error message that is displayed to the user if validation_regex fails.

validation_regex: str | None = None

Validation regex for the input. Input that does not match this regex, if present, is retried.