types

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFSKey

func CreateFSKey(filesystem fs.FS) string

Types

type BaseAttribute

type BaseAttribute struct {
	// contains filtered or unexported fields
}

func (BaseAttribute) GetMetadata

func (b BaseAttribute) GetMetadata() Metadata

type BoolValue

type BoolValue struct {
	BaseAttribute
	// contains filtered or unexported fields
}

func Bool

func Bool(value bool, metadata Metadata) BoolValue

func BoolDefault

func BoolDefault(value bool, metadata Metadata) BoolValue

func BoolExplicit

func BoolExplicit(value bool, metadata Metadata) BoolValue

func BoolTest added in v0.51.0

func BoolTest(value bool) BoolValue

func BoolUnresolvable

func BoolUnresolvable(m Metadata) BoolValue

func (BoolValue) GetRawValue

func (b BoolValue) GetRawValue() any

func (BoolValue) IsFalse

func (b BoolValue) IsFalse() bool

func (BoolValue) IsTrue

func (b BoolValue) IsTrue() bool

func (BoolValue) MarshalJSON

func (b BoolValue) MarshalJSON() ([]byte, error)

func (BoolValue) ToRego

func (s BoolValue) ToRego() any

func (*BoolValue) UnmarshalJSON

func (b *BoolValue) UnmarshalJSON(data []byte) error

func (BoolValue) Value

func (b BoolValue) Value() bool

type BytesValue

type BytesValue struct {
	BaseAttribute
	// contains filtered or unexported fields
}

func Bytes

func Bytes(value []byte, m Metadata) BytesValue

func BytesDefault

func BytesDefault(value []byte, m Metadata) BytesValue

func BytesExplicit

func BytesExplicit(value []byte, m Metadata) BytesValue

func BytesUnresolvable

func BytesUnresolvable(m Metadata) BytesValue

func (BytesValue) GetMetadata

func (b BytesValue) GetMetadata() Metadata

func (BytesValue) GetRawValue

func (b BytesValue) GetRawValue() any

func (BytesValue) Len

func (b BytesValue) Len() int

func (BytesValue) MarshalJSON

func (b BytesValue) MarshalJSON() ([]byte, error)

func (BytesValue) ToRego

func (s BytesValue) ToRego() any

func (*BytesValue) UnmarshalJSON

func (b *BytesValue) UnmarshalJSON(data []byte) error

func (BytesValue) Value

func (b BytesValue) Value() []byte

type Command added in v0.53.0

type Command struct {
	ID string `yaml:"id"`
}

type ComplianceSpec

type ComplianceSpec struct {
	Spec Spec `yaml:"spec"`
}

ComplianceSpec represent the compliance specification

type Control

type Control struct {
	ID            string        `yaml:"id"`
	Name          string        `yaml:"name"`
	Description   string        `yaml:"description,omitempty"`
	Checks        []SpecCheck   `yaml:"checks,omitempty"`
	Commands      []Command     `yaml:"commands,omitempty"`
	Severity      Severity      `yaml:"severity"`
	DefaultStatus ControlStatus `yaml:"defaultStatus,omitempty"`
}

Control represent the cps controls data and mapping checks

type ControlStatus

type ControlStatus string

type IntValue

type IntValue struct {
	BaseAttribute
	// contains filtered or unexported fields
}

func Int

func Int(value int, m Metadata) IntValue

func IntDefault

func IntDefault(value int, m Metadata) IntValue

func IntExplicit

func IntExplicit(value int, m Metadata) IntValue

func IntFromInt32

func IntFromInt32(value int32, m Metadata) IntValue

func IntTest added in v0.51.0

func IntTest(value int) IntValue

func IntUnresolvable

func IntUnresolvable(m Metadata) IntValue

func (IntValue) EqualTo

func (b IntValue) EqualTo(i int) bool

func (IntValue) GetMetadata

func (b IntValue) GetMetadata() Metadata

func (IntValue) GetRawValue

func (b IntValue) GetRawValue() any

func (IntValue) GreaterThan

func (b IntValue) GreaterThan(i int) bool

func (IntValue) LessThan

func (b IntValue) LessThan(i int) bool

func (IntValue) MarshalJSON

func (b IntValue) MarshalJSON() ([]byte, error)

func (IntValue) NotEqualTo

func (b IntValue) NotEqualTo(i int) bool

func (IntValue) ToRego

func (s IntValue) ToRego() any

func (*IntValue) UnmarshalJSON

func (b *IntValue) UnmarshalJSON(data []byte) error

func (IntValue) Value

func (b IntValue) Value() int

type MapValue

type MapValue struct {
	BaseAttribute
	// contains filtered or unexported fields
}

func Map

func Map(value map[string]string, m Metadata) MapValue

func MapDefault

func MapDefault(value map[string]string, m Metadata) MapValue

func MapExplicit

func MapExplicit(value map[string]string, m Metadata) MapValue

func (MapValue) GetRawValue

func (b MapValue) GetRawValue() any

func (MapValue) HasKey

func (b MapValue) HasKey(key string) bool

func (MapValue) Len

func (b MapValue) Len() int

func (MapValue) MarshalJSON

func (b MapValue) MarshalJSON() ([]byte, error)

func (MapValue) ToRego

func (s MapValue) ToRego() any

func (*MapValue) UnmarshalJSON

func (b *MapValue) UnmarshalJSON(data []byte) error

func (MapValue) Value

func (b MapValue) Value() map[string]string

type Metadata

type Metadata struct {
	// contains filtered or unexported fields
}

func NewApiMetadata

func NewApiMetadata(provider string, parts ...string) Metadata

func NewExplicitMetadata

func NewExplicitMetadata(r Range, ref string) Metadata

func NewMetadata

func NewMetadata(r Range, ref string) Metadata

func NewRemoteMetadata

func NewRemoteMetadata(id string) Metadata

func NewTestMetadata

func NewTestMetadata() Metadata

func NewUnmanagedMetadata

func NewUnmanagedMetadata() Metadata

func NewUnresolvableMetadata

func NewUnresolvableMetadata(r Range, ref string) Metadata

func (Metadata) GetMetadata

func (m Metadata) GetMetadata() Metadata

func (Metadata) GetRawValue

func (m Metadata) GetRawValue() any

func (Metadata) Internal

func (m Metadata) Internal() any

func (Metadata) IsDefault

func (m Metadata) IsDefault() bool

func (Metadata) IsExplicit

func (m Metadata) IsExplicit() bool

func (Metadata) IsManaged

func (m Metadata) IsManaged() bool

func (Metadata) IsMultiLine

func (m Metadata) IsMultiLine() bool

func (Metadata) IsResolvable

func (m Metadata) IsResolvable() bool

func (Metadata) IsUnmanaged

func (m Metadata) IsUnmanaged() bool

func (Metadata) MarshalJSON

func (m Metadata) MarshalJSON() ([]byte, error)

func (Metadata) Parent

func (m Metadata) Parent() *Metadata

func (Metadata) Range

func (m Metadata) Range() Range

func (Metadata) Reference

func (m Metadata) Reference() string

func (Metadata) Root

func (m Metadata) Root() Metadata

func (*Metadata) SetParentPtr

func (m *Metadata) SetParentPtr(p *Metadata)

func (*Metadata) SetRange

func (m *Metadata) SetRange(r Range)

func (*Metadata) SetReference

func (m *Metadata) SetReference(ref string)

func (Metadata) String

func (m Metadata) String() string

func (*Metadata) ToRego

func (m *Metadata) ToRego() any

func (*Metadata) UnmarshalJSON

func (m *Metadata) UnmarshalJSON(data []byte) error

func (Metadata) WithInternal

func (m Metadata) WithInternal(internal any) Metadata

func (Metadata) WithParent

func (m Metadata) WithParent(p Metadata) Metadata

type Range

type Range struct {
	// contains filtered or unexported fields
}

func NewRange

func NewRange(filename string, startLine, endLine int, sourcePrefix string, srcFS fs.FS) Range

func NewRangeWithFSKey

func NewRangeWithFSKey(filename string, startLine, endLine int, sourcePrefix, fsKey string, fsys fs.FS) Range

func NewRangeWithLogicalSource

func NewRangeWithLogicalSource(filename string, startLine int, endLine int, sourcePrefix string,
	srcFS fs.FS) Range

func (Range) GetEndLine

func (r Range) GetEndLine() int

func (Range) GetFS

func (r Range) GetFS() fs.FS

func (Range) GetFSKey

func (r Range) GetFSKey() string

func (Range) GetFilename

func (r Range) GetFilename() string

func (Range) GetLocalFilename

func (r Range) GetLocalFilename() string

func (Range) GetSourcePrefix

func (r Range) GetSourcePrefix() string

func (Range) GetStartLine

func (r Range) GetStartLine() int

func (Range) IsMultiLine

func (r Range) IsMultiLine() bool

func (Range) LineCount

func (r Range) LineCount() int

func (Range) MarshalJSON

func (r Range) MarshalJSON() ([]byte, error)

func (Range) String

func (r Range) String() string

func (*Range) UnmarshalJSON

func (r *Range) UnmarshalJSON(data []byte) error

func (Range) Validate added in v0.55.0

func (r Range) Validate() error

type Severity

type Severity string

type Source

type Source string
const (
	SourceDockerfile Source = "dockerfile"
	SourceKubernetes Source = "kubernetes"
	SourceRbac       Source = "rbac"   // deprecated - please use "kubernetes" instead
	SourceDefsec     Source = "defsec" // deprecated - please use "cloud" instead
	SourceCloud      Source = "cloud"
	SourceYAML       Source = "yaml"
	SourceJSON       Source = "json"
	SourceTOML       Source = "toml"
)

type Spec

type Spec struct {
	ID               string    `yaml:"id"`
	Title            string    `yaml:"title"`
	Description      string    `yaml:"description"`
	Version          string    `yaml:"version"`
	Platform         string    `yaml:"platform"`
	Type             string    `yaml:"type"`
	RelatedResources []string  `yaml:"relatedResources,omitempty"`
	Controls         []Control `yaml:"controls"`
}

type SpecCheck

type SpecCheck struct {
	ID string `yaml:"id"`
}

SpecCheck represent the scanner who perform the control check

type StringEqualityOption

type StringEqualityOption int
const (
	IgnoreCase StringEqualityOption = iota
	IsPallindrome
	IgnoreWhitespace
)

type StringValue

type StringValue struct {
	BaseAttribute
	// contains filtered or unexported fields
}

func String

func String(str string, m Metadata) StringValue

func StringDefault

func StringDefault(value string, m Metadata) StringValue

func StringExplicit

func StringExplicit(value string, m Metadata) StringValue

func StringTest added in v0.51.0

func StringTest(value string) StringValue

func StringUnresolvable

func StringUnresolvable(m Metadata) StringValue

func (StringValue) Contains

func (s StringValue) Contains(value string, equalityOptions ...StringEqualityOption) bool

func (StringValue) EndsWith

func (s StringValue) EndsWith(suffix string, equalityOptions ...StringEqualityOption) bool

func (StringValue) EqualTo

func (s StringValue) EqualTo(value string, equalityOptions ...StringEqualityOption) bool

func (StringValue) GetMetadata

func (s StringValue) GetMetadata() Metadata

func (StringValue) GetRawValue

func (b StringValue) GetRawValue() any

func (StringValue) IsEmpty

func (s StringValue) IsEmpty() bool

func (StringValue) IsNotEmpty

func (s StringValue) IsNotEmpty() bool

func (StringValue) IsOneOf

func (s StringValue) IsOneOf(values ...string) bool

func (StringValue) MarshalJSON

func (b StringValue) MarshalJSON() ([]byte, error)

func (StringValue) NotEqualTo

func (s StringValue) NotEqualTo(value string, equalityOptions ...StringEqualityOption) bool

func (StringValue) StartsWith

func (s StringValue) StartsWith(prefix string, equalityOptions ...StringEqualityOption) bool

func (StringValue) ToRego

func (s StringValue) ToRego() any

func (*StringValue) UnmarshalJSON

func (b *StringValue) UnmarshalJSON(data []byte) error

func (StringValue) Value

func (s StringValue) Value() string

type StringValueList

type StringValueList []StringValue

func (StringValueList) AsStrings

func (l StringValueList) AsStrings() (output []string)

type TimeValue

type TimeValue struct {
	BaseAttribute
	// contains filtered or unexported fields
}

func Time

func Time(value time.Time, m Metadata) TimeValue

func TimeDefault

func TimeDefault(value time.Time, m Metadata) TimeValue

func TimeExplicit

func TimeExplicit(value time.Time, m Metadata) TimeValue

func TimeUnresolvable

func TimeUnresolvable(m Metadata) TimeValue

func (TimeValue) After

func (t TimeValue) After(i time.Time) bool

func (TimeValue) Before

func (t TimeValue) Before(i time.Time) bool

func (TimeValue) GetRawValue

func (t TimeValue) GetRawValue() any

func (TimeValue) IsNever

func (t TimeValue) IsNever() bool

func (TimeValue) MarshalJSON

func (b TimeValue) MarshalJSON() ([]byte, error)

func (TimeValue) ToRego

func (t TimeValue) ToRego() any

func (*TimeValue) UnmarshalJSON

func (b *TimeValue) UnmarshalJSON(data []byte) error

func (TimeValue) Value

func (t TimeValue) Value() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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