def add_group_attrs_from_type(ctx, type_id, group_id): """ Adds all the attributes defined by a type to a group. Args: type_id (int): ID of the type used to get the resource attributes from group_id (int): ID of the group Returns: List(hydra_complexmodels.ResourceAttr): All the newly created group attributes Raises: ResourceNotFoundError if the type_id or group_id are not in the DB """ new_resource_attrs = attributes.add_resource_attrs_from_type( type_id, 'GROUP', group_id, **ctx.in_header.__dict__) return [ResourceAttr(ra) for ra in new_resource_attrs]
def add_network_attrs_from_type(ctx, type_id, network_id): """ Adds all the attributes defined by a type to a network. Args: type_id (int): ID of the type used to get the resource attributes from network_id (int): ID of the network Returns: List(hydra_complexmodels.ResourceAttr): All the newly created network attributes Raises: ResourceNotFoundError if the type_id or network_id are not in the DB """ new_resource_attrs = attributes.add_resource_attrs_from_type( type_id, 'NETWORK', network_id, **ctx.in_header.__dict__) return [ResourceAttr(ra) for ra in new_resource_attrs]