models

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkUploadInput

type BulkUploadInput struct {
	Data   string `json:"data" validate:"required"` // base64-encoded zipfile
	UserID string `json:"userId" validate:"required"`
}

type BulkUploadOutput

type BulkUploadOutput struct {
	TotalPolicies    int `json:"totalPolicies"`
	NewPolicies      int `json:"newPolicies"`
	ModifiedPolicies int `json:"modifiedPolicies"`

	TotalRules    int `json:"totalRules"`
	NewRules      int `json:"newRules"`
	ModifiedRules int `json:"modifiedRules"`

	TotalGlobals    int `json:"totalGlobals"`
	NewGlobals      int `json:"newGlobals"`
	ModifiedGlobals int `json:"modifiedGlobals"`

	TotalDataModels    int `json:"totalDataModels"`
	NewDataModels      int `json:"newDataModels"`
	ModifiedDataModels int `json:"modifiedDataModels"`
}

type CreateDataModelInput

type CreateDataModelInput = UpdateDataModelInput

type CreateGlobalInput

type CreateGlobalInput = UpdateGlobalInput

type CreatePolicyInput

type CreatePolicyInput = UpdatePolicyInput

type CreateRuleInput

type CreateRuleInput = UpdateRuleInput

type DataModel

type DataModel struct {
	Body           string             `json:"body"`
	CreatedAt      time.Time          `json:"createdAt"`
	CreatedBy      string             `json:"createdBy"`
	Description    string             `json:"description"`
	DisplayName    string             `json:"displayName"`
	Enabled        bool               `json:"enabled"`
	ID             string             `json:"id"`
	LastModified   time.Time          `json:"lastModified"`
	LastModifiedBy string             `json:"lastModifiedBy"`
	LogTypes       []string           `json:"logTypes"`
	Mappings       []DataModelMapping `json:"mappings"`
	VersionID      string             `json:"versionId"`
}

type DataModelMapping

type DataModelMapping struct {
	Name   string `json:"name" validate:"required,max=1000"`
	Path   string `json:"path" validate:"required_without=Method,max=1000"`
	Method string `json:"method" validate:"required_without=Path,max=1000"`
}

type DeleteDataModelsInput

type DeleteDataModelsInput = DeletePoliciesInput

type DeleteEntry

type DeleteEntry struct {
	ID string `json:"id" validate:"required,max=1000"`
}

type DeleteGlobalsInput

type DeleteGlobalsInput = DeletePoliciesInput

type DeletePoliciesInput

type DeletePoliciesInput struct {
	Entries []DeleteEntry `json:"entries" validate:"min=1,max=1000,dive"`
}

type DeleteRulesInput

type DeleteRulesInput = DeletePoliciesInput

type Detection added in v1.16.0

type Detection struct {
	// Policy only
	AutoRemediationID         string                  `json:"autoRemediationId" validate:"max=1000"`
	AutoRemediationParameters map[string]string       `json:"autoRemediationParameters" validte:"max=500"`
	ComplianceStatus          models.ComplianceStatus `json:"complianceStatus"`
	ResourceTypes             []string                `json:"resourceTypes"`
	Suppressions              []string                `json:"suppressions" validate:"max=500,dive,required,max=1000"`

	// Rule only
	DedupPeriodMinutes int      `json:"dedupPeriodMinutes"`
	LogTypes           []string `json:"logTypes"`
	Threshold          int      `json:"threshold"`

	// Shared
	AnalysisType   DetectionType       `json:"analysisType"`
	Body           string              `json:"body" validate:"required,max=100000"`
	CreatedAt      time.Time           `json:"createdAt"`
	CreatedBy      string              `json:"createdBy"`
	Description    string              `json:"description"`
	DisplayName    string              `json:"displayName" validate:"max=1000,excludesall='<>&\""`
	Enabled        bool                `json:"enabled"`
	ID             string              `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	LastModified   time.Time           `json:"lastModified"`
	LastModifiedBy string              `json:"lastModifiedBy"`
	OutputIDs      []string            `json:"outputIds" validate:"max=500,dive,required,max=5000"`
	Reference      string              `json:"reference" validate:"max=10000"`
	Reports        map[string][]string `json:"reports" validate:"max=500"`
	Runbook        string              `json:"runbook" validate:"max=10000"`
	Severity       models.Severity     `json:"severity" validate:"oneof=INFO LOW MEDIUM HIGH CRITICAL"`
	Tags           []string            `json:"tags" validate:"max=500,dive,required,max=1000"`
	Tests          []UnitTest          `json:"tests" validate:"max=500,dive"`
	VersionID      string              `json:"versionId"`
}

type DetectionType

type DetectionType string
const (
	TypePolicy    DetectionType = "POLICY"
	TypeRule      DetectionType = "RULE"
	TypeGlobal    DetectionType = "GLOBAL"
	TypeDataModel DetectionType = "DATAMODEL"
	TypePack      DetectionType = "PACK"
)

type EnumeratePackInput added in v1.16.0

type EnumeratePackInput struct {

	// Take in the pack definition
	ID string `json:"id"`

	// Detection fields to return in the response (default: all)
	Fields []string `json:"fields" validate:"max=20,dive,required,max=100"`

	// ----- Paging -----
	PageSize int `json:"pageSize" validate:"min=0,max=1000"`
	Page     int `json:"page" validate:"min=0"`
}

EnumeratePack is similar to ListDetections, ListGlobals, and ListDataModels in that it will return paged data given some input filter. It differs in that it will return any type (whether it be policy, rule, data model, global, etc.)

type EnumeratePackOutput added in v1.16.0

type EnumeratePackOutput struct {
	Paging     Paging      `json:"paging"`
	Detections []Detection `json:"detections"`
	Globals    []Global    `json:"globals"`
	Models     []DataModel `json:"models"`
}

type GetDataModelInput

type GetDataModelInput struct {
	ID        string `json:"id" validate:"required,max=1000"`
	VersionID string `json:"versionId" validate:"omitempty,len=32"`
}

type GetGlobalInput

type GetGlobalInput struct {
	ID        string `json:"id" validate:"required,max=1000"`
	VersionID string `json:"versionId" validate:"omitempty,len=32"`
}

type GetPackInput added in v1.16.0

type GetPackInput struct {
	ID string `json:"id" validate:"required,max=1000,excludesall='<>&\""`
}

type GetPolicyInput

type GetPolicyInput struct {
	ID        string `json:"id" validate:"required,max=1000"`
	VersionID string `json:"versionId" validate:"omitempty,len=32"`
}

type GetRuleInput

type GetRuleInput struct {
	ID        string `json:"id" validate:"required,max=1000"`
	VersionID string `json:"versionId" validate:"omitempty,len=32"`
}

type Global

type Global struct {
	Body           string    `json:"body"`
	CreatedAt      time.Time `json:"createdAt"`
	CreatedBy      string    `json:"createdBy"`
	Description    string    `json:"description"`
	ID             string    `json:"id"`
	LastModified   time.Time `json:"lastModified"`
	LastModifiedBy string    `json:"lastModifiedBy"`
	Tags           []string  `json:"tags"`
	VersionID      string    `json:"versionId"`
}

type LambdaInput

type LambdaInput struct {
	// Shared
	BulkUpload       *BulkUploadInput     `json:"bulkUpload,omitempty"`
	ListDetections   *ListDetectionsInput `json:"listDetections,omitempty"`
	DeleteDetections *DeletePoliciesInput `json:"deleteDetections,omitempty"`

	// Globals
	CreateGlobal  *CreateGlobalInput  `json:"createGlobal,omitempty"`
	DeleteGlobals *DeleteGlobalsInput `json:"deleteGlobals,omitempty"`
	GetGlobal     *GetGlobalInput     `json:"getGlobal,omitempty"`
	ListGlobals   *ListGlobalsInput   `json:"listGlobals,omitempty"`
	UpdateGlobal  *UpdateGlobalInput  `json:"updateGlobal,omitempty"`

	// Policies (cloud security)
	CreatePolicy   *CreatePolicyInput   `json:"createPolicy,omitempty"`
	DeletePolicies *DeletePoliciesInput `json:"deletePolicies,omitempty"`
	GetPolicy      *GetPolicyInput      `json:"getPolicy,omitempty"`
	// TODO deprecate this endpoint in favor of ListDetections
	ListPolicies *ListPoliciesInput `json:"listPolicies,omitempty"`
	Suppress     *SuppressInput     `json:"suppress,omitempty"`
	TestPolicy   *TestPolicyInput   `json:"testPolicy,omitempty"`
	UpdatePolicy *UpdatePolicyInput `json:"updatePolicy,omitempty"`

	// Rules (log analysis)
	CreateRule  *CreateRuleInput  `json:"createRule,omitempty"`
	DeleteRules *DeleteRulesInput `json:"deleteRules,omitempty"`
	GetRule     *GetRuleInput     `json:"getRule,omitempty"`
	// TODO deprecate this endpoint in favor of ListDetections
	ListRules  *ListRulesInput  `json:"listRules,omitempty"`
	TestRule   *TestRuleInput   `json:"testRule,omitempty"`
	UpdateRule *UpdateRuleInput `json:"updateRule,omitempty"`

	// Data models (log analysis)
	CreateDataModel  *CreateDataModelInput  `json:"createDataModel,omitempty"`
	DeleteDataModels *DeleteDataModelsInput `json:"deleteDataModels,omitempty"`
	GetDataModel     *GetDataModelInput     `json:"getDataModel,omitempty"`
	ListDataModels   *ListDataModelsInput   `json:"listDataModels,omitempty"`
	UpdateDataModel  *UpdateDataModelInput  `json:"updateDataModel,omitempty"`

	// Detection Packs
	GetPack       *GetPackInput       `json:"getPack,omitempty"`
	EnumeratePack *EnumeratePackInput `json:"enumeratePack,omitempty"`
	ListPacks     *ListPacksInput     `json:"listPacks,omitempty"`
	PatchPack     *PatchPackInput     `json:"patchPack,omitempty"`
	PollPacks     *PollPacksInput     `json:"pollPacks,omitempty"`
}

type ListDataModelsInput

type ListDataModelsInput struct {
	// ----- Filtering -----
	// Only include data models which are enabled or disabled
	Enabled *bool `json:"enabled"`

	// Only include data models whose ID contains this substring (case-insensitive)
	NameContains string `json:"nameContains"`

	// Only include data models which apply to one of these log types
	LogTypes []string `json:"logTypes" validate:"dive,required,max=500"`

	// ----- Sorting -----
	SortBy  string `json:"sortBy" validate:"omitempty,oneof=enabled id lastModified logTypes"`
	SortDir string `json:"sortDir" validate:"omitempty,oneof=ascending descending"`

	// ----- Paging -----
	PageSize int `json:"pageSize" validate:"min=0,max=1000"`
	Page     int `json:"page" validate:"min=0"`
}

type ListDataModelsOutput

type ListDataModelsOutput struct {
	Models []DataModel `json:"models"`
	Paging Paging      `json:"paging"`
}

type ListDetectionsInput added in v1.16.0

type ListDetectionsInput struct {

	// Only include policies with a specific compliance status. Only applies to policies.
	ComplianceStatus models.ComplianceStatus `json:"complianceStatus" validate:"omitempty,oneof=PASS FAIL ERROR"`

	// Only include policies with or without auto-remediation enabled. Only applies to policies.
	HasRemediation *bool `json:"hasRemediation"`

	// Only include detections with the following ids
	IDs []string `json:"ids" validate:"max=1000"`

	// Only include policies which apply to one of these resource types. Only applies to policies.
	ResourceTypes []string `json:"resourceTypes" validate:"max=500,dive,required,max=500"`

	// Only include rules which apply to one of these log types. Only applies to rules.
	LogTypes []string `json:"logTypes" validate:"max=500,dive,required,max=500"`

	// Only include detections with the following type
	AnalysisTypes []DetectionType `json:"analysisTypes" validate:"omitempty,dive,oneof=RULE POLICY"`

	// Only include detections whose ID or display name contains this case-insensitive substring
	NameContains string `json:"nameContains" validate:"max=1000"`

	// Only include detections which are enabled or disabled
	Enabled *bool `json:"enabled"`

	// Only include detections with this severity
	Severity []models.Severity `json:"severity" validate:"dive,oneof=INFO LOW MEDIUM HIGH CRITICAL"`

	// Only include detections with all of these tags (case-insensitive)
	Tags []string `json:"tags" validate:"max=500,dive,required,max=500"`

	// Only include detections whose creator matches this user ID (which need not be a uuid)
	CreatedBy string `json:"createdBy"`

	// Only include detections which were last modified by this user ID
	LastModifiedBy string `json:"lastModifiedBy"`

	// If True, include only detections which were created by the system during the initial deployment
	// If False, include only detections where were NOT created by the system during the initial deployment
	InitialSet *bool `json:"initialSet"`

	// Detection fields to return in the response (default: all)
	Fields []string `json:"fields" validate:"max=20,dive,required,max=100"`

	// ----- Sorting -----
	SortBy  string `json:"sortBy" validate:"omitempty,oneof=displayName enabled id lastModified severity"`
	SortDir string `json:"sortDir" validate:"omitempty,oneof=ascending descending"`

	// ----- Paging -----
	PageSize int `json:"pageSize" validate:"min=0,max=1000"`
	Page     int `json:"page" validate:"min=0"`
}

type ListDetectionsOutput added in v1.16.0

type ListDetectionsOutput struct {
	Paging     Paging      `json:"paging"`
	Detections []Detection `json:"detections"`
}

type ListGlobalsInput

type ListGlobalsInput struct {
	// JSON field names (passed to Dynamo as a projection). For example,
	// ["id", "lastModified", "tags"]
	Fields []string `json:"fields" validate:"max=15,dive,required,max=100"`

	SortDir  string `json:"sortDir" validate:"omitempty,oneof=ascending descending"`
	PageSize int    `json:"pageSize" validate:"min=0,max=1000"`
	Page     int    `json:"page" validate:"min=0"`
}

type ListGlobalsOutput

type ListGlobalsOutput struct {
	Paging  Paging   `json:"paging"`
	Globals []Global `json:"globals"`
}

type ListPacksInput added in v1.16.0

type ListPacksInput struct {
	// ----- Filtering -----
	// Only include packs which are enabled or disabled
	Enabled *bool `json:"enabled"`

	// Only include packs which have this packVersion
	PackVersion Version `json:"packVersion"`

	// Only include packs whose ID or display name contains this case-insensitive substring
	NameContains string `json:"nameContains" validate:"max=1000"`

	// Only include packs that have updates available
	UpdateAvailable *bool `json:"updateAvailable"`

	// ----- Projection -----
	// Fields to return in the response (default: all)
	Fields []string `json:"fields" validate:"max=20,dive,required,max=100"`

	// ----- Paging -----
	PageSize int `json:"pageSize" validate:"min=0,max=1000"`
	Page     int `json:"page" validate:"min=0"`
}

type ListPacksOutput added in v1.16.0

type ListPacksOutput struct {
	Paging Paging `json:"paging"`
	Packs  []Pack `json:"packs"`
}

type ListPoliciesInput

type ListPoliciesInput struct {
	// ----- Filtering -----
	// Only include policies with a specific compliance status
	ComplianceStatus models.ComplianceStatus `json:"complianceStatus" validate:"omitempty,oneof=PASS FAIL ERROR"`

	// Only include policies whose ID or display name contains this case-insensitive substring
	NameContains string `json:"nameContains" validate:"max=1000"`

	// Only include policies which are enabled or disabled
	Enabled *bool `json:"enabled"`

	// Only include policies with or without auto-remediation enabled
	HasRemediation *bool `json:"hasRemediation"`

	// Only include policies which apply to one of these resource types
	ResourceTypes []string `json:"resourceTypes" validate:"max=500,dive,required,max=500"`

	// Only include policies with this severity
	Severity []models.Severity `json:"severity" validate:"dive,oneof=INFO LOW MEDIUM HIGH CRITICAL"`

	// Only include policies with all of these tags (case-insensitive)
	Tags []string `json:"tags" validate:"max=500,dive,required,max=500"`

	// ----- Projection -----
	// Policy fields to return in the response (default: all)
	Fields []string `json:"fields" validate:"max=20,dive,required,max=100"`

	// ----- Sorting -----
	SortBy  string `json:"sortBy" validate:"omitempty,oneof=complianceStatus enabled id lastModified resourceTypes severity"`
	SortDir string `json:"sortDir" validate:"omitempty,oneof=ascending descending"`

	// ----- Paging -----
	PageSize int `json:"pageSize" validate:"min=0,max=1000"`
	Page     int `json:"page" validate:"min=0"`

	// Only include policies whose creator matches this user ID (which need not be a uuid)
	CreatedBy string `json:"createdBy"`

	// Only include policies which were last modified by this user ID
	LastModifiedBy string `json:"lastModifiedBy"`

	// If True, include only policies which were created by the system during the initial deployment
	// If False, include only policies where were NOT created by the system during the initial deployment
	InitialSet *bool `json:"initialSet"`
}

type ListPoliciesOutput

type ListPoliciesOutput struct {
	Paging   Paging   `json:"paging"`
	Policies []Policy `json:"policies"`
}

type ListRulesInput

type ListRulesInput struct {
	// ----- Filtering -----
	// Only include rules whose ID or display name contains this case-insensitive substring
	NameContains string `json:"nameContains" validate:"max=1000"`

	// Only include rules which are enabled or disabled
	Enabled *bool `json:"enabled"`

	// Only include rules which apply to one of these log types
	LogTypes []string `json:"logTypes" validate:"max=500,dive,required,max=500"`

	// Only include policies with this severity
	Severity []models.Severity `json:"severity" validate:"dive,oneof=INFO LOW MEDIUM HIGH CRITICAL"`

	// Only include policies with all of these tags (case-insensitive)
	Tags []string `json:"tags" validate:"max=500,dive,required,max=500"`

	// ----- Projection -----
	// Policy fields to return in the response (default: all)
	Fields []string `json:"fields" validate:"max=20,dive,required,max=100"`

	// ----- Sorting -----
	SortBy  string `json:"sortBy" validate:"omitempty,oneof=displayName enabled id lastModified logTypes severity"`
	SortDir string `json:"sortDir" validate:"omitempty,oneof=ascending descending"`

	// ----- Paging -----
	PageSize int `json:"pageSize" validate:"min=0,max=1000"`
	Page     int `json:"page" validate:"min=0"`

	// Only include rules whose creator matches this user ID (which need not be a uuid)
	CreatedBy string `json:"createdBy"`

	// Only include rules which were last modified by this user ID
	LastModifiedBy string `json:"lastModifiedBy"`

	// If True, include only rules which were created by the system during the initial deployment
	// If False, include only rules where were NOT created by the system during the initial deployment
	InitialSet *bool `json:"initialSet"`
}

type ListRulesOutput

type ListRulesOutput struct {
	Paging Paging `json:"paging"`
	Rules  []Rule `json:"rules"`
}

type Pack added in v1.16.0

type Pack struct {
	Enabled           bool                  `json:"enabled"`
	UpdateAvailable   bool                  `json:"updateAvailable"`
	CreatedBy         string                `json:"createdBy"`
	Description       string                `json:"description"`
	DisplayName       string                `json:"displayName"`
	PackVersion       Version               `json:"packVersion"`
	ID                string                `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	LastModifiedBy    string                `json:"lastModifiedBy"`
	CreatedAt         time.Time             `json:"createdAt"`
	LastModified      time.Time             `json:"lastModified"`
	AvailableVersions []Version             `json:"availableVersions"`
	PackDefinition    PackDefinition        `json:"packDefinition"`
	PackTypes         map[DetectionType]int `json:"packTypes"`
}

type PackDefinition added in v1.16.0

type PackDefinition struct {
	IDs []string `json:"IDs"`
}

type Paging

type Paging struct {
	ThisPage   int `json:"thisPage"`
	TotalPages int `json:"totalPages"`
	TotalItems int `json:"totalItems"`
}

type PatchPackInput added in v1.16.0

type PatchPackInput struct {
	// This is a partial update
	Enabled   bool   `json:"enabled"`
	VersionID int64  `json:"versionID"`
	ID        string `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	UserID    string `json:"userId" validate:"required"`
}

type Policy

type Policy struct {
	AnalysisType              DetectionType           `json:"analysisType"`
	AutoRemediationID         string                  `json:"autoRemediationId" validate:"max=1000"`
	AutoRemediationParameters map[string]string       `json:"autoRemediationParameters" validte:"max=500"`
	Body                      string                  `json:"body" validate:"required,max=100000"`
	ComplianceStatus          models.ComplianceStatus `json:"complianceStatus"`
	CreatedAt                 time.Time               `json:"createdAt"`
	CreatedBy                 string                  `json:"createdBy"`
	Description               string                  `json:"description" validate:"max=10000"`
	DisplayName               string                  `json:"displayName" validate:"max=1000,excludesall='<>&\""`
	Enabled                   bool                    `json:"enabled"`
	ID                        string                  `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	LastModified              time.Time               `json:"lastModified"`
	LastModifiedBy            string                  `json:"lastModifiedBy"`
	OutputIDs                 []string                `json:"outputIds" validate:"max=500,dive,required,max=5000"`
	Reference                 string                  `json:"reference" validate:"max=10000"`
	Reports                   map[string][]string     `json:"reports" validate:"max=500"`
	ResourceTypes             []string                `json:"resourceTypes" validate:"max=500,dive,required,max=500"`
	Runbook                   string                  `json:"runbook" validate:"max=10000"`
	Severity                  models.Severity         `json:"severity" validate:"oneof=INFO LOW MEDIUM HIGH CRITICAL"`
	Suppressions              []string                `json:"suppressions" validate:"max=500,dive,required,max=1000"`
	Tags                      []string                `json:"tags" validate:"max=500,dive,required,max=1000"`
	Tests                     []UnitTest              `json:"tests" validate:"max=500,dive"`
	VersionID                 string                  `json:"versionId"`
}

The validate tags here are used by BulkUpload

type PollPacksInput added in v1.16.0

type PollPacksInput struct {
	// allow to poll for a particular release
	VersionID int64 `json:"versionID"`
}

PollPacksInput will also update the pack metadata: "availableReleases" and "updateAvailable"

type Rule

type Rule struct {
	AnalysisType       DetectionType       `json:"analysisType"`
	Body               string              `json:"body"`
	CreatedAt          time.Time           `json:"createdAt"`
	CreatedBy          string              `json:"createdBy"`
	DedupPeriodMinutes int                 `json:"dedupPeriodMinutes"`
	Description        string              `json:"description"`
	DisplayName        string              `json:"displayName"`
	Enabled            bool                `json:"enabled"`
	ID                 string              `json:"id"`
	LastModified       time.Time           `json:"lastModified"`
	LastModifiedBy     string              `json:"lastModifiedBy"`
	LogTypes           []string            `json:"logTypes"`
	OutputIDs          []string            `json:"outputIds"`
	Reference          string              `json:"reference"`
	Reports            map[string][]string `json:"reports"`
	Runbook            string              `json:"runbook"`
	Severity           models.Severity     `json:"severity"`
	Tags               []string            `json:"tags"`
	Tests              []UnitTest          `json:"tests"`
	Threshold          int                 `json:"threshold"`
	VersionID          string              `json:"versionId"`
}

type SuppressInput

type SuppressInput struct {
	PolicyIDs []string `json:"policyIds" validate:"min=1,dive,required,max=1000"`

	// List of resource ID regexes that are excepted from the policy.
	// The policy will still be evaluated, but failures will not trigger alerts nor remediations
	ResourcePatterns []string `json:"resourcePatterns" validate:"min=1,dive,required,max=10000"`
}

type TestDetectionSubRecord

type TestDetectionSubRecord struct {
	Output *string    `json:"output"`
	Error  *TestError `json:"error"`
}

type TestError

type TestError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type TestPolicyInput

type TestPolicyInput struct {
	Body          string     `json:"body" validate:"required,max=100000"`
	ResourceTypes []string   `json:"resourceTypes" validate:"max=500,dive,required,max=500"`
	Tests         []UnitTest `json:"tests" validate:"max=500,dive"`
}

type TestPolicyOutput

type TestPolicyOutput struct {
	Results []TestPolicyRecord `json:"results"`
}

type TestPolicyRecord

type TestPolicyRecord struct {
	ID        string                    `json:"id"`
	Name      string                    `json:"name"`
	Passed    bool                      `json:"passed"`
	Functions TestPolicyRecordFunctions `json:"functions"`
	Error     *TestError                `json:"error"`
}

type TestPolicyRecordFunctions

type TestPolicyRecordFunctions struct {
	Policy TestDetectionSubRecord `json:"policyFunction"`
}

type TestRuleInput

type TestRuleInput struct {
	Body     string     `json:"body" validate:"required,max=100000"`
	LogTypes []string   `json:"logTypes" validate:"max=500,dive,required,max=500"`
	Tests    []UnitTest `json:"tests" validate:"max=500,dive"`
}

type TestRuleOutput

type TestRuleOutput struct {
	Results []TestRuleRecord `json:"results"`
}

type TestRuleRecord

type TestRuleRecord struct {
	ID        string                  `json:"id"`
	Name      string                  `json:"name"`
	Passed    bool                    `json:"passed"`
	Functions TestRuleRecordFunctions `json:"functions"`

	// An error produced before running any of the rule functions, like import or syntax error.
	Error *TestError `json:"error"`
}

type TestRuleRecordFunctions

type TestRuleRecordFunctions struct {
	Rule         *TestDetectionSubRecord `json:"ruleFunction"`
	Title        *TestDetectionSubRecord `json:"titleFunction"`
	Dedup        *TestDetectionSubRecord `json:"dedupFunction"`
	AlertContext *TestDetectionSubRecord `json:"alertContextFunction"`
	Description  *TestDetectionSubRecord `json:"descriptionFunction"`
	Destinations *TestDetectionSubRecord `json:"destinationsFunction"`
	Reference    *TestDetectionSubRecord `json:"referenceFunction"`
	Runbook      *TestDetectionSubRecord `json:"runbookFunction"`
	Severity     *TestDetectionSubRecord `json:"severityFunction"`
}

type UnitTest

type UnitTest struct {
	ExpectedResult bool   `json:"expectedResult"`
	Mocks          string `json:"mocks"`
	Name           string `json:"name" validate:"required"`
	Resource       string `json:"resource" validate:"required"`
}

type UpdateDataModelInput

type UpdateDataModelInput struct {
	Body        string             `json:"body" validate:"omitempty,max=100000"` // not required
	Description string             `json:"description" validate:"max=10000"`
	DisplayName string             `json:"displayName" validate:"max=1000,excludesall='<>&\""`
	Enabled     bool               `json:"enabled"`
	ID          string             `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	LogTypes    []string           `json:"logTypes" validate:"len=1,dive,required,max=500"` // for now, only one logtype allowed
	Mappings    []DataModelMapping `json:"mappings" validate:"min=1,max=500,dive"`
	UserID      string             `json:"userId" validate:"required"`
}

type UpdateGlobalInput

type UpdateGlobalInput struct {
	Body        string   `json:"body" validate:"required,max=100000"`
	Description string   `json:"description" validate:"max=10000"`
	ID          string   `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	Tags        []string `json:"tags" validate:"max=500,dive,required,max=1000"`
	UserID      string   `json:"userId" validate:"required"`
}

type UpdatePolicyInput

type UpdatePolicyInput struct {
	AnalysisType              DetectionType       `json:"analysisType"`
	AutoRemediationID         string              `json:"autoRemediationId" validate:"max=1000"`
	AutoRemediationParameters map[string]string   `json:"autoRemediationParameters" validate:"max=500"`
	Body                      string              `json:"body" validate:"required,max=100000"`
	Description               string              `json:"description" validate:"max=10000"`
	DisplayName               string              `json:"displayName" validate:"max=1000,excludesall='<>&\""`
	Enabled                   bool                `json:"enabled"`
	ID                        string              `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	OutputIDs                 []string            `json:"outputIds" validate:"max=500,dive,required,max=5000"`
	Reference                 string              `json:"reference" validate:"max=10000"`
	Reports                   map[string][]string `json:"reports" validate:"max=500"`
	ResourceTypes             []string            `json:"resourceTypes" validate:"max=500,dive,required,max=500"`
	Runbook                   string              `json:"runbook" validate:"max=10000"`
	Severity                  models.Severity     `json:"severity" validate:"oneof=INFO LOW MEDIUM HIGH CRITICAL"`
	Suppressions              []string            `json:"suppressions" validate:"max=500,dive,required,max=1000"`
	Tags                      []string            `json:"tags" validate:"max=500,dive,required,max=1000"`
	Tests                     []UnitTest          `json:"tests" validate:"max=500,dive"`
	UserID                    string              `json:"userId" validate:"required"`
}

type UpdateRuleInput

type UpdateRuleInput struct {
	AnalysisType       DetectionType       `json:"analysisType"`
	Body               string              `json:"body" validate:"required,max=100000"`
	DedupPeriodMinutes int                 `json:"dedupPeriodMinutes" validate:"min=0"`
	Description        string              `json:"description" validate:"max=10000"`
	DisplayName        string              `json:"displayName" validate:"max=1000,excludesall='<>&\""`
	Enabled            bool                `json:"enabled"`
	ID                 string              `json:"id" validate:"required,max=1000,excludesall='<>&\""`
	LogTypes           []string            `json:"logTypes" validate:"max=500,dive,required,max=500"`
	OutputIDs          []string            `json:"outputIds" validate:"max=500,dive,required,max=5000"`
	Reference          string              `json:"reference" validate:"max=10000"`
	Reports            map[string][]string `json:"reports" validate:"max=500"`
	Runbook            string              `json:"runbook" validate:"max=10000"`
	Severity           models.Severity     `json:"severity" validate:"oneof=INFO LOW MEDIUM HIGH CRITICAL"`
	Tags               []string            `json:"tags" validate:"max=500,dive,required,max=1000"`
	Tests              []UnitTest          `json:"tests" validate:"max=500,dive"`
	Threshold          int                 `json:"threshold" validate:"min=0"`
	UserID             string              `json:"userId" validate:"required"`
}

type Version added in v1.16.0

type Version struct {
	ID     int64  `json:"id"`
	SemVer string `json:"semVer"`
}

Jump to

Keyboard shortcuts

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