Skip to main content

Module

Utility functions for project operations.

resolve_project_id

def resolve_project_id(project_id: Optional[str]=None,
                       project_name: Optional[str]=None,
                       allow_none: bool=False,
                       validate: bool=True) -> Optional[str]
Resolve project_name to project_id if needed. Arguments
  • project_id (Optional[str]): The project ID. If provided, returns it (optionally validating it exists).
  • project_name (Optional[str]): The project name. If provided, looks up and returns the project ID.
  • allow_none (bool): If True, allows both parameters to be None and returns None. If False, raises ValueError when both are None. Defaults to False.
  • validate (bool): If True, validates that the project exists. If False, skips validation. Defaults to True.
Raises
  • ValueError: If both project_id and project_name are provided, or if neither is provided and allow_none=False, or if the project doesn’t exist (when validate=True).
Returns
  • Optional[str]: The resolved project ID, or None if neither was provided and allow_none=True.
I