Documentation ¶
Index ¶
- Variables
- func ConvertResourceGroup2Map(rg *entity.ResourceGroup) (map[string]any, error)
- func Parse(queryString string) ([]storage.Query, error)
- func ParseQueries(queries []storage.Query) (map[string]interface{}, error)
- type Config
- type Pagination
- type ResourceGroupRuleStorageGetter
- type ResourceStorageGetter
- type SearchStorageGetter
- type Storage
- func (s *Storage) AggregateByTerms(ctx context.Context, keys []string) (*storage.AggregateResults, error)
- func (s *Storage) CountResourceGroupRules(ctx context.Context) (int, error)
- func (s *Storage) CountResources(ctx context.Context) (int, error)
- func (s *Storage) DeleteAllResources(ctx context.Context, cluster string) error
- func (s *Storage) DeleteResource(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *Storage) DeleteResourceGroupRule(ctx context.Context, name string) error
- func (s *Storage) GetResource(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *Storage) GetResourceGroupRule(ctx context.Context, name string) (*entity.ResourceGroupRule, error)
- func (s *Storage) ListResourceGroupRules(ctx context.Context) ([]*entity.ResourceGroupRule, error)
- func (s *Storage) ListResourceGroupsBy(ctx context.Context, ruleName string) (*storage.ResourceGroupResult, error)
- func (s *Storage) SaveResource(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *Storage) SaveResourceGroupRule(ctx context.Context, data *entity.ResourceGroupRule) error
- func (s *Storage) Search(ctx context.Context, queryStr string, patternType string, ...) (*storage.SearchResult, error)
- func (s *Storage) SearchByQuery(ctx context.Context, query map[string]interface{}, ...) (*storage.SearchResult, error)
- func (s *Storage) SearchByTerms(ctx context.Context, keysAndValues map[string]any, ...) (*storage.SearchResult, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrResourceGroupRuleNotFound = fmt.Errorf("resource group rule not found") ErrResourceGroupNotFound = fmt.Errorf("resource group not found") )
var ErrNotFound = fmt.Errorf("object not found")
Functions ¶
func ConvertResourceGroup2Map ¶
func ConvertResourceGroup2Map(rg *entity.ResourceGroup) (map[string]any, error)
ConvertResourceGroup2Map converts a ResourceGroup to a map[string]any.
Types ¶
type Config ¶
type Config struct { Addresses []string `env:"ES_ADDRESSES"` UserName string `env:"ES_USER"` Password string `env:"ES_PASSWORD"` }
Config defines the configuration structure for Elasticsearch storage.
type Pagination ¶
Pagination defines the struct for pagination which contains page number and page size.
type ResourceGroupRuleStorageGetter ¶
type ResourceGroupRuleStorageGetter struct {
// contains filtered or unexported fields
}
ResourceGroupRuleStorageGetter represents a structure for getting resource group rule storage instances.
func NewResourceGroupRuleStorageGetter ¶
func NewResourceGroupRuleStorageGetter(addresses []string, userName, password string) *ResourceGroupRuleStorageGetter
NewResourceGroupRuleStorageGetter creates a new instance of the ResourceGroupRuleStorageGetter with the given Elasticsearch addresses, user name, and password.
func (*ResourceGroupRuleStorageGetter) GetResourceGroupRuleStorage ¶
func (s *ResourceGroupRuleStorageGetter) GetResourceGroupRuleStorage() (storage.ResourceGroupRuleStorage, error)
GetResourceGroupRuleStorage retrieves and returns a resource group rule storage instance based on the provided configuration.
type ResourceStorageGetter ¶
type ResourceStorageGetter struct {
// contains filtered or unexported fields
}
ResourceStorageGetter represents a structure for getting resource storage instances.
func NewResourceStorageGetter ¶
func NewResourceStorageGetter(addresses []string, userName, password string) *ResourceStorageGetter
NewResourceStorageGetter creates a new instance of the ResourceStorageGetter with the given Elasticsearch addresses, user name, and password.
func (*ResourceStorageGetter) GetResourceStorage ¶
func (s *ResourceStorageGetter) GetResourceStorage() (storage.ResourceStorage, error)
GetResourceStorage retrieves and returns a resource storage instance based on the provided configuration.
type SearchStorageGetter ¶
type SearchStorageGetter struct {
// contains filtered or unexported fields
}
SearchStorageGetter represents a structure for getting search storage instances.
func NewSearchStorageGetter ¶
func NewSearchStorageGetter(addresses []string, userName, password string) *SearchStorageGetter
NewSearchStorageGetter creates a new instance of the SearchStorageGetter with the given Elasticsearch addresses, user name, and password.
func (*SearchStorageGetter) GetSearchStorage ¶
func (s *SearchStorageGetter) GetSearchStorage() (storage.SearchStorage, error)
GetSearchStorage retrieves and returns a search storage instance based on the provided configuration.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the struct that holds the necessary fields for interacting with the Elasticsearch cluster.
func NewStorage ¶
NewStorage creates and returns a new instance of the Storage struct with the provided Elasticsearch configuration.
func (*Storage) AggregateByTerms ¶
func (s *Storage) AggregateByTerms(ctx context.Context, keys []string) (*storage.AggregateResults, error)
AggregateByTerms performs an aggregation operation using the provided list of keys and returns the results.
func (*Storage) CountResourceGroupRules ¶
CountResourceGroupRules return a count of resource group rules in the Elasticsearch storage.
func (*Storage) CountResources ¶
CountResources return a count of resources in the Elasticsearch storage.
func (*Storage) DeleteAllResources ¶
DeleteAllResources removes all resources from the Elasticsearch storage for the specified cluster.
func (*Storage) DeleteResource ¶
DeleteResource removes an object from the Elasticsearch storage for the specified cluster.
func (*Storage) DeleteResourceGroupRule ¶
DeleteResourceGroupRule deletes a resource group rule based on the given name.
func (*Storage) GetResource ¶
GetResource retrieves an object from the Elasticsearch storage for the specified cluster.
func (*Storage) GetResourceGroupRule ¶
func (s *Storage) GetResourceGroupRule(ctx context.Context, name string) (*entity.ResourceGroupRule, error)
GetResourceGroupRule retrieves a resource group rule based on the given name.
func (*Storage) ListResourceGroupRules ¶
ListResourceGroupRules lists all resource group rules by searching the entire index.
func (*Storage) ListResourceGroupsBy ¶
func (s *Storage) ListResourceGroupsBy(ctx context.Context, ruleName string) (*storage.ResourceGroupResult, error)
ListResourceGroupsBy lists all resource groups by specified resource group rule name.
func (*Storage) SaveResource ¶
SaveResource stores an object in the Elasticsearch storage for the specified cluster.
func (*Storage) SaveResourceGroupRule ¶
SaveResourceGroupRule saves a resource group rule to the storage.
func (*Storage) Search ¶
func (s *Storage) Search(ctx context.Context, queryStr string, patternType string, pagination *storage.Pagination) (*storage.SearchResult, error)
Search performs a search operation with the given query string, pattern type, and pagination settings.
func (*Storage) SearchByQuery ¶
func (s *Storage) SearchByQuery(ctx context.Context, query map[string]interface{}, pagination *storage.Pagination) (*storage.SearchResult, error)
SearchByQuery performs a search operation using a query map and pagination settings.
func (*Storage) SearchByTerms ¶
func (s *Storage) SearchByTerms(ctx context.Context, keysAndValues map[string]any, pagination *storage.Pagination) (*storage.SearchResult, error)
SearchByTerms performs a search operation with a map of keys and values and pagination information.