@@ -11,7 +11,7 @@ import (
1111//GetObjects will get all the objects (json) specified by objectName. eg: all the metrics or all the servers
1212func (api * Api ) GetObjects (objectName string ) (string , error ) {
1313 var result string
14- if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/" , api .appID , objectName ), nil , true , & result ); err != nil {
14+ if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/" , api .AppID , objectName ), nil , true , & result ); err != nil {
1515 return "" , err
1616 }
1717 return result , nil
@@ -20,15 +20,15 @@ func (api *Api) GetObjects(objectName string) (string, error) {
2020// GetObject will return the object (json) specified by objectName that have a certain id
2121func (api * Api ) GetObject (objectName string , id int64 ) (string , error ) {
2222 var result string
23- if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/%d/" , api .appID , objectName , id ), nil , true , & result ); err != nil {
23+ if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/%d/" , api .AppID , objectName , id ), nil , true , & result ); err != nil {
2424 return "" , err
2525 }
2626 return result , nil
2727}
2828
2929//GetObjectRef will put in result a reference to a object specified by objectName and that have a certain id
3030func (api * Api ) GetObjectRef (objectName string , id int64 , result Object ) error {
31- if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/%d/" , api .appID , objectName , id ), nil , false , & result ); err != nil {
31+ if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/%d/" , api .AppID , objectName , id ), nil , false , & result ); err != nil {
3232 return err
3333 }
3434 return nil
@@ -38,7 +38,7 @@ func (api *Api) GetObjectRef(objectName string, id int64, result Object) error {
3838func (api * Api ) GetObjectByName (objectName string , name string ) (string , error ) {
3939 name = strings .Replace (name , " " , "%20" , - 1 )
4040 var result string
41- if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/?selectByName=%s" , api .appID , objectName , name ), nil , true , & result ); err != nil {
41+ if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/?selectByName=%s" , api .AppID , objectName , name ), nil , true , & result ); err != nil {
4242 return "" , err
4343 }
4444 return result , nil
@@ -48,7 +48,7 @@ func (api *Api) GetObjectByName(objectName string, name string) (string, error)
4848func (api * Api ) GetObejctRefByName (objectName string , name string , result Object ) error {
4949 name = strings .Replace (name , " " , "%20" , - 1 )
5050 objects := []* Object {& result }
51- if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/?selectByName=%s" , api .appID , objectName , name ), nil , false , & objects ); err != nil {
51+ if err := api .makeCall ("GET" , fmt .Sprintf ("/api/v1/app/%s/%ss/?selectByName=%s" , api .AppID , objectName , name ), nil , false , & objects ); err != nil {
5252 return err
5353 }
5454 if len (objects ) == 0 {
@@ -61,15 +61,15 @@ func (api *Api) GetObejctRefByName(objectName string, name string, result Object
6161
6262//DeleteObject will delete a object
6363func (api * Api ) DeleteObject (objectName string , object * Object ) error {
64- if err := api .makeCall ("DELETE" , fmt .Sprintf ("/api/v1/app/%s/%ss/%d/" , api .appID , objectName , (* object ).GetId ()), nil , false , nil ); err != nil {
64+ if err := api .makeCall ("DELETE" , fmt .Sprintf ("/api/v1/app/%s/%ss/%d/" , api .AppID , objectName , (* object ).GetId ()), nil , false , nil ); err != nil {
6565 return err
6666 }
6767 return nil
6868}
6969
7070// AddObjectToGroup adds a object (metric, event, etc) to a group of objects.
7171func (api * Api ) AddObjectToGroup (objectName string , object Object , group Object ) error {
72- if err := api .makeCall ("POST" , fmt .Sprintf ("/api/v1/app/%s/%sgroups/%d/%ss/%d/" , api .appID , objectName , group .GetId (), objectName , object .GetId ()), nil , false , nil ); err != nil {
72+ if err := api .makeCall ("POST" , fmt .Sprintf ("/api/v1/app/%s/%sgroups/%d/%ss/%d/" , api .AppID , objectName , group .GetId (), objectName , object .GetId ()), nil , false , nil ); err != nil {
7373 if IsRequestError (err ) {
7474 // The object is already in the group. Ignore this error.
7575 } else {
@@ -81,5 +81,5 @@ func (api *Api) AddObjectToGroup(objectName string, object Object, group Object)
8181
8282// AddObjectToGroup remove a object (metric, event, etc) from a group of objects.
8383func (api * Api ) DeleteObjectFromGroup (objectName string , object Object , group Object ) error {
84- return api .makeCall ("DELETE" , fmt .Sprintf ("/api/v1/app/%s/%sgroups/%d/%ss/%d/" , api .appID , objectName , group .GetId (), objectName , object .GetId ()), nil , false , nil )
84+ return api .makeCall ("DELETE" , fmt .Sprintf ("/api/v1/app/%s/%sgroups/%d/%ss/%d/" , api .AppID , objectName , group .GetId (), objectName , object .GetId ()), nil , false , nil )
8585}
0 commit comments