Esempio n. 1
0
    def get_link_attributes(ctx, link_id, type_id):
        """
        Get all a link's attributes.

        Args:
            link_id (int): ID of the link 
            type_id (int) (optional): ID of the type. If specified will only return the resource attributes relative to that type

        Returns:
            List(hydra_complexmodels.ResourceAttr): All the link's attributes

        Raises:
            ResourceNotFoundError if the type_id or link_id do not exist.
        """

        resource_attrs = attributes.get_resource_attributes(
            'LINK', link_id, type_id)

        return [ResourceAttr(ra) for ra in resource_attrs]
Esempio n. 2
0
    def get_group_attributes(ctx, group_id, type_id):
        """
        Get all a group's attributes.

        Args:
            group_id (int): ID of the group 
            type_id (int) (optional): ID of the type. If specified will only return the resource attributes relative to that type

        Returns:
            List(hydra_complexmodels.ResourceAttr): All the group's attributes

        Raises:
            ResourceNotFoundError if the type_id or group_id do not exist.
        """

        resource_attrs = attributes.get_resource_attributes(
            'GROUP', group_id, type_id, **ctx.in_header.__dict__)

        return [ResourceAttr(ra) for ra in resource_attrs]
Esempio n. 3
0
    def get_network_attributes(ctx, network_id, type_id):
        """
        Get all a network's attributes (not the attributes of the nodes and links. just the network itself).

        Args:
            network_id (int): ID of the network 
            type_id    (int) (optional): ID of the type. If specified will only return the resource attributes relative to that type

        Returns:
            List(hydra_complexmodels.ResourceAttr): All the network attributes

        Raises:
            ResourceNotFoundError if the type_id or network_id are not in the DB

 
        """
        resource_attrs = attributes.get_resource_attributes(
            'NETWORK', network_id, type_id)

        return [ResourceAttr(ra) for ra in resource_attrs]