google.gax.path_template¶
Implements a utility for parsing and formatting path templates.
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.
-