added API for destinations

This commit is contained in:
Radu Ioan Fericean
2013-06-17 16:31:15 +03:00
parent 139bab220c
commit c9885fad86
2 changed files with 46 additions and 6 deletions

View File

@@ -45,17 +45,27 @@ func (self *Apier) GetTPDestinations(attrs AttrGetTPDestinations, reply *rater.D
return nil
}
func (self *Apier) GetDestination(tag string, reply *rater.Destination) error {
type AttrDestination {
Id string
Prefixes []string
}
func (self *Apier) GetDestination(tag string, reply *AttrDestination) error {
if dst, err := self.StorDb.GetDestination(tag); err != nil {
return errors.New(utils.ERR_NOT_FOUND)
return errors.New(utils.ERR_NOT_FOUND)
} else {
*reply = *dst
reply.Id = dst.Id
reply.Prefixes = dst.Prefixes
}
return nil
}
func (self *Apier) SetDestination(dest *rater.Destination, reply *rater.Destination) error {
if err := self.StorDb.SetDestination(dest); err != nil {
func (self *Apier) SetDestination(attr *AttrDestination, reply *rater.Destination) error {
d := &Destination{
Id: attr.Id
Prefixes: attr.Prefixes
}
if err := self.StorDb.SetDestination(d); err != nil {
return err
}
return nil

View File

@@ -300,7 +300,37 @@ GetAllTariffPlanIds
6.1.5. Management API
---------------------
These operates on live data
These operate on live data.
GetDestination
++++++++++++++
Gets the destinations for the specified tag.
::
type AttrDestination {
Id string
Prefixes []string
}
Example
GetDestination(tag string, reply \*AttrDestination)
SetDestination
++++++++++++++
Sets the destinations for the specified tag.
::
type AttrDestination {
Id string
Prefixes []string
}
Example
SetDestination(attr *AttrDestination, reply \*rater.Destination)
GetBalance
++++++++++