37 lines
941 B
Go
37 lines
941 B
Go
package main
|
|
|
|
import (
|
|
"libshared"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
// Document represents the expected JSON structure
|
|
// You can modify this struct to match your actual data needs
|
|
type Policy struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Conditions []Condition `json:"conditions"`
|
|
}
|
|
|
|
// Condition represents each item in the "conditions" array
|
|
type Condition struct {
|
|
StatementID string `json:"statementid"`
|
|
Principal []string `json:"principals"`
|
|
Actions []string `json:"actions"`
|
|
Source []string `json:"source"`
|
|
Effect string `json:"effect"`
|
|
Operator string `json:"operator"`
|
|
}
|
|
|
|
func main() {
|
|
|
|
pool = libshared.GetDbPool()
|
|
log.Println("Policy Manager service started")
|
|
|
|
http.HandleFunc("/policy/create-policy", CreatePolicy)
|
|
http.HandleFunc("/policy/list-policy", ListPolicy)
|
|
log.Println("Server running on :8080")
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
}
|