ruleset

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareOptions

type CompareOptions struct {
	// If enforceAll is enabled, all Enforced must be present
	EnforceAll *bool `yaml:"enforceAll,omitempty"`

	// If ignoreExtraArgs is enabled, extra args not in Enforced or Ignored are ignored
	IgnoreExtraArgs *bool `yaml:"ignoreExtraArgs,omitempty"`

	// If ignoreComputed is enabled, args that result in a computed value are ignored
	// Has no effect on destroyed values
	IgnoreComputed *bool `yaml:"ignoreComputed,omitempty"`

	// If requireAll is enabled, every key in enforced or Ignored must be present
	RequireAll *bool `yaml:"requireAll,omitempty"`

	// If autoFail is enabled, automatically fails before comparison if a matching resource is found
	AutoFail *bool `yaml:"autoFail,omitempty"`

	// If IgnoreNoOp is enabled, skips attributes that have not changed
	// No effect for created or destroyed resource changes
	IgnoreNoOp *bool `yaml:"ignoreNoOp,omitempty"`
}

type CreateDeleteResourceChange

type CreateDeleteResourceChange struct {
	CompareOptions     `yaml:",inline"`
	ResourceIdentifier `yaml:",inline"`
	ResourceRules      `yaml:",inline"`
}

func (CreateDeleteResourceChange) ID added in v0.0.13

type CreateDeleteResourceChanges

type CreateDeleteResourceChanges struct {
	// If strict is enabled, all created or deleted resources must match a rule
	Strict bool `yaml:"strict,omitempty"`

	// If requireName is enabled, all resources must specify the name of the
	// resource in addition to the resource type
	RequireName bool `yaml:"requireName",omitempty`

	// Default CompareOptions to use for all resources
	Default *CompareOptions `yaml:"default,omitempty"`

	// Resources is a list of resource changes to validate against
	Resources []CreateDeleteResourceChange `yaml:"resources"`
}

type EnforceChange added in v0.0.5

type EnforceChange struct {
	Value         interface{}              `yaml:"value,omitempty"`
	MatchAny      []interface{}            `yaml:"matchAny,omitempty"`
	EnforceChange map[string]EnforceChange `yaml:",inline"`
}

type Resource added in v0.0.13

type Resource interface {
	ID() *ResourceIdentifier
}

type ResourceIdentifier added in v0.0.5

type ResourceIdentifier struct {
	Name string `yaml:"name,omitempty"`
	Type string `yaml:"type,omitempty"`
}

func (*ResourceIdentifier) String added in v0.0.13

func (id *ResourceIdentifier) String() string

type ResourceRules added in v0.0.5

type ResourceRules struct {
	Enforced map[string]EnforceChange `yaml:"enforced,omitempty"`
	Ignored  []string                 `yaml:"ignored,omitempty"`
}

type Ruleset

type Ruleset struct {
	CreatedResources   *CreateDeleteResourceChanges `yaml:"createdResources,omitempty"`
	DestroyedResources *CreateDeleteResourceChanges `yaml:"destroyedResources,omitempty"`
	UpdatedResources   *UpdateResourceChanges       `yaml:"updatedResources,omitempty"`
}

func ParseRuleset added in v0.0.13

func ParseRuleset(path string) (Ruleset, error)

type UpdateResourceChange added in v0.0.5

type UpdateResourceChange struct {
	CompareOptions     `yaml:",inline"`
	ResourceIdentifier `yaml:",inline"`

	Before *ResourceRules `yaml:"before,omitempty"`
	After  *ResourceRules `yaml:"after,omitempty"`
}

func (UpdateResourceChange) ID added in v0.0.13

type UpdateResourceChanges added in v0.0.5

type UpdateResourceChanges struct {
	// If strict is enabled, all updated resources must match a rule
	Strict bool `yaml:"strict,omitempty"`

	// If requireName is enabled, all resources must specify the name of the
	// resource in addition to the resource type
	RequireName bool `yaml:"requireName",omitempty`

	// Default CompareOptions to use for all resources
	Default *CompareOptions `yaml:"default,omitempty"`

	// Resources is a list of resource changes to validate against
	Resources []UpdateResourceChange `yaml:"resources"`
}

Jump to

Keyboard shortcuts

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