notifications

package
v0.0.218 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationBeforeUpdateContainerScanEvent = "beforeUpdateContainerScan"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertChannel

type AlertChannel struct {
	ChannelType             ChannelProvider `json:"channelType,omitempty" bson:"channelType,omitempty"`
	Scope                   []AlertScope    `json:"scope,omitempty" bson:"scope,omitempty"`
	CollaborationConfigGUID string          `json:"collaborationConfigId,omitempty" bson:"collaborationConfigId,omitempty"`
	Alerts                  []AlertConfig   `json:"notifications,omitempty" bson:"notifications,omitempty"`
}

func (*AlertChannel) AddAlertConfig

func (ac *AlertChannel) AddAlertConfig(config AlertConfig) error

func (*AlertChannel) GetAlertConfig

func (ac *AlertChannel) GetAlertConfig(notificationType NotificationType) *AlertConfig

func (*AlertChannel) IsInScope

func (ac *AlertChannel) IsInScope(cluster, namespace string) bool

type AlertChannelAPI added in v0.0.213

type AlertChannelAPI struct {
	// Channel connection definition
	// Example: webhook connection
	Channel CollaborationConfig `json:"channel"`

	// Notifications configurations
	// Example: new cluster admin
	Notifications []AlertConfig `json:"notifications"`

	// Scope selected clusters/namespaces
	// Example cluster123, [nspace1, nspace2]
	Scope []AlertScope `json:"scope"`
}

AlertChannelAPI An Alerting Channel configuration swagger:model AlertChannelAPI

type AlertConfig

type AlertConfig struct {
	NotificationConfigIdentifier `json:",inline" bson:",inline"`
	Parameters                   NotificationParams `json:"parameters,omitempty" bson:"parameters,omitempty"`
	Disabled                     *bool              `json:"disabled,omitempty" bson:"disabled,omitempty"`
}

func (*AlertConfig) IsEnabled

func (ac *AlertConfig) IsEnabled() bool

type AlertScope

type AlertScope struct {
	Cluster    string   `json:"cluster,omitempty" bson:"cluster,omitempty"`
	Namespaces []string `json:"namespaces,omitempty" bson:"namespaces,omitempty"`
}

func (*AlertScope) IsInScope

func (ac *AlertScope) IsInScope(cluster, namespace string) bool

type ChannelProvider

type ChannelProvider string
const (
	CollaborationTypeJira  ChannelProvider = "jira"
	CollaborationTypeSlack ChannelProvider = "slack"
	CollaborationTypeTeams ChannelProvider = "teams"
	CollaborationTypeEmail ChannelProvider = "email"
)

type ClusterResourceScanned

type ClusterResourceScanned struct {
	ShortName       string          `json:"shortName" bson:"shortName"`
	Cluster         ResourceScanned `json:"cluster" bson:"cluster"`
	ReportGUID      string          `json:"reportGUID" bson:"reportGUID"`
	FailedResources uint64          `json:"failedResources" bson:"failedResources"`
}

type CollabAssignee

type CollabAssignee struct {

	//example: can be channelID(slack) "C02HD5MU9G8" and etc.
	AssgineeID string `json:"assigneeID"`

	//example: #abuse(slack)
	AssigneeName string `json:"assigneeName"`

	//put here properties of the assignee, ad
	AdditionalInfo []identifiers.ArmoContext `json:"additionalInfo"`
}

type CollaborationConfig

type CollaborationConfig struct {
	armotypes.PortalBase `json:",inline" bson:",inline"`

	// Provider name
	// Example: jira
	Provider ChannelProvider `json:"provider,omitempty" bson:"provider,omitempty"`

	// Host name for private hosting
	// Example: http://example.com
	HostName string `json:"hostName,omitempty" bson:"hostName,omitempty"`

	// The context of sharing (for example in jira it will be cloud, project, etc)
	Context map[string]CollaborationConfigOption `json:"context" bson:"context,omitempty"`

	// Icon url for the option. Optional
	// Example: https://site-admin-avatar-cdn.prod.public.atl-paas.net/avatars/240/triangle.png
	IconURL string `json:"iconURL,omitempty" bson:"iconURL,omitempty"`

	// Icon for the option encoded in base64. Optional
	IconBase64 string `json:"iconBase64,omitempty" bson:"iconBase64,omitempty"`

	CreationTime string `json:"creationTime,omitempty" bson:"creationTime,omitempty"`
}

swagger:model CollaborationConfig

type CollaborationConfigOption

type CollaborationConfigOption struct {
	// Type of the option
	// Example: Project
	Type *CollaborationConfigOptionType `json:"type,omitempty" bson:"type,omitempty"`

	// Name of the option
	// Example: jira-main-project
	Name string `json:"name" bson:"name,omitempty"`

	// ID of the option
	// Example: 8313c5a0-bee1-4a3c-8f4f-71ce698259876 or https://teams/mywebhook
	ID string `json:"id" bson:"id,omitempty"`

	// Icon url for the option. Optional
	// Example: https://site-admin-avatar-cdn.prod.public.atl-paas.net/avatars/240/triangle.png
	IconURL string `json:"iconURL,omitempty" bson:"iconURL,omitempty"`

	// Icon for the option encoded in base64. Optional
	IconBase64 string `json:"iconBase64,omitempty" bson:"iconBase64,omitempty"`
}

Collaboration provider config option swagger:model CollaborationConfigOption

type CollaborationConfigOptionType

type CollaborationConfigOptionType struct {
	// Name of the type
	// Example: project
	Name string `json:"name" bson:"name,omitempty"`

	// Indicates if this option is a mandatory for collaboration configuration
	// Example: false
	ConfigRequired bool `json:"required" bson:"required"`

	// Indicates if this option is a mandatory for sharing
	// Example: true
	ShareRequired bool `json:"-"`

	// Custom input available or not
	// Example: false
	CustomInput bool `json:"customInput" bson:"customInput"`
}

Config option type swagger:model CollaborationConfigOptionType

type Misconfiguration

type Misconfiguration struct {
	Name                      string
	Type                      ScanType
	Link                      string
	PercentageIncrease        uint64
	FrameworksComplianceDrift map[string]int
}

type Misconfigurations

type Misconfigurations []Misconfiguration

type NewClusterAdmin

type NewClusterAdmin struct {
	Resource    string
	Link        string
	ClusterName string
}

type NewClusterAdmins

type NewClusterAdmins []NewClusterAdmin

type NotificationConfigIdentifier

type NotificationConfigIdentifier struct {
	NotificationType NotificationType `json:"notificationType,omitempty" bson:"notificationType,omitempty"`
}

func (*NotificationConfigIdentifier) Validate

func (nci *NotificationConfigIdentifier) Validate() error

type NotificationParams

type NotificationParams struct {
	DriftPercentage *int `json:"driftPercentage,omitempty" bson:"driftPercentage,omitempty"`
	MinSeverity     *int `json:"minSeverity,omitempty" bson:"minSeverity,omitempty"`
}

func (*NotificationParams) SetDriftPercentage

func (ap *NotificationParams) SetDriftPercentage(percentage int)

func (*NotificationParams) SetMinSeverity

func (ap *NotificationParams) SetMinSeverity(severity int)

type NotificationPushEvent

type NotificationPushEvent struct {
	EventName   string                       `json:"eventName"`
	EventTime   time.Time                    `json:"eventTime"`
	Designators identifiers.PortalDesignator `json:"designators,omitempty"`
}

type NotificationType

type NotificationType string
const (
	NotificationTypeWeekly              NotificationType = "weekly"            //weekly report
	NotificationTypePush                NotificationType = "push"              //posture scan
	NotificationTypeContainerPush       NotificationType = "containerScanPush" //container scan
	NotificationTypeComplianceDrift     NotificationType = NotificationTypePush + ":complianceDrift"
	NotificationTypeNewClusterAdmin     NotificationType = NotificationTypePush + ":newClusterAdmin"
	NotificationTypeNewVulnerability    NotificationType = NotificationTypeContainerPush + ":newVulnerability"
	NotificationTypeVulnerabilityNewFix NotificationType = NotificationTypeContainerPush + ":vulnerabilityNewFix"
)

type NotificationsConfig

type NotificationsConfig struct {
	//Map of unsubscribed user id to notification config identifier
	UnsubscribedUsers  map[string][]NotificationConfigIdentifier `json:"unsubscribedUsers,omitempty" bson:"unsubscribedUsers,omitempty"`
	LatestWeeklyReport *WeeklyReport                             `json:"latestWeeklyReport,omitempty" bson:"latestWeeklyReport,omitempty"`
	LatestPushReports  map[string]*PushReport                    `json:"latestPushReports,omitempty" bson:"latestPushReports,omitempty"`
	AlertChannels      map[ChannelProvider][]AlertChannel        `json:"alertChannels,omitempty" bson:"alertChannels,omitempty"`
}

func (*NotificationsConfig) AddLatestPushReport

func (nc *NotificationsConfig) AddLatestPushReport(report *PushReport)

func (*NotificationsConfig) GetAlertChannelByCollaborationID added in v0.0.213

func (nc *NotificationsConfig) GetAlertChannelByCollaborationID(collaborationId string) (*AlertChannel, error)

func (*NotificationsConfig) GetAlertConfigurations

func (nc *NotificationsConfig) GetAlertConfigurations(notificationType NotificationType) []AlertConfig

func (*NotificationsConfig) GetLatestPushReport

func (nc *NotificationsConfig) GetLatestPushReport(cluster string, scanType ScanType) *PushReport

func (*NotificationsConfig) GetProviderChannels

func (nc *NotificationsConfig) GetProviderChannels(provider ChannelProvider) []AlertChannel

func (*NotificationsConfig) IsInScope

func (nc *NotificationsConfig) IsInScope(cluster, namespace string) bool

func (*NotificationsConfig) RemoveAlertChannel added in v0.0.213

func (nc *NotificationsConfig) RemoveAlertChannel(collaborationId string) error

type PushNotification

type PushNotification struct {
	Misconfigurations Misconfigurations
	NewClusterAdmins  NewClusterAdmins
}

type PushReport

type PushReport struct {
	Cluster                   string             `json:"custer,omitempty" bson:"custer,omitempty"`
	ReportGUID                string             `json:"reportGUID,omitempty" bson:"reportGUID,omitempty"`
	ScanType                  ScanType           `json:"scanType" bson:"scanType"`
	Timestamp                 time.Time          `json:"timestamp,omitempty" bson:"timestamp,omitempty"`
	FailedResources           uint64             `json:"failedResources,omitempty" bson:"failedResources,omitempty"`
	FrameworksComplianceScore map[string]float32 `json:"frameworksComplianceScore,omitempty" bson:"frameworksComplianceScore,omitempty"`
}

type RegistryScanned

type RegistryScanned struct {
	Registry ResourceScanned `json:"registry" bson:"registry"`
}

type RepositoryScanned

type RepositoryScanned struct {
	ReportGUID string          `json:"reportGUID" bson:"reportGUID"`
	Repository ResourceScanned `json:"repository" bson:"repository"`
}

type ResourceScanned

type ResourceScanned struct {
	Kind                         string                     `json:"kind" bson:"kind"`
	Name                         string                     `json:"name" bson:"name"`
	MapSeverityToSeverityDetails map[string]SeverityDetails `json:"mapSeverityToSeverityDetails" bson:"mapSeverityToSeverityDetails"`
}

type ScanType

type ScanType string
const (
	ScanTypePosture      ScanType = "posture"
	ScanTypeRepositories ScanType = "repository"
)

type SeverityDetails

type SeverityDetails struct {
	Severity              string `json:"severity" bson:"severity"`
	FailedResourcesNumber int    `json:"failedResourcesNumber" bson:"failedResourcesNumber"`
}

type TopCtrlCluster

type TopCtrlCluster struct {
	Name               string `json:"name" bson:"name"`
	ResourcesCount     int64  `json:"resourcesCount" bson:"resourcesCount"`
	ReportGUID         string `json:"reportGUID" bson:"reportGUID"`
	TopFailedFramework string `json:"topFailedFramework" bson:"topFailedFramework"`
}

type TopCtrlItem

type TopCtrlItem struct {
	ControlID            string           `json:"id" bson:"id"`
	ControlGUID          string           `json:"guid" bson:"guid"`
	Name                 string           `json:"name" bson:"name"`
	Remediation          string           `json:"remediation" bson:"remediation"`
	Description          string           `json:"description" bson:"description"`
	ClustersCount        int64            `json:"clustersCount" bson:"clustersCount"`
	SeverityOverall      int64            `json:"severityOverall" bson:"severityOverall"`
	BaseScore            int64            `json:"baseScore" bson:"baseScore"`
	Clusters             []TopCtrlCluster `json:"clusters" bson:"clusters"`
	TotalFailedResources int64            `json:"-"`
}

func (*TopCtrlItem) GetTotalFailedResources

func (t *TopCtrlItem) GetTotalFailedResources() int64

type WeeklyReport

type WeeklyReport struct {
	ClustersScannedThisWeek             int                        `json:"clustersScannedThisWeek" bson:"clustersScannedThisWeek"`
	ClustersScannedPrevWeek             int                        `json:"clustersScannedPrevWeek" bson:"clustersScannedPrevWeek"`
	LinkToConfigurationScanningFiltered string                     `json:"linkToConfigurationScanningFiltered" bson:"linkToConfigurationScanningFiltered"`
	RepositoriesScannedThisWeek         int                        `json:"repositoriesScannedThisWeek" bson:"repositoriesScannedThisWeek"`
	RepositoriesScannedPrevWeek         int                        `json:"repositoriesScannedPrevWeek" bson:"repositoriesScannedPrevWeek"`
	LinkToRepositoriesScanningFiltered  string                     `json:"linkToRepositoriesScanningFiltered" bson:"linkToRepositoriesScanningFiltered"`
	RegistriesScannedThisWeek           int                        `json:"registriesScannedThisWeek" bson:"registriesScannedThisWeek"`
	RegistriesScannedPrevWeek           int                        `json:"registriesScannedPrevWeek" bson:"registriesScannedPrevWeek"`
	LinkToRegistriesScanningFiltered    string                     `json:"linkToRegistriesScanningFiltered" bson:"linkToRegistriesScanningFiltered"`
	Top5FailedControls                  []TopCtrlItem              `json:"top5FailedControls" bson:"top5FailedControls"`
	Top5FailedCVEs                      []containerscan.TopVulItem `json:"top5FailedCVEs" bson:"top5FailedCVEs"`
	ClustersScanned                     []ClusterResourceScanned   `json:"clustersScanned" bson:"clustersScanned"`
	RepositoriesScanned                 []RepositoryScanned        `json:"repositoriesScanned" bson:"repositoriesScanned"`
	RegistriesScanned                   []RegistryScanned          `json:"registriesScanned" bson:"registriesScanned"`
}

Jump to

Keyboard shortcuts

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