This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from Tecsisa/4-proxy-resources-db
read proxy resources from DB with auto refresh (closes #4)
- Loading branch information
Showing
27 changed files
with
1,233 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package api | ||
|
||
import "github.com/Tecsisa/foulkon/database" | ||
|
||
// TYPE DEFINITIONS | ||
|
||
// ProxyResource domain | ||
type ProxyResource struct { | ||
ID string `json:"id, omitempty"` | ||
Host string `json:"host, omitempty"` | ||
Url string `json:"url, omitempty"` | ||
Method string `json:"method, omitempty"` | ||
Urn string `json:"urn, omitempty"` | ||
Action string `json:"action, omitempty"` | ||
} | ||
|
||
// GetProxyResources return proxy resources | ||
func (api ProxyAPI) GetProxyResources() ([]ProxyResource, error) { | ||
resources, err := api.ProxyRepo.GetProxyResources() | ||
|
||
// Error handling | ||
if err != nil { | ||
//Transform to DB error | ||
dbError := err.(*database.Error) | ||
return nil, &Error{ | ||
Code: UNKNOWN_API_ERROR, | ||
Message: dbError.Message, | ||
} | ||
} | ||
|
||
return resources, nil | ||
} |
Oops, something went wrong.