saas

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewScanStatus

func NewScanStatus(clusterScan *v1alpha1.ClusterScan, scans []v1alpha1.ClusterScan) (map[string]*PluginStatus, *int)

func NewScanStatusWithIssues

func NewScanStatusWithIssues(clusterScan *v1alpha1.ClusterScan, scans []v1alpha1.ClusterScan, issues []v1alpha1.ClusterIssue) map[string]*PluginStatus

Types

type Client

type Client interface {
	PutCluster(ctx context.Context, cluster Cluster) error
	DeleteCluster(ctx context.Context, namespace, name string) error
	PutClusterScan(ctx context.Context, namespace, name string, pluginStatus map[string]*PluginStatus) error
	DeleteClusterScan(ctx context.Context, namespace, name string) error
	PutVulnerabilityReport(ctx context.Context, namespace, name string, vulnReport v1alpha2.VulnerabilityReport) error
	PutClusterStatus(ctx context.Context, namespace, name string, pluginStatus map[string]*PluginStatus) error
}

func NewClient

func NewClient(baseURL, version, workspaceID string, httpclient *http.Client) (Client, error)

type Cluster

type Cluster struct {
	ApiVersion        string                   `json:"apiVersion"`
	Name              string                   `json:"name"`
	Namespace         string                   `json:"namespace"`
	Environment       string                   `json:"environment"`
	Provider          string                   `json:"provider"`
	Region            string                   `json:"region"`
	TotalNodes        *int                     `json:"totalNodes"`
	Version           string                   `json:"version"`
	Connection        *ConnectionStatus        `json:"connection"`
	Resources         *Resources               `json:"resources"`
	CreationTimestamp metav1.Time              `json:"creationTimestamp"`
	TotalIssues       *int                     `json:"totalIssues"`
	PluginStatus      map[string]*PluginStatus `json:"pluginStatus"`
}

func NewCluster

func NewCluster(cluster v1alpha1.Cluster) Cluster

NewCluster returns a Cluster without pluginStatus and issues

type ClusterHook

type ClusterHook func(ctx context.Context, cluster *v1alpha1.Cluster) error

func DeleteClusterHook

func DeleteClusterHook(saasClient Client) ClusterHook

func UpdateClusterHook

func UpdateClusterHook(saasClient Client) ClusterHook

type ClusterReference

type ClusterReference struct {
	Name           string `json:"name"`
	Namespace      string `json:"namespace"`
	TotalResources int    `json:"totalResources"`
}

type ClusterScanHook

type ClusterScanHook func(ctx context.Context, clusterScan *v1alpha1.ClusterScan) error

func DeleteClusterScanHook

func DeleteClusterScanHook(saasClient Client, c ctrlClient.Client) ClusterScanHook

func UpdateClusterScanHook

func UpdateClusterScanHook(saasClient Client, c ctrlClient.Client) ClusterScanHook

type ConnectionStatus

type ConnectionStatus struct {
	Connected bool   `json:"connected"`
	Message   string `json:"message"`
}

type Issue

type Issue struct {
	ApiVersion    string `json:"apiVersion"`
	ID            string `json:"id"`
	Message       string `json:"message"`
	Severity      string `json:"severity"`
	Category      string `json:"category"`
	Plugin        string `json:"plugin"`
	Url           string `json:"url"`
	ClusterScoped bool   `json:"clusterScoped"`
	Custom        bool   `json:"custom"`
}

func NewIssue

func NewIssue(clusterIssue v1alpha1.ClusterIssue) Issue

type NamespacedName

type NamespacedName struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type PluginStatus

type PluginStatus struct {
	Scan                   *ScanStatus      `json:"scan"`
	IssueCount             *int             `json:"issueCount"`
	Issues                 []ResourcedIssue `json:"issues"`
	LastSuccessfulScanTime *metav1.Time     `json:"lastSuccessfulScanTime"`
	LastFinishedScanTime   *metav1.Time     `json:"lastFinishedScanTime"`
	NextScheduleScanTime   *metav1.Time     `json:"nextScheduleScanTime"`
	Schedule               string           `json:"schedule"`
	LastSuccessfulScanID   string           `json:"lastSuccessfulScanID"`
}

type Resource

type Resource struct {
	Available       string `json:"available"`
	Usage           string `json:"usage"`
	UsagePercentage int32  `json:"usagePercentage"`
}

type ResourcedIssue

type ResourcedIssue struct {
	Issue     `json:",inline"`
	Resources map[string][]NamespacedName `json:"resources"`
}

func NewResourcedIssue

func NewResourcedIssue(i v1alpha1.ClusterIssue) ResourcedIssue

type Resources

type Resources struct {
	Discovered bool      `json:"discovered"`
	Message    string    `json:"message"`
	Memory     *Resource `json:"memory"`
	CPU        *Resource `json:"cpu"`
}

type ScanStatus

type ScanStatus struct {
	Status  ScanStatusType `json:"status"`
	Message string         `json:"message"`
	Suspend bool           `json:"suspend"`
	ID      string         `json:"id"`
}

type ScanStatusType

type ScanStatusType string
const (
	Failed  ScanStatusType = "failed"
	Unknown ScanStatusType = "unknown"
	Scanned ScanStatusType = "scanned"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL