Skip to content

Commit 627c3ed

Browse files
committed
Adding IBM resource group tests
1 parent 67b1964 commit 627c3ed

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

cmd/sandbox-api/account_handlers.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,34 @@ func (h *AccountHandler) GetAccountHandler(w http.ResponseWriter, r *http.Reques
235235
w.WriteHeader(http.StatusOK)
236236
render.Render(w, r, &sandbox)
237237
return
238+
239+
case "DNSSandbox", "dns":
240+
sandbox, err := h.DNSSandboxProvider.FetchByName(accountName)
241+
if err != nil {
242+
if err == models.ErrAccountNotFound {
243+
log.Logger.Warn("GET account", "error", err)
244+
w.WriteHeader(http.StatusNotFound)
245+
render.Render(w, r, &v1.Error{
246+
HTTPStatusCode: http.StatusNotFound,
247+
Message: "Account not found",
248+
})
249+
return
250+
}
251+
log.Logger.Error("GET account", "error", err)
252+
253+
w.WriteHeader(http.StatusInternalServerError)
254+
render.Render(w, r, &v1.Error{
255+
HTTPStatusCode: 500,
256+
Message: "Error reading account",
257+
})
258+
return
259+
}
260+
// Print account using JSON
261+
w.WriteHeader(http.StatusOK)
262+
render.Render(w, r, &sandbox)
263+
return
264+
238265
case "IBMResourceGroupSandbox", "ibmrg":
239-
// Get the account from DynamoDB
240266
sandbox, err := h.IBMResourceGroupSandboxProvider.FetchByName(accountName)
241267
if err != nil {
242268
if err == models.ErrAccountNotFound {

0 commit comments

Comments
 (0)