mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
make parse func
This commit is contained in:
@@ -11,14 +11,8 @@ import (
|
||||
)
|
||||
|
||||
func (report *ReportEventReceiver) initEventReceiverURL() {
|
||||
urlObj := url.URL{}
|
||||
urlObj.Host = getter.GetArmoAPIConnector().GetReportReceiverURL()
|
||||
if strings.Contains(urlObj.Host, "http://") {
|
||||
urlObj.Scheme = "http"
|
||||
urlObj.Host = strings.Replace(urlObj.Host, "http://", "", 1)
|
||||
} else {
|
||||
urlObj.Scheme = "https"
|
||||
}
|
||||
urlObj := parseHost(getter.GetArmoAPIConnector().GetReportReceiverURL())
|
||||
|
||||
urlObj.Path = "/k8s/postureReport"
|
||||
q := urlObj.Query()
|
||||
q.Add("customerGUID", uuid.MustParse(report.customerGUID).String())
|
||||
@@ -28,7 +22,17 @@ func (report *ReportEventReceiver) initEventReceiverURL() {
|
||||
|
||||
report.eventReceiverURL = &urlObj
|
||||
}
|
||||
|
||||
func parseHost(host string) url.URL {
|
||||
urlObj := url.URL{}
|
||||
if strings.Contains(host, "http://") {
|
||||
urlObj.Scheme = "http"
|
||||
urlObj.Host = strings.Replace(host, "http://", "", 1)
|
||||
} else {
|
||||
urlObj.Scheme = "https"
|
||||
urlObj.Host = host
|
||||
}
|
||||
return urlObj
|
||||
}
|
||||
func hostToString(host *url.URL, reportID string) string {
|
||||
q := host.Query()
|
||||
q.Add("reportID", reportID) // TODO - do we add the reportID?
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/armosec/k8s-interface/workloadinterface"
|
||||
"github.com/armosec/kubescape/v2/core/cautils"
|
||||
@@ -89,15 +88,7 @@ func (report *ReportEventReceiver) prepareReport(opaSessionObj *cautils.OPASessi
|
||||
}
|
||||
|
||||
func (report *ReportEventReceiver) GetURL() string {
|
||||
u := url.URL{}
|
||||
u.Host = getter.GetArmoAPIConnector().GetFrontendURL()
|
||||
if strings.Contains(u.Host, "http://") {
|
||||
u.Scheme = "http"
|
||||
u.Host = strings.Replace(u.Host, "http://", "", 1)
|
||||
} else {
|
||||
u.Scheme = "https"
|
||||
}
|
||||
|
||||
u := parseHost(getter.GetArmoAPIConnector().GetFrontendURL())
|
||||
q := u.Query()
|
||||
|
||||
if report.customerAdminEMail != "" || report.token == "" { // data has been submitted
|
||||
|
||||
@@ -11,14 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func (report *ReportEventReceiver) initEventReceiverURL() {
|
||||
urlObj := url.URL{}
|
||||
urlObj.Host = getter.GetArmoAPIConnector().GetReportReceiverURL()
|
||||
if strings.Contains(urlObj.Host, "http://") {
|
||||
urlObj.Scheme = "http"
|
||||
urlObj.Host = strings.Replace(urlObj.Host, "http://", "", 1)
|
||||
} else {
|
||||
urlObj.Scheme = "https"
|
||||
}
|
||||
urlObj := parseHost(getter.GetArmoAPIConnector().GetReportReceiverURL())
|
||||
urlObj.Path = "/k8s/v2/postureReport"
|
||||
|
||||
q := urlObj.Query()
|
||||
@@ -30,6 +23,17 @@ func (report *ReportEventReceiver) initEventReceiverURL() {
|
||||
report.eventReceiverURL = &urlObj
|
||||
}
|
||||
|
||||
func parseHost(host string) url.URL {
|
||||
urlObj := url.URL{}
|
||||
if strings.Contains(host, "http://") {
|
||||
urlObj.Scheme = "http"
|
||||
urlObj.Host = strings.Replace(host, "http://", "", 1)
|
||||
} else {
|
||||
urlObj.Scheme = "https"
|
||||
urlObj.Host = host
|
||||
}
|
||||
return urlObj
|
||||
}
|
||||
func hostToString(host *url.URL, reportID string) string {
|
||||
q := host.Query()
|
||||
q.Add("reportGUID", reportID) // TODO - do we add the reportID?
|
||||
|
||||
Reference in New Issue
Block a user