storage

package
v0.3.24-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Equals         = "="
	DSLPatternType = "dsl"
	SQLPatternType = "sql"
)

Variables

This section is empty.

Functions

func Map2ResourceGroupRule

func Map2ResourceGroupRule(in map[string]interface{}) (*entity.ResourceGroupRule, error)

Map2ResourceGroupRule converts a map to a ResourceGroupRule object.

Types

type AggregateResults

type AggregateResults struct {
	Buckets []Bucket
	Total   int
}

AggregateResults is assumed to be a struct that holds aggregation results.

type Bucket

type Bucket struct {
	Keys  []string
	Count int
}

Bucket is assumed to be a struct that holds individual bucket data.

type Pagination

type Pagination struct {
	Page     int
	PageSize int
}

Pagination defines the parameters for pagination in search results.

type Query

type Query struct {
	Key      string
	Values   []string
	Operator string
}

Query represents the query parameters for searching resources.

type Resource

type Resource struct {
	entity.ResourceGroup `json:",inline" yaml:",inline"`
	Object               map[string]interface{} `json:"object"`
}

Resource represents a Kubernetes resource with additional metadata.

func Map2Resource

func Map2Resource(in map[string]interface{}) (*Resource, error)

Map2Resource converts a map to a Resource object.

func NewResource

func NewResource(cluster string, b []byte) (*Resource, error)

NewResource creates a new Resource instance based on the provided bytes and cluster. It decodes the YAML bytes into an unstructured object and constructs a Resource with the relevant fields.

type ResourceGroupResult

type ResourceGroupResult struct {
	Groups []*entity.ResourceGroup `json:"groups" yaml:"groups"`
	Fields []string                `json:"fields" yaml:"fields"`
}

type ResourceGroupRuleStorage

type ResourceGroupRuleStorage interface {
	GetResourceGroupRule(ctx context.Context, name string) (*entity.ResourceGroupRule, error)
	SaveResourceGroupRule(ctx context.Context, data *entity.ResourceGroupRule) error
	DeleteResourceGroupRule(ctx context.Context, name string) error
	ListResourceGroupRules(ctx context.Context) ([]*entity.ResourceGroupRule, error)
	CountResourceGroupRules(ctx context.Context) (int, error)
	ListResourceGroupsBy(ctx context.Context, ruleName string) (*ResourceGroupResult, error)
}

ResourceGroupRuleStorage interface defines the basic operations for resource group rule storage.

type ResourceGroupRuleStorageGetter

type ResourceGroupRuleStorageGetter interface {
	GetResourceGroupRuleStorage() (ResourceGroupRuleStorage, error)
}

type ResourceStorage

type ResourceStorage interface {
	GetResource(ctx context.Context, cluster string, obj runtime.Object) error
	SaveResource(ctx context.Context, cluster string, obj runtime.Object) error
	DeleteResource(ctx context.Context, cluster string, obj runtime.Object) error
	DeleteAllResources(ctx context.Context, cluster string) error
	CountResources(ctx context.Context) (int, error)
}

ResourceStorage interface defines the basic operations for resource storage.

type ResourceStorageGetter

type ResourceStorageGetter interface {
	GetResourceStorage() (ResourceStorage, error)
}

type SearchResult

type SearchResult struct {
	Total     int
	Resources []*Resource
}

SearchResult contains the search results and total count.

func (*SearchResult) Overview

func (r *SearchResult) Overview() string

Overview returns a brief summary of the search result.

func (*SearchResult) ToYAML

func (r *SearchResult) ToYAML() (string, error)

ToYAML returns the search result in YAML format.

type SearchStorage

type SearchStorage interface {
	Search(ctx context.Context, queryString, patternType string, pagination *Pagination) (*SearchResult, error)
	SearchByTerms(ctx context.Context, keysAndValues map[string]any, pagination *Pagination) (*SearchResult, error)
	AggregateByTerms(ctx context.Context, keys []string) (*AggregateResults, error)
}

SearchStorage interface defines the basic operations for search storage.

type SearchStorageGetter

type SearchStorageGetter interface {
	GetSearchStorage() (SearchStorage, error)
}

type Storage

Storage interface defines the basic operations for storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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