google.gax.path_template

Implements a utility for parsing and formatting path templates.

Functions

namedtuple(typename, field_names[, verbose, ...]) Returns a new subclass of tuple with named fields.

Classes

PathTemplate(data) Represents a path template.

Exceptions

ValidationException Represents a path template validation error.
class PathTemplate(data)[source]

Represents a path template.

match(path)[source]

Matches a fully qualified path template string.

Parameters:path (str) – A fully qualified path template string.
Returns:Var names to matched binding values.
Return type:dict
Raises:ValidationException – If path can’t be matched to the template.
render(bindings)[source]

Renders a string from a path template using the provided bindings.

Parameters:bindings (dict) – A dictionary of var names to binding strings.
Returns:The rendered instantiation of this path template.
Return type:str
Raises:ValidationException – If a key isn’t provided or if a sub-template can’t be parsed.
exception ValidationException[source]

Represents a path template validation error.