Skip to content

Commit 0bb1f47

Browse files
committed
✏️ api/ssm: clean up old variable names
1 parent d846650 commit 0bb1f47

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

api/ssm/ssm.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,42 +107,42 @@ func (sm *ServerManager) requireServerUsers(h func(http.ResponseWriter, *http.Re
107107
}
108108
}
109109

110-
func handleListUsers(w http.ResponseWriter, _ *http.Request, ms Server) (int, error) {
110+
func handleListUsers(w http.ResponseWriter, _ *http.Request, s Server) (int, error) {
111111
type response struct {
112112
Users []cred.UserCredential `json:"users"`
113113
}
114-
return restapi.EncodeResponse(w, http.StatusOK, response{Users: ms.CredentialManager.Credentials()})
114+
return restapi.EncodeResponse(w, http.StatusOK, response{Users: s.CredentialManager.Credentials()})
115115
}
116116

117-
func handleAddUser(w http.ResponseWriter, r *http.Request, ms Server) (int, error) {
117+
func handleAddUser(w http.ResponseWriter, r *http.Request, s Server) (int, error) {
118118
var uc cred.UserCredential
119119
if err := restapi.DecodeRequest(r, &uc); err != nil {
120120
return restapi.EncodeResponse(w, http.StatusBadRequest, StandardError{Message: err.Error()})
121121
}
122122

123-
if err := ms.CredentialManager.AddCredential(uc.Name, uc.UPSK); err != nil {
123+
if err := s.CredentialManager.AddCredential(uc.Name, uc.UPSK); err != nil {
124124
return restapi.EncodeResponse(w, http.StatusBadRequest, StandardError{Message: err.Error()})
125125
}
126126

127127
return restapi.EncodeResponse(w, http.StatusCreated, &uc)
128128
}
129129

130-
func handleGetUser(w http.ResponseWriter, r *http.Request, ms Server) (int, error) {
130+
func handleGetUser(w http.ResponseWriter, r *http.Request, s Server) (int, error) {
131131
type response struct {
132132
cred.UserCredential
133133
stats.Traffic
134134
}
135135

136136
username := r.PathValue("username")
137-
userCred, ok := ms.CredentialManager.GetCredential(username)
137+
userCred, ok := s.CredentialManager.GetCredential(username)
138138
if !ok {
139139
return restapi.EncodeResponse(w, http.StatusNotFound, &userNotFoundJSON)
140140
}
141141

142-
return restapi.EncodeResponse(w, http.StatusOK, response{userCred, ms.StatsCollector.Snapshot().Traffic})
142+
return restapi.EncodeResponse(w, http.StatusOK, response{userCred, s.StatsCollector.Snapshot().Traffic})
143143
}
144144

145-
func handleUpdateUser(w http.ResponseWriter, r *http.Request, ms Server) (int, error) {
145+
func handleUpdateUser(w http.ResponseWriter, r *http.Request, s Server) (int, error) {
146146
var update struct {
147147
UPSK []byte `json:"uPSK"`
148148
}
@@ -151,7 +151,7 @@ func handleUpdateUser(w http.ResponseWriter, r *http.Request, ms Server) (int, e
151151
}
152152

153153
username := r.PathValue("username")
154-
if err := ms.CredentialManager.UpdateCredential(username, update.UPSK); err != nil {
154+
if err := s.CredentialManager.UpdateCredential(username, update.UPSK); err != nil {
155155
if errors.Is(err, cred.ErrNonexistentUser) {
156156
return restapi.EncodeResponse(w, http.StatusNotFound, StandardError{Message: err.Error()})
157157
}
@@ -161,9 +161,9 @@ func handleUpdateUser(w http.ResponseWriter, r *http.Request, ms Server) (int, e
161161
return restapi.EncodeResponse(w, http.StatusNoContent, nil)
162162
}
163163

164-
func handleDeleteUser(w http.ResponseWriter, r *http.Request, ms Server) (int, error) {
164+
func handleDeleteUser(w http.ResponseWriter, r *http.Request, s Server) (int, error) {
165165
username := r.PathValue("username")
166-
if err := ms.CredentialManager.DeleteCredential(username); err != nil {
166+
if err := s.CredentialManager.DeleteCredential(username); err != nil {
167167
return restapi.EncodeResponse(w, http.StatusNotFound, StandardError{Message: err.Error()})
168168
}
169169
return restapi.EncodeResponse(w, http.StatusNoContent, nil)

0 commit comments

Comments
 (0)