Documentation
¶
Index ¶
- Constants
- func GetIndexMapping(alias string, storageGroupResource schema.GroupResource) string
- func NewCollectionResourceStorage(client *elasticsearch.Client, indexName string, ...) storage.CollectionResourceStorage
- func NewStorageFactory(configPath string) (storage.StorageFactory, error)
- func RegisterStorageLayer()
- type Basic
- type BoolExpression
- type CollectionResourceStorage
- type Config
- type ESError
- type ExistExpression
- type Expression
- type FuzzyExpression
- type Hit
- type Hits
- type Index
- func (s *Index) ClearScroll(ctx context.Context, scrollId string) error
- func (s *Index) DeleteById(ctx context.Context, docId string, indexName string) error
- func (s *Index) DeleteByQuery(ctx context.Context, query map[string]interface{}, indexName ...string) error
- func (s *Index) ListIndex() ([]string, error)
- func (s *Index) ScrollSearch(ctx context.Context, scrollId string) (*SearchResponse, error)
- func (s *Index) Search(ctx context.Context, query map[string]interface{}, indexNames []string, ...) (*SearchResponse, error)
- func (s *Index) SearchAll(ctx context.Context, query map[string]interface{}, indexNames []string) ([]*SearchResponse, error)
- func (s *Index) Upsert(ctx context.Context, indexName string, uid string, doc map[string]interface{}) error
- type LogicType
- type MatchExpression
- type QueryBuilder
- type RangeExpression
- type Resource
- func (r Resource) GetGroup() string
- func (r Resource) GetKind() string
- func (r Resource) GetName() string
- func (r Resource) GetNamespace() string
- func (r Resource) GetObject() map[string]interface{}
- func (r Resource) GetResource() string
- func (r Resource) GetResourceType() ResourceType
- func (r Resource) GetResourceVersion() string
- func (r Resource) GetVersion() string
- func (r Resource) GroupVersionResource() schema.GroupVersionResource
- type ResourceStorage
- func (s *ResourceStorage) Create(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *ResourceStorage) Delete(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *ResourceStorage) Get(ctx context.Context, cluster, namespace, name string, into runtime.Object) error
- func (s *ResourceStorage) GetOwnerIds(ctx context.Context, opts *internal.ListOptions) ([]string, error)
- func (s *ResourceStorage) GetStorageConfig() *storage.ResourceStorageConfig
- func (s *ResourceStorage) List(ctx context.Context, listObject runtime.Object, opts *internal.ListOptions) error
- func (s *ResourceStorage) Update(ctx context.Context, cluster string, obj runtime.Object) error
- func (s *ResourceStorage) Watch(_ context.Context, _ *internal.ListOptions) (watch.Interface, error)
- type ResourceType
- type SearchResponse
- type SimpleQueryStringExpression
- type StorageFactory
- func (s *StorageFactory) CleanCluster(ctx context.Context, cluster string) error
- func (s *StorageFactory) CleanClusterResource(ctx context.Context, cluster string, gvr schema.GroupVersionResource) error
- func (s *StorageFactory) GetCollectionResources(ctx context.Context) ([]*internal.CollectionResource, error)
- func (s *StorageFactory) GetResourceVersions(ctx context.Context, cluster string) (map[schema.GroupVersionResource]map[string]interface{}, error)
- func (s *StorageFactory) GetSupportedRequestVerbs() []string
- func (s *StorageFactory) NewCollectionResourceStorage(cr *internal.CollectionResource) (storage.CollectionResourceStorage, error)
- func (s *StorageFactory) NewResourceStorage(config *storage.ResourceStorageConfig) (storage.ResourceStorage, error)
- func (s *StorageFactory) PrepareCluster(cluster string) error
- type TermsExpression
- type Total
Constants ¶
View Source
const ( Must = iota MustNot Should )
View Source
const ( CollectionResourceWorkloads = "workloads" CollectionResourceKubeResources = "kuberesources" )
View Source
const ( ObjectPath = "object" SpecPath = "spec" ClusterPath = "object.metadata.annotations.shadow.clusterpedia.io/cluster-name" NameSpacePath = "object.metadata.namespace" NamePath = "object.metadata.name" OwnerReferencePath = "object.metadata.ownerReferences.uid" CreationTimestampPath = "object.metadata.creationTimestamp" LabelPath = "object.metadata.labels" GroupPath = "group" VersionPath = "version" ResourcePath = "resource" UIDPath = "object.metadata.uid" KeywordPath = "keyword" ApiVersionPath = "object.apiVersion" KindPath = "object.kind" ObjectMetaPath = "object.metadata" FullTextObjectPath = "custom.fullTextObject" )
View Source
const ( ResourceConfigmap = "configmaps" ResourceSecret = "secrets" ResourceEvent = "events" )
View Source
const ( // AllowObjectFullTextSearch is a feature gate for the clustersynchro-manager Indexing k8s objects as string. // // owner: @hanweisen // alpha: v0.1.0 AllowObjectFullTextSearch featuregate.Feature = "AllowObjectFullTextSearch" )
View Source
const (
StorageName = "elasticsearch"
)
Variables ¶
This section is empty.
Functions ¶
func GetIndexMapping ¶
func GetIndexMapping(alias string, storageGroupResource schema.GroupResource) string
func NewCollectionResourceStorage ¶
func NewCollectionResourceStorage(client *elasticsearch.Client, indexName string, cr *internal.CollectionResource) storage.CollectionResourceStorage
func NewStorageFactory ¶
func NewStorageFactory(configPath string) (storage.StorageFactory, error)
func RegisterStorageLayer ¶
func RegisterStorageLayer()
Types ¶
type Basic ¶
type Basic struct {
// contains filtered or unexported fields
}
func (*Basic) SetLogicType ¶
type BoolExpression ¶
type BoolExpression struct { Basic // contains filtered or unexported fields }
func NewBoolExpression ¶
func NewBoolExpression() *BoolExpression
func (*BoolExpression) ToMap ¶
func (b *BoolExpression) ToMap() map[string]interface{}
type CollectionResourceStorage ¶
type CollectionResourceStorage struct {
// contains filtered or unexported fields
}
func (*CollectionResourceStorage) Get ¶
func (s *CollectionResourceStorage) Get(ctx context.Context, opts *internal.ListOptions) (*internal.CollectionResource, error)
type ExistExpression ¶
type ExistExpression struct { Basic // contains filtered or unexported fields }
func (*ExistExpression) ToMap ¶
func (t *ExistExpression) ToMap() map[string]interface{}
type Expression ¶
type FuzzyExpression ¶
type FuzzyExpression struct { Basic // contains filtered or unexported fields }
func NewFuzzy ¶
func NewFuzzy(path string, value []string) *FuzzyExpression
func (*FuzzyExpression) ToMap ¶
func (t *FuzzyExpression) ToMap() map[string]interface{}
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) DeleteById ¶
func (*Index) DeleteByQuery ¶
func (*Index) ScrollSearch ¶
func (*Index) Search ¶
func (s *Index) Search(ctx context.Context, query map[string]interface{}, indexNames []string, searchOpts ...func(request *esapi.SearchRequest)) (*SearchResponse, error)
type MatchExpression ¶
type MatchExpression struct { Basic // contains filtered or unexported fields }
func NewMatch ¶
func NewMatch(path string, value string) *MatchExpression
func (*MatchExpression) ToMap ¶
func (t *MatchExpression) ToMap() map[string]interface{}
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQueryBuilder ¶
func NewQueryBuilder() *QueryBuilder
type RangeExpression ¶
type RangeExpression struct { Basic // contains filtered or unexported fields }
func (*RangeExpression) ToMap ¶
func (t *RangeExpression) ToMap() map[string]interface{}
type Resource ¶
type Resource struct { Group string `json:"group"` Version string `json:"version"` Kind string `json:"kind"` Resource string `json:"resource"` ResourceVersion string `json:"resource_version"` Name string `json:"name"` Namespace string `json:"namespace"` Object map[string]interface{} `json:"object"` }
func (Resource) GetNamespace ¶
func (Resource) GetResource ¶
func (Resource) GetResourceType ¶
func (r Resource) GetResourceType() ResourceType
func (Resource) GetResourceVersion ¶
func (Resource) GetVersion ¶
func (Resource) GroupVersionResource ¶
func (r Resource) GroupVersionResource() schema.GroupVersionResource
type ResourceStorage ¶
type ResourceStorage struct {
// contains filtered or unexported fields
}
func (*ResourceStorage) GetOwnerIds ¶
func (s *ResourceStorage) GetOwnerIds(ctx context.Context, opts *internal.ListOptions) ([]string, error)
func (*ResourceStorage) GetStorageConfig ¶
func (s *ResourceStorage) GetStorageConfig() *storage.ResourceStorageConfig
func (*ResourceStorage) List ¶
func (s *ResourceStorage) List(ctx context.Context, listObject runtime.Object, opts *internal.ListOptions) error
func (*ResourceStorage) Watch ¶
func (s *ResourceStorage) Watch(_ context.Context, _ *internal.ListOptions) (watch.Interface, error)
type ResourceType ¶
func (ResourceType) Empty ¶
func (rt ResourceType) Empty() bool
func (ResourceType) GroupVersionResource ¶
func (rt ResourceType) GroupVersionResource() schema.GroupVersionResource
type SearchResponse ¶
type SearchResponse struct { ScrollId string `json:"_scroll_id""` Took int `json:"took"` TimeOut bool `json:"time_out"` Hits *Hits `json:"hits"` }
func (*SearchResponse) GetResources ¶
func (r *SearchResponse) GetResources() []*Resource
func (*SearchResponse) GetTotal ¶
func (r *SearchResponse) GetTotal() int64
TODO total is not exact value. referring: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-your-data.html
type SimpleQueryStringExpression ¶
func (*SimpleQueryStringExpression) ToMap ¶
func (q *SimpleQueryStringExpression) ToMap() map[string]interface{}
type StorageFactory ¶
type StorageFactory struct {
// contains filtered or unexported fields
}
func (*StorageFactory) CleanCluster ¶
func (s *StorageFactory) CleanCluster(ctx context.Context, cluster string) error
func (*StorageFactory) CleanClusterResource ¶
func (s *StorageFactory) CleanClusterResource(ctx context.Context, cluster string, gvr schema.GroupVersionResource) error
func (*StorageFactory) GetCollectionResources ¶
func (s *StorageFactory) GetCollectionResources(ctx context.Context) ([]*internal.CollectionResource, error)
func (*StorageFactory) GetResourceVersions ¶
func (s *StorageFactory) GetResourceVersions(ctx context.Context, cluster string) (map[schema.GroupVersionResource]map[string]interface{}, error)
func (*StorageFactory) GetSupportedRequestVerbs ¶
func (s *StorageFactory) GetSupportedRequestVerbs() []string
func (*StorageFactory) NewCollectionResourceStorage ¶
func (s *StorageFactory) NewCollectionResourceStorage(cr *internal.CollectionResource) (storage.CollectionResourceStorage, error)
func (*StorageFactory) NewResourceStorage ¶
func (s *StorageFactory) NewResourceStorage(config *storage.ResourceStorageConfig) (storage.ResourceStorage, error)
func (*StorageFactory) PrepareCluster ¶
func (s *StorageFactory) PrepareCluster(cluster string) error
type TermsExpression ¶
type TermsExpression struct { Basic // contains filtered or unexported fields }
func NewTerms ¶
func NewTerms(path string, value []string) *TermsExpression
func (*TermsExpression) ToMap ¶
func (t *TermsExpression) ToMap() map[string]interface{}
Click to show internal directories.
Click to hide internal directories.