def logger_name_from_path(path): """Validate a logger URI path and get the logger name. :type path: str :param path: URI path for a logger API request. :rtype: str :returns: Logger name parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, None, _LOGGER_TEMPLATE)
def logger_name_from_path(path): """Validate a logger URI path and get the logger name. Args: path (str): URI path for a logger API request Returns: str: Logger name parsed from ``path``. Raises: ValueError: If the ``path`` is ill-formed of if the project from ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, None, _LOGGER_TEMPLATE)
def subscription_name_from_path(path, project): """Validate a subscription URI path and get the subscription name. :type path: str :param path: URI path for a subscription API request. :type project: str :param project: The project associated with the request. It is included for validation purposes. :rtype: str :returns: subscription name parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, project, _SUBSCRIPTION_TEMPLATE)
def topic_name_from_path(path, project): """Validate a topic URI path and get the topic name. :type path: str :param path: URI path for a topic API request. :type project: str :param project: The project associated with the request. It is included for validation purposes. :rtype: str :returns: Topic name parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, project, _TOPIC_TEMPLATE)
def subscription_name_from_path(path, project): """Validate a subscription URI path and get the subscription name. :type path: string :param path: URI path for a subscription API request. :type project: string :param project: The project associated with the request. It is included for validation purposes. :rtype: string :returns: subscription name parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, project, _SUBSCRIPTION_TEMPLATE)
def topic_name_from_path(path, project): """Validate a topic URI path and get the topic name. :type path: string :param path: URI path for a topic API request. :type project: string :param project: The project associated with the request. It is included for validation purposes. :rtype: string :returns: Topic name parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, project, _TOPIC_TEMPLATE)
def _group_id_from_name(path, project=None): """Validate a group URI path and get the group ID. :type path: string :param path: URI path for a group API request. :type project: string or None :param project: The project associated with the request. It is included for validation purposes. :rtype: string :returns: Group ID parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, project, _GROUP_TEMPLATE)
def _group_id_from_name(path, project=None): """Validate a group URI path and get the group ID. :type path: str :param path: URI path for a group API request. :type project: str :param project: (Optional) The project associated with the request. It is included for validation purposes. :rtype: str :returns: Group ID parsed from ``path``. :raises: :class:`ValueError` if the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in. """ return _name_from_project_path(path, project, _GROUP_TEMPLATE)
def _call_fut(self, path, project, template): from google.cloud._helpers import _name_from_project_path return _name_from_project_path(path, project, template)