mirror of
https://github.com/davidallendj/magellan.git
synced 2026-02-04 00:56:27 -07:00
Fixed formatting via gofmt
Signed-off-by: David J. Allen <davidallendj@gmail.com>
This commit is contained in:
parent
ac9556a526
commit
b3368e5264
11 changed files with 94 additions and 103 deletions
|
|
@ -9,23 +9,23 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
Host = "http://localhost"
|
||||
DbType = "sqlite3"
|
||||
DbPath = "../data/assets.db"
|
||||
Host = "http://localhost"
|
||||
DbType = "sqlite3"
|
||||
DbPath = "../data/assets.db"
|
||||
BaseEndpoint = "/v1"
|
||||
Port = 8000
|
||||
Port = 8000
|
||||
)
|
||||
|
||||
type ScannedResult struct {
|
||||
id string
|
||||
site any
|
||||
cidr string
|
||||
ip string
|
||||
port int
|
||||
id string
|
||||
site any
|
||||
cidr string
|
||||
ip string
|
||||
port int
|
||||
protocol string
|
||||
scanner string
|
||||
state string
|
||||
updated string
|
||||
scanner string
|
||||
state string
|
||||
updated string
|
||||
}
|
||||
|
||||
func makeEndpointUrl(endpoint string) string {
|
||||
|
|
@ -67,8 +67,8 @@ func LoadScannedPortsFromDB(dbPath string, dbType string) {
|
|||
for rows.Next() {
|
||||
var r ScannedResult
|
||||
rows.Scan(
|
||||
&r.id, &r.site, &r.cidr, &r.ip, &r.port, &r.protocol, &r.scanner,
|
||||
&r.id, &r.site, &r.cidr, &r.ip, &r.port, &r.protocol, &r.scanner,
|
||||
&r.state, &r.updated,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,11 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
Host = "http://localhost"
|
||||
Host = "http://localhost"
|
||||
BaseEndpoint = "/hsm/v2"
|
||||
Port = 27779
|
||||
Port = 27779
|
||||
)
|
||||
|
||||
|
||||
func makeEndpointUrl(endpoint string) string {
|
||||
return Host + ":" + fmt.Sprint(Port) + BaseEndpoint + endpoint
|
||||
}
|
||||
|
|
@ -49,7 +48,7 @@ func AddRedfishEndpoint(data []byte, headers map[string]string) error {
|
|||
|
||||
// var ep hms.RedfishEP
|
||||
// _ = ep
|
||||
// Add redfish endpoint via POST `/hsm/v2/Inventory/RedfishEndpoints` endpoint
|
||||
// Add redfish endpoint via POST `/hsm/v2/Inventory/RedfishEndpoints` endpoint
|
||||
url := makeEndpointUrl("/Inventory/RedfishEndpoints")
|
||||
res, body, _ := api.MakeRequest(url, "POST", data, headers)
|
||||
fmt.Println("smd url: ", url)
|
||||
|
|
@ -60,4 +59,4 @@ func AddRedfishEndpoint(data []byte, headers map[string]string) error {
|
|||
|
||||
func UpdateRedfishEndpoint() {
|
||||
// Update redfish endpoint via PUT `/hsm/v2/Inventory/RedfishEndpoints` endpoint
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
func MakeRequest(url string, httpMethod string, body []byte, headers map[string]string) (*http.Response, []byte, error) {
|
||||
// url := getSmdEndpointUrl(endpoint)
|
||||
req, _ := http.NewRequest(httpMethod, url, bytes.NewBuffer(body))
|
||||
|
|
@ -25,4 +24,4 @@ func MakeRequest(url string, httpMethod string, body []byte, headers map[string]
|
|||
return nil, nil, fmt.Errorf("could not read response body: %v", err)
|
||||
}
|
||||
return res, b, err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue