firebase_functions.params module

Module for params that can make Cloud Functions codebases generic.

Classes

BoolParam

classfirebase_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.

propertyvalue:bool

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

CompareExpression

classfirebase_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 comparisonbetween 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
propertyvalue:bool

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

Expression

classfirebase_functions.params.Expression

Bases:ABC,Generic[_T]

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

propertyvalue:_T

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

FloatParam

classfirebase_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.

propertyvalue:float

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

IntParam

classfirebase_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.

propertyvalue:int

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

ListParam

classfirebase_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.

propertyvalue:list[str]

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

MultiSelectInput

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

Bases:object

Specifies that a Param's value should be determined by having the user selecta 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

classfirebase_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 functiondeployments.

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.

propertyvalue:_T

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

ResourceInput

classfirebase_functions.params.ResourceInput(type:ResourceType|str)

Bases:object

Specifies that a Param's value should be determined by having the userselect from a list containing all the project's resources of a certaintype. 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

classfirebase_functions.params.ResourceType(value)

Bases:str,Enum

The type of resource that a picker should pick.

STORAGE_BUCKET='storage.googleapis.com/Bucket'

SecretParam

classfirebase_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 functiondeployments.

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.

propertyvalue:str

Current value of this parameter.

SelectInput

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

Bases:Generic[_T]

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

options:list[SelectOption[_T]]

A list of user selectable options.

SelectOption

classfirebase_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

classfirebase_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.

propertyvalue:str

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

TernaryExpression

classfirebase_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 ofanother expression.

if_false:_T
if_true:_T
test:Expression[bool]
propertyvalue:_T

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

TextInput

classfirebase_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 userto type it in interactively at deploy-time. Input that does not match the providedvalidation_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.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-09-20 UTC.