Beispiel #1
0
    def get_project(ctx, project_id):
        """
        Get an existing Project

        Args:
            project_id (int): The ID of the project to retrieve 

        Returns:
            hydra_complexmodels.Project: The requested project 

        Raises:
            ResourceNotFoundError: If the project is not found.
        """
        proj_dict = project_lib.get_project(project_id,  **ctx.in_header.__dict__) 

        return Project(proj_dict)
Beispiel #2
0
    def update_project(ctx, project):
        """
            Update a project

            Args:
                project (hydra_complexmodels.Project): The project to be updated. All the attributes of this project will be used to update the existing project

            Returns:
                hydra_complexmodels.Project: The updated project 

            Raises:
                ResourceNotFoundError: If the project is not found.

        """
        proj_i = project_lib.update_project(project,  **ctx.in_header.__dict__) 

        return Project(proj_i)
Beispiel #3
0
    def get_project_by_name(ctx, project_name):
        """
        If you don't know the ID of the project in question, but do know
        the name, use this function to retrieve it.
    
        Args:
            project_name (string): The name of the project to retrieve 

        Returns:
            hydra_complexmodels.Project: The requested project 

        Raises:
            ResourceNotFoundError: If the project is not found.

        """
        proj_dict = project_lib.get_project_by_name(project_name,  **ctx.in_header.__dict__) 

        return Project(proj_dict)
Beispiel #4
0
    def add_project(ctx, project):
        """
            Add a new project

            Args:
                project (hydra_complexmodels.Project): The new project to be added. The project does not include networks.

            Returns:
                hydra_complexmodels.Project: The project received, but with an ID this time.


            Raises:

        """

        new_proj = project_lib.add_project(project, **ctx.in_header.__dict__) 
        ret_proj = Project(new_proj)
        return ret_proj
Beispiel #5
0
    def get_network_project(ctx, network_id):
        """
        Get the project of a specified network

        Args:
            network_id (int): The ID of the network whose project details you want 

        Returns:
            hydra_complexmodels.Project: The parent project of the specified Network

        Raises:
            ResourceNotFoundError: If the Network is not found.


        """
        proj = project_lib.get_network_project(network_id, **ctx.in_header.__dict__)

        return Project(proj)
Beispiel #6
0
    def get_projects(ctx, user_id):
        """
        Get all the projects belonging to a user. 

        Args:
            user_id (int): The user ID whose projects you want 

        Returns:
            List(hydra_complexmodels.Project): The requested projects

        Raises:
            ResourceNotFoundError: If the User is not found.

        """
        if user_id is None:
            user_id = ctx.in_header.user_id
        project_dicts = project_lib.get_projects(user_id,  **ctx.in_header.__dict__)
        projects = [Project(p) for p in project_dicts]
        return projects