Code Review
/
ric-plt
/
alarm-go.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Rename AlarmAdapter to AlarmManager
[ric-plt/alarm-go.git]
/
manager
/
cmd
/
restapi.go
diff --git
a/adapter/cmd/restapi.go
b/manager/cmd/restapi.go
similarity index 85%
rename from
adapter/cmd/restapi.go
rename to
manager/cmd/restapi.go
index
88014aa
..
7527a0c
100755
(executable)
--- a/
adapter/cmd/restapi.go
+++ b/
manager/cmd/restapi.go
@@
-29,7
+29,7
@@
import (
app "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
)
app "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
)
-func (a *Alarm
Adapt
er) respondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
+func (a *Alarm
Manag
er) respondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
if payload != nil {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
if payload != nil {
@@
-38,29
+38,29
@@
func (a *AlarmAdapter) respondWithJSON(w http.ResponseWriter, code int, payload
}
}
}
}
-func (a *Alarm
Adapt
er) GetActiveAlarms(w http.ResponseWriter, r *http.Request) {
+func (a *Alarm
Manag
er) GetActiveAlarms(w http.ResponseWriter, r *http.Request) {
app.Logger.Info("GetActiveAlarms: %+v", a.activeAlarms)
a.respondWithJSON(w, http.StatusOK, a.activeAlarms)
}
app.Logger.Info("GetActiveAlarms: %+v", a.activeAlarms)
a.respondWithJSON(w, http.StatusOK, a.activeAlarms)
}
-func (a *Alarm
Adapt
er) GetAlarmHistory(w http.ResponseWriter, r *http.Request) {
+func (a *Alarm
Manag
er) GetAlarmHistory(w http.ResponseWriter, r *http.Request) {
app.Logger.Info("GetAlarmHistory: %+v", a.alarmHistory)
a.respondWithJSON(w, http.StatusOK, a.alarmHistory)
}
app.Logger.Info("GetAlarmHistory: %+v", a.alarmHistory)
a.respondWithJSON(w, http.StatusOK, a.alarmHistory)
}
-func (a *Alarm
Adapt
er) RaiseAlarm(w http.ResponseWriter, r *http.Request) {
+func (a *Alarm
Manag
er) RaiseAlarm(w http.ResponseWriter, r *http.Request) {
if err := a.doAction(w, r, true); err != nil {
a.respondWithJSON(w, http.StatusOK, err)
}
}
if err := a.doAction(w, r, true); err != nil {
a.respondWithJSON(w, http.StatusOK, err)
}
}
-func (a *Alarm
Adapt
er) ClearAlarm(w http.ResponseWriter, r *http.Request) {
+func (a *Alarm
Manag
er) ClearAlarm(w http.ResponseWriter, r *http.Request) {
if err := a.doAction(w, r, false); err != nil {
a.respondWithJSON(w, http.StatusOK, err)
}
}
if err := a.doAction(w, r, false); err != nil {
a.respondWithJSON(w, http.StatusOK, err)
}
}
-func (a *Alarm
Adapt
er) doAction(w http.ResponseWriter, r *http.Request, isRaiseAlarm bool) error {
+func (a *Alarm
Manag
er) doAction(w http.ResponseWriter, r *http.Request, isRaiseAlarm bool) error {
app.Logger.Info("doAction: request received = %t", isRaiseAlarm)
if r.Body == nil {
app.Logger.Info("doAction: request received = %t", isRaiseAlarm)
if r.Body == nil {
@@
-88,7
+88,7
@@
func (a *AlarmAdapter) doAction(w http.ResponseWriter, r *http.Request, isRaiseA
return err
}
return err
}
-func (a *Alarm
Adapt
er) HandleViaRmr(d alarm.Alarm, isRaiseAlarm bool) error {
+func (a *Alarm
Manag
er) HandleViaRmr(d alarm.Alarm, isRaiseAlarm bool) error {
alarmClient, err := alarm.InitAlarm(d.ManagedObjectId, d.ApplicationId)
if err != nil {
app.Logger.Error("json.NewDecoder failed: %v", err)
alarmClient, err := alarm.InitAlarm(d.ManagedObjectId, d.ApplicationId)
if err != nil {
app.Logger.Error("json.NewDecoder failed: %v", err)