v2

package
v0.0.191 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: Apache-2.0 Imports: 14 Imported by: 17

Documentation

Index

Constants

View Source
const (
	GKE = "GKE"
	GCP = "GCP"
	EKS = "EKS"
)

Variables

View Source
var PostureReportMockPassedSingleResource = `` /* 6734-byte string literal not displayed */
View Source
var ResourcesListMock = `` /* 69799-byte string literal not displayed */

Functions

func GetResourcesListMock

func GetResourcesListMock() []reporthandling.Resource

Types

type ClusterMetadata

type ClusterMetadata struct {
	NumberOfWorkerNodes             int            `json:"numberOfWorkerNodes,omitempty"`
	CloudProvider                   string         `json:"cloudProvider,omitempty"`
	ContextName                     string         `json:"contextName,omitempty"`
	MapNamespaceToNumberOfResources map[string]int `json:"namespaceToNumberOfResources,omitempty"`
}

func (*ClusterMetadata) NKeys

func (file *ClusterMetadata) NKeys() int

func (*ClusterMetadata) UnmarshalJSONObject

func (m *ClusterMetadata) UnmarshalJSONObject(dec *gojay.Decoder, key string) (err error)

ScanMetadata unmarshaller

type ContextMetadata

type ContextMetadata struct {
	ClusterContextMetadata   *ClusterMetadata          `json:"clusterContextMetadata,omitempty"`
	RepoContextMetadata      *RepoContextMetadata      `json:"gitRepoContextMetadata,omitempty"`
	FileContextMetadata      *FileContextMetadata      `json:"fileContextMetadata,omitempty"`
	HelmContextMetadata      *HelmContextMetadata      `json:"helmContextMetadata,omitempty"`
	DirectoryContextMetadata *DirectoryContextMetadata `json:"directoryContextMetadata,omitempty"`
}

type DirectoryContextMetadata

type DirectoryContextMetadata struct {
	BasePath string `json:"basePath,omitempty"` // the scanning request base path
	HostName string `json:"hostName,omitempty"` // like "hostpath"
}

type FileContextMetadata

type FileContextMetadata struct {
	FilePath string `json:"filePath,omitempty"` // like "hostpath"
	HostName string `json:"hostName,omitempty"` // like "hostpath"
}

type HelmContextMetadata

type HelmContextMetadata struct {
	ChartName string `json:"chartName,omitempty"`
}

type IBasicPostureReport

type IBasicPostureReport interface {
	reportsummary.IBasicPostureReport
	GetScannigTarget() ScanningTarget
	GetContextMetadata() *ContextMetadata
	GetRepositoryHash() string
}

type Metadata

type Metadata struct {
	ScanMetadata    ScanMetadata    `json:"scanMetadata,omitempty"`
	ContextMetadata ContextMetadata `json:"targetMetadata,omitempty"`
	ClusterMetadata ClusterMetadata `json:"clusterMetadata,omitempty"` // DEPRECATED
}

func (*Metadata) NKeys

func (file *Metadata) NKeys() int

func (*Metadata) UnmarshalJSONObject

func (m *Metadata) UnmarshalJSONObject(dec *gojay.Decoder, key string) (err error)

Metadata unmarshaller

type PostureReport

type PostureReport struct {
	Attributes           []reportsummary.PostureAttributes `json:"attributes"` //allow flexible properties for posture reports
	CustomerGUID         string                            `json:"customerGUID"`
	ClusterName          string                            `json:"clusterName"`
	ClusterCloudProvider string                            `json:"clusterCloudProvider"` // Deprecated
	ReportID             string                            `json:"reportGUID"`
	JobID                string                            `json:"jobID"`
	PaginationInfo       armoapi.PaginationMarks           `json:"paginationInfo"`
	ClusterAPIServerInfo *version.Info                     `json:"clusterAPIServerInfo"`
	ReportGenerationTime time.Time                         `json:"generationTime"`
	SummaryDetails       reportsummary.SummaryDetails      `json:"summaryDetails,omitempty"`
	Results              []resourcesresults.Result         `json:"results,omitempty"`
	Resources            []reporthandling.Resource         `json:"resources,omitempty"` // Deprecated
	Metadata             Metadata                          `json:"metadata,omitempty"`
}

PostureReport posture scanning report structure

func GetPostureReportMockPassedSingleResource

func GetPostureReportMockPassedSingleResource() *PostureReport

func (*PostureReport) AppendResourceResultToSummary

func (postureReport *PostureReport) AppendResourceResultToSummary(resourceResult *resourcesresults.Result)

AppendResourceResultToSummary get the result of a single resource. If resource not found will return nil

func (*PostureReport) GetClusterName

func (postureReport *PostureReport) GetClusterName() string

func (*PostureReport) GetContextMetadata

func (postureReport *PostureReport) GetContextMetadata() *ContextMetadata

func (*PostureReport) GetCustomerGUID

func (postureReport *PostureReport) GetCustomerGUID() string

========IPostureReport implementations =======

func (*PostureReport) GetJobID

func (postureReport *PostureReport) GetJobID() string

func (*PostureReport) GetReportGUID

func (postureReport *PostureReport) GetReportGUID() string

func (*PostureReport) GetRepositoryHash

func (postureReport *PostureReport) GetRepositoryHash() string

func (*PostureReport) GetResource

func (postureReport *PostureReport) GetResource(resourceID string) workloadinterface.IMetadata

GetResource get single resource in IMetadata interface representation

func (*PostureReport) GetScannigTarget

func (postureReport *PostureReport) GetScannigTarget() ScanningTarget

func (*PostureReport) GetStatus

func (postureReport *PostureReport) GetStatus() *helpersv1.Status

Status get the overall scanning status

func (*PostureReport) GetTimestamp

func (postureReport *PostureReport) GetTimestamp() *time.Time

func (*PostureReport) InitializeSummary

func (postureReport *PostureReport) InitializeSummary()

UpdateSummary get the result of a single resource. If resource not found will return nil

func (*PostureReport) ListControls

func (postureReport *PostureReport) ListControls() []reportsummary.IControlSummary

=========================================== List Controls ==================================== ListControls list all controls policies summary

func (*PostureReport) ListControlsIDs

func (postureReport *PostureReport) ListControlsIDs() *helpersv1.AllLists

ListControlsIDs list all controls names

func (*PostureReport) ListControlsNames

func (postureReport *PostureReport) ListControlsNames() *helpersv1.AllLists

ListControlsNames list all controls names

func (*PostureReport) ListFrameworks

func (postureReport *PostureReport) ListFrameworks() []reportsummary.IFrameworkSummary

ListFrameworksNames list all framework policies summary

func (*PostureReport) ListFrameworksNames

func (postureReport *PostureReport) ListFrameworksNames() *helpersv1.AllLists

ListFrameworksNames list all frameworks names

func (*PostureReport) ListResourcesIDs

func (postureReport *PostureReport) ListResourcesIDs(f *helpersv1.Filters) *helpersv1.AllLists

func (*PostureReport) NKeys

func (file *PostureReport) NKeys() int

func (*PostureReport) ResourceResult

func (postureReport *PostureReport) ResourceResult(resourceID string) *resourcesresults.Result

ResourceResult get the result of a single resource. If resource not found will return nil

func (*PostureReport) ResourceStatus

func (postureReport *PostureReport) ResourceStatus(resourceID string, f *helpersv1.Filters) apis.IStatus

ResourceStatus get single resource status. If resource not found will return an empty string

func (*PostureReport) ToBytes

func (pr *PostureReport) ToBytes() ([]byte, error)

func (*PostureReport) ToString

func (pr *PostureReport) ToString() string

func (*PostureReport) UnmarshalJSONObject

func (r *PostureReport) UnmarshalJSONObject(dec *gojay.Decoder, key string) (err error)
responsible on fast unmarshaling of various COMMON posture report v2 structure for basic validation

UnmarshalJSONObject - File inside a pkg

type RepoContextMetadata

type RepoContextMetadata struct {
	Provider      string                    `json:"provider,omitempty"` // repo provider name. e.g. github, gitlab
	Repo          string                    `json:"repo,omitempty"`
	Owner         string                    `json:"owner,omitempty"`
	Branch        string                    `json:"branch,omitempty"`
	DefaultBranch string                    `json:"defaultBranch,omitempty"`
	RemoteURL     string                    `json:"remoteURL,omitempty"`
	LastCommit    reporthandling.LastCommit `json:"lastCommit,omitempty"`
}

type ScanMetadata

type ScanMetadata struct {
	Format             string         `json:"format,omitempty"`             // Format results (table, json, junit ...)
	KubescapeVersion   string         `json:"kubescapeVersion,omitempty"`   // Kubescape version
	FormatVersion      string         `json:"formatVersion,omitempty"`      // Format version (v1, v2)
	ScanningTarget     ScanningTarget `json:"scanningTarget,omitempty"`     // scanning target
	ExcludedNamespaces []string       `json:"excludedNamespaces,omitempty"` // used for host sensor namespace
	IncludeNamespaces  []string       `json:"includeNamespaces,omitempty"`
	FailThreshold      float32        `json:"failThreshold,omitempty"`  // Failure score threshold
	Submit             bool           `json:"submit,omitempty"`         // Submit results to Armo BE
	HostScanner        bool           `json:"hostScanner,omitempty"`    // Deploy ARMO K8s host sensor to collect data from certain controls
	Logger             string         `json:"logger,omitempty"`         // logger level - debug/info/error
	TargetType         string         `json:"targetType,omitempty"`     // framework/control
	TargetNames        []string       `json:"targetNames,omitempty"`    // list of frameworks/controls
	UseExceptions      string         `json:"useExceptions,omitempty"`  // Load file with exceptions configuration
	ControlsInputs     string         `json:"controlsInputs,omitempty"` // Load file with inputs for controls
	VerboseMode        bool           `json:"verboseMode,omitempty"`    // Display all of the input resources and not only failed resources
}

func (*ScanMetadata) NKeys

func (file *ScanMetadata) NKeys() int

func (*ScanMetadata) UnmarshalJSONObject

func (m *ScanMetadata) UnmarshalJSONObject(dec *gojay.Decoder, key string) (err error)

ScanMetadata unmarshaler

type ScanningTarget

type ScanningTarget uint16
const (
	Cluster   ScanningTarget = 0
	File      ScanningTarget = 1
	Repo      ScanningTarget = 2
	GitLocal  ScanningTarget = 3
	Directory ScanningTarget = 4
)

func (*ScanningTarget) String

func (st *ScanningTarget) String() string

Jump to

Keyboard shortcuts

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