model

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.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 Filter

type Filter struct {
	Tags Tags
}

func EmptyFilter added in v0.0.3

func EmptyFilter() Filter

func NewFilter added in v0.0.3

func NewFilter(tags map[string]string) Filter

func (Filter) IsEmpty added in v0.0.3

func (f Filter) IsEmpty() bool

func (Filter) MarshalLogObject added in v0.0.3

func (f Filter) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (Filter) TagsExclude added in v0.0.3

func (f Filter) TagsExclude() Tags

TagsExclude returns the tags to exclude

func (Filter) TagsInclude added in v0.0.3

func (f Filter) TagsInclude() Tags

TagIncludes returns the tags to include

type Properties added in v0.0.3

type Properties []Property

func (Properties) Clean added in v0.0.3

func (p Properties) Clean() Properties

func (Properties) MarshalLogArray added in v0.0.3

func (p Properties) MarshalLogArray(enc zapcore.ArrayEncoder) error

type Property

type Property struct {
	ResourceId string `json:"-" gorm:"primaryKey"`
	Name       string `json:"name" gorm:"primaryKey"`
	Value      string `json:"value"`
}

func (Property) MarshalLogObject added in v0.0.3

func (p Property) MarshalLogObject(enc zapcore.ObjectEncoder) error

type Resource

type Resource struct {
	Id         string     `json:"id" gorm:"primaryKey"`
	Region     string     `json:"region"`
	Type       string     `json:"type"`
	Tags       Tags       `json:"tags"`
	Properties Properties `json:"properties"`
}

TODO store provider info in resource (needed when we can have more than one provider)

func (Resource) MarshalLogObject added in v0.0.3

func (r Resource) MarshalLogObject(enc zapcore.ObjectEncoder) error

type Resources added in v0.0.3

type Resources []*Resource

func (Resources) FindById added in v0.0.3

func (rs Resources) FindById(id string) *Resource

FindById finds a resource by ID, return nil if not found

type Stats added in v0.0.3

type Stats struct {
	ResourcesCount int `json:"resources_count"`
}

type Tag

type Tag struct {
	ResourceId string `json:"-" gorm:"primaryKey"`
	Key        string `json:"key" gorm:"primaryKey"`
	Value      string `json:"value"`
	//when used as a filter indicates to look for resources without this tag
	Exclude bool `json:"-"`
}

func (Tag) MarshalLogObject added in v0.0.3

func (t Tag) MarshalLogObject(enc zapcore.ObjectEncoder) error

type Tags added in v0.0.3

type Tags []Tag

func (Tags) Clean added in v0.0.3

func (t Tags) Clean() Tags

func (Tags) DistinctKeys added in v0.0.3

func (t Tags) DistinctKeys() int

DistinctKeys returns number of distinct keys - if one tag is specified with two values - it counts as 1 distinct

func (Tags) Empty added in v0.0.3

func (t Tags) Empty() bool

func (Tags) MarshalLogArray added in v0.0.3

func (t Tags) MarshalLogArray(enc zapcore.ArrayEncoder) error

Jump to

Keyboard shortcuts

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