Documentation
¶
Index ¶
- Variables
- func GetCVEExceptionByDesignator(baseURL, customerGUID string, designators *identifiers.PortalDesignator, ...) ([]armotypes.VulnerabilityExceptionPolicy, error)
- func GetPostureReportUrl(eventReceiverRestUrl, customerGUID, contextName, reportID string) (*url.URL, error)
- func GetRegistryRepositoriesUrl(eventReceiverRestUrl, customerGUID, registryName, jobID string) (*url.URL, error)
- func GetReporterClusterReportsWebsocketUrl(eventReceiverWebsocketUrl, accountID, clusterName string) (*url.URL, error)
- func GetRootGatewayUrl(gatewayUrl string) (*url.URL, error)
- func GetSystemReportURL(eventReceiverUrl string) (*url.URL, error)
- func GetVulnerabilitiesReportURL(eventReceiverUrl, customerGUID string) (*url.URL, error)
- func MockAPIServer(t testing.TB, opts ...mockAPIOption) *testServer
- func TestFrameworkFile(framework string) string
- type AttackTrack
- type BaseReportSender
- func (sender *BaseReportSender) AddError(errorString string)
- func (sender *BaseReportSender) GetActionID() string
- func (sender *BaseReportSender) GetActionIDN() int
- func (sender *BaseReportSender) GetActionName() string
- func (sender *BaseReportSender) GetBaseReport() *systemreports.BaseReport
- func (sender *BaseReportSender) GetCustomerGUID() string
- func (sender *BaseReportSender) GetDetails() string
- func (sender *BaseReportSender) GetErrorList() []string
- func (sender *BaseReportSender) GetJobID() string
- func (sender *BaseReportSender) GetNextActionId() string
- func (sender *BaseReportSender) GetParentAction() string
- func (sender *BaseReportSender) GetReportID() string
- func (sender *BaseReportSender) GetReporter() string
- func (sender *BaseReportSender) GetStatus() string
- func (sender *BaseReportSender) GetTarget() string
- func (sender *BaseReportSender) GetTimestamp() time.Time
- func (sender *BaseReportSender) NextActionID()
- func (s *BaseReportSender) Send() (int, string, error)
- func (sender *BaseReportSender) SendAction(actionName string, sendReport bool)
- func (sender *BaseReportSender) SendAsRoutine(progressNext bool)
- func (sender *BaseReportSender) SendDetails(details string, sendReport bool)
- func (sender *BaseReportSender) SendError(err error, sendReport bool, initErrors bool)
- func (sender *BaseReportSender) SendStatus(status string, sendReport bool)
- func (sender *BaseReportSender) SendWarning(warnMsg string, sendReport bool, initWarnings bool)
- func (sender *BaseReportSender) SetActionID(val string)
- func (sender *BaseReportSender) SetActionIDN(val int)
- func (sender *BaseReportSender) SetActionName(val string)
- func (sender *BaseReportSender) SetCustomerGUID(val string)
- func (sender *BaseReportSender) SetDetails(val string)
- func (sender *BaseReportSender) SetJobID(val string)
- func (sender *BaseReportSender) SetParentAction(val string)
- func (sender *BaseReportSender) SetReporter(val string)
- func (sender *BaseReportSender) SetStatus(val string)
- func (sender *BaseReportSender) SetTarget(val string)
- func (sender *BaseReportSender) SetTimestamp(val time.Time)
- func (sender *BaseReportSender) SimpleReportAnnotations(setParent bool, setCurrent bool) (string, string)
- type Control
- type CustomerConfig
- type Framework
- type HttpReportSender
- type HttpReportSenderMock
- type IHttpSender
- type IReportSender
- type KSCloudAPI
- func (api *KSCloudAPI) GetAccountConfig(clusterName string, opts ...RequestOption) (*CustomerConfig, error)
- func (api *KSCloudAPI) GetAccountID() string
- func (api *KSCloudAPI) GetAttackTracks(opts ...RequestOption) ([]AttackTrack, error)
- func (api *KSCloudAPI) GetCloudAPIURL() string
- func (api *KSCloudAPI) GetCloudReportURL() string
- func (api *KSCloudAPI) GetControl(ID string) (*Control, error)
- func (api *KSCloudAPI) GetControlsInputs(clusterName string, opts ...RequestOption) (map[string][]string, error)
- func (api *KSCloudAPI) GetExceptions(clusterName string, opts ...RequestOption) ([]PostureExceptionPolicy, error)
- func (api *KSCloudAPI) GetFramework(frameworkName string, opts ...RequestOption) (*Framework, error)
- func (api *KSCloudAPI) GetFrameworks(opts ...RequestOption) ([]Framework, error)
- func (api *KSCloudAPI) ListControls() ([]string, error)
- func (api *KSCloudAPI) ListCustomFrameworks() ([]string, error)
- func (api *KSCloudAPI) ListFrameworks(opts ...RequestOption) ([]string, error)
- func (api *KSCloudAPI) SubmitReport(report *PostureReport) error
- type KSCloudOption
- type KsCloudOptions
- type PostureExceptionPolicy
- type PostureReport
- type RequestOption
- type RequestOptions
Constants ¶
This section is empty.
Variables ¶
var (
ErrAPINotPublic = errors.New("control api is not public")
)
Functions ¶
func GetCVEExceptionByDesignator ¶
func GetCVEExceptionByDesignator(baseURL, customerGUID string, designators *identifiers.PortalDesignator, headers map[string]string) ([]armotypes.VulnerabilityExceptionPolicy, error)
func GetPostureReportUrl ¶
func MockAPIServer ¶
func TestFrameworkFile ¶
Types ¶
type AttackTrack ¶
type AttackTrack = v1alpha1.AttackTrack
AttackTrack is an alias to the API type definition for attack tracks.
type BaseReportSender ¶
type BaseReportSender struct {
// contains filtered or unexported fields
}
func NewBaseReportSender ¶
func NewBaseReportSender(eventReceiverUrl string, httpClient httputils.IHttpClient, headers map[string]string, report *systemreports.BaseReport) *BaseReportSender
func (*BaseReportSender) AddError ¶
func (sender *BaseReportSender) AddError(errorString string)
func (*BaseReportSender) GetActionID ¶
func (sender *BaseReportSender) GetActionID() string
func (*BaseReportSender) GetActionIDN ¶
func (sender *BaseReportSender) GetActionIDN() int
func (*BaseReportSender) GetActionName ¶
func (sender *BaseReportSender) GetActionName() string
func (*BaseReportSender) GetBaseReport ¶
func (sender *BaseReportSender) GetBaseReport() *systemreports.BaseReport
func (*BaseReportSender) GetCustomerGUID ¶
func (sender *BaseReportSender) GetCustomerGUID() string
func (*BaseReportSender) GetDetails ¶
func (sender *BaseReportSender) GetDetails() string
func (*BaseReportSender) GetErrorList ¶
func (sender *BaseReportSender) GetErrorList() []string
func (*BaseReportSender) GetJobID ¶
func (sender *BaseReportSender) GetJobID() string
func (*BaseReportSender) GetNextActionId ¶
func (sender *BaseReportSender) GetNextActionId() string
func (*BaseReportSender) GetParentAction ¶
func (sender *BaseReportSender) GetParentAction() string
func (*BaseReportSender) GetReportID ¶
func (sender *BaseReportSender) GetReportID() string
func (*BaseReportSender) GetReporter ¶
func (sender *BaseReportSender) GetReporter() string
func (*BaseReportSender) GetStatus ¶
func (sender *BaseReportSender) GetStatus() string
func (*BaseReportSender) GetTarget ¶
func (sender *BaseReportSender) GetTarget() string
func (*BaseReportSender) GetTimestamp ¶
func (sender *BaseReportSender) GetTimestamp() time.Time
func (*BaseReportSender) NextActionID ¶
func (sender *BaseReportSender) NextActionID()
func (*BaseReportSender) Send ¶
func (s *BaseReportSender) Send() (int, string, error)
Send - send http request. returns-> http status code, return message (jobID/OK), http/go error
func (*BaseReportSender) SendAction ¶
func (sender *BaseReportSender) SendAction(actionName string, sendReport bool)
func (*BaseReportSender) SendAsRoutine ¶
func (sender *BaseReportSender) SendAsRoutine(progressNext bool)
The caller must read the errChan, to prevent the goroutine from waiting in memory forever
func (*BaseReportSender) SendDetails ¶
func (sender *BaseReportSender) SendDetails(details string, sendReport bool)
func (*BaseReportSender) SendError ¶
func (sender *BaseReportSender) SendError(err error, sendReport bool, initErrors bool)
func (*BaseReportSender) SendStatus ¶
func (sender *BaseReportSender) SendStatus(status string, sendReport bool)
func (*BaseReportSender) SendWarning ¶
func (sender *BaseReportSender) SendWarning(warnMsg string, sendReport bool, initWarnings bool)
func (*BaseReportSender) SetActionID ¶
func (sender *BaseReportSender) SetActionID(val string)
func (*BaseReportSender) SetActionIDN ¶
func (sender *BaseReportSender) SetActionIDN(val int)
func (*BaseReportSender) SetActionName ¶
func (sender *BaseReportSender) SetActionName(val string)
func (*BaseReportSender) SetCustomerGUID ¶
func (sender *BaseReportSender) SetCustomerGUID(val string)
func (*BaseReportSender) SetDetails ¶
func (sender *BaseReportSender) SetDetails(val string)
func (*BaseReportSender) SetJobID ¶
func (sender *BaseReportSender) SetJobID(val string)
func (*BaseReportSender) SetParentAction ¶
func (sender *BaseReportSender) SetParentAction(val string)
func (*BaseReportSender) SetReporter ¶
func (sender *BaseReportSender) SetReporter(val string)
func (*BaseReportSender) SetStatus ¶
func (sender *BaseReportSender) SetStatus(val string)
func (*BaseReportSender) SetTarget ¶
func (sender *BaseReportSender) SetTarget(val string)
func (*BaseReportSender) SetTimestamp ¶
func (sender *BaseReportSender) SetTimestamp(val time.Time)
func (*BaseReportSender) SimpleReportAnnotations ¶
func (sender *BaseReportSender) SimpleReportAnnotations(setParent bool, setCurrent bool) (string, string)
type Control ¶
type Control = reporthandling.Control
Control is an alias to the API type definition for a control.
type CustomerConfig ¶
type CustomerConfig = armotypes.CustomerConfig
CustomerConfig is an alias to the API type definition for a customer configuration.
type Framework ¶
type Framework = reporthandling.Framework
Framework is an alias to the API type definition for a framework.
type HttpReportSender ¶ added in v0.0.3
type HttpReportSender struct {
// contains filtered or unexported fields
}
type HttpReportSenderMock ¶ added in v0.0.3
type HttpReportSenderMock struct { }
type IHttpSender ¶ added in v0.0.3
type IReportSender ¶
type IReportSender interface { systemreports.IReporter Send() (int, string, error) //send logic here /* SendAsRoutine @input: collector []string - leave as empty (a way to hold all previous failed reports and send them in bulk) progressNext bool - increase actionID, sometimes u send parallel jobs that have the same order - (vuln scanning a cluster for eg. all wl scans have the same order) errChan - chan to allow the goroutine to return the errors inside */ SendAsRoutine(bool) //goroutine wrapper // set methods SendAction(action string, sendReport bool) SendError(err error, sendReport bool, initErrors bool) SendStatus(status string, sendReport bool) SendDetails(details string, sendReport bool) SendWarning(warning string, sendReport bool, initWarnings bool) }
type KSCloudAPI ¶
type KSCloudAPI struct { *KsCloudOptions // contains filtered or unexported fields }
KSCloudAPI allows to access the API of the Kubescape Cloud offering.
func NewEmptyKSCloudAPI ¶
func NewEmptyKSCloudAPI(opts ...KSCloudOption) *KSCloudAPI
NewEmptyKSCloudAPI creates a new KSCloudAPI without any hosts set.
func NewKSCloudAPI ¶
func NewKSCloudAPI(apiURL, reportURL, accountID string, opts ...KSCloudOption) (*KSCloudAPI, error)
func (*KSCloudAPI) GetAccountConfig ¶
func (api *KSCloudAPI) GetAccountConfig(clusterName string, opts ...RequestOption) (*CustomerConfig, error)
GetAccountConfig yields the account configuration.
func (*KSCloudAPI) GetAccountID ¶
func (api *KSCloudAPI) GetAccountID() string
GetAccountID returns the customer account's GUID.
func (*KSCloudAPI) GetAttackTracks ¶
func (api *KSCloudAPI) GetAttackTracks(opts ...RequestOption) ([]AttackTrack, error)
func (*KSCloudAPI) GetCloudAPIURL ¶
func (api *KSCloudAPI) GetCloudAPIURL() string
func (*KSCloudAPI) GetCloudReportURL ¶
func (api *KSCloudAPI) GetCloudReportURL() string
func (*KSCloudAPI) GetControl ¶
func (api *KSCloudAPI) GetControl(ID string) (*Control, error)
GetControl is currently not exposed as a public API endpoint.
func (*KSCloudAPI) GetControlsInputs ¶
func (api *KSCloudAPI) GetControlsInputs(clusterName string, opts ...RequestOption) (map[string][]string, error)
GetControlsInputs returns the controls inputs configured in the account configuration.
func (*KSCloudAPI) GetExceptions ¶
func (api *KSCloudAPI) GetExceptions(clusterName string, opts ...RequestOption) ([]PostureExceptionPolicy, error)
GetExceptions returns exception policies.
func (*KSCloudAPI) GetFramework ¶
func (api *KSCloudAPI) GetFramework(frameworkName string, opts ...RequestOption) (*Framework, error)
GetFramework retrieves a framework by name.
func (*KSCloudAPI) GetFrameworks ¶
func (api *KSCloudAPI) GetFrameworks(opts ...RequestOption) ([]Framework, error)
GetFrameworks returns all registered frameworks.
func (*KSCloudAPI) ListControls ¶
func (api *KSCloudAPI) ListControls() ([]string, error)
ListControls is currently not exposed as a public API endpoint.
func (*KSCloudAPI) ListCustomFrameworks ¶
func (api *KSCloudAPI) ListCustomFrameworks() ([]string, error)
ListCustomFrameworks lists the names of all non-native frameworks that have been registered for this account.
func (*KSCloudAPI) ListFrameworks ¶
func (api *KSCloudAPI) ListFrameworks(opts ...RequestOption) ([]string, error)
ListFrameworks list the names of all registered frameworks.
func (*KSCloudAPI) SubmitReport ¶
func (api *KSCloudAPI) SubmitReport(report *PostureReport) error
SubmitReport uploads a posture report.
type KSCloudOption ¶
type KSCloudOption func(*KsCloudOptions)
KSCloudOption allows to configure the behavior of the KS Cloud client.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) KSCloudOption
WithHTTPClient overrides the default http.Client used by the KS Cloud client.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) KSCloudOption
WithTimeout sets a global timeout on a operations performed by the KS Cloud client.
A value of 0 means no timeout.
The default is 61s.
func WithTrace ¶
func WithTrace(enabled bool) KSCloudOption
WithTrace toggles requests dump for inspection & debugging.
type KsCloudOptions ¶
type KsCloudOptions struct {
// contains filtered or unexported fields
}
ksCloudOptions holds all the configurable parts of the KS Cloud client.
type PostureExceptionPolicy ¶
type PostureExceptionPolicy = armotypes.PostureExceptionPolicy
PostureExceptionPolicy is an alias to the API type definition for posture exception policy.
type PostureReport ¶
type PostureReport = reporthandlingv2.PostureReport
PostureReport is an alias to the API type definition for a posture report.
type RequestOption ¶ added in v0.0.7
type RequestOption func(*RequestOptions)
request option instructs post/get/delete to alter the outgoing request
func WithContentJSON ¶ added in v0.0.7
func WithContentJSON(enabled bool) RequestOption
WithContentJSON sets JSON content type for a request
func WithHeaders ¶ added in v0.0.7
func WithHeaders(headers map[string]string) RequestOption
WithContentJSON sets JSON content type for a request
type RequestOptions ¶ added in v0.0.7
type RequestOptions struct {
// contains filtered or unexported fields
}
RequestOptions knows how to enrich a request with headers