#NEWLINE# @ rpc4django . rpcmethod ( name = 'configuration.gs.rules.add' , signature = [ 'String' , 'Object' ] , login_required = satnet_settings . JRPC_LOGIN_REQUIRED ) #NEWLINE# def add_rule( groundstation_id , rule_cfg ) : #NEWLINE# #INDENT# '\n    JRPC method that permits adding a new rule (with the given configuration)\n    to an existing channel of the given Ground Station.\n    :param groundstation_id: The identifier of the Ground Station.\n    :param rule_cfg: The configuration of the rule to be added.\n    :return: Identifier of the rule that has just been added.\n    ' #NEWLINE# ( op , periodicity , dates ) = rule_serializers . deserialize_rule_cfg ( rule_cfg ) #NEWLINE# rule = rule_models . AvailabilityRule . objects . create ( segment_models . GroundStation . objects . get ( identifier = groundstation_id ) , op , periodicity , dates ) #NEWLINE# return rule . pk