label

package
v0.12.15 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package label is to handle label selector for resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateLabel

func CreateOrUpdateLabel(ctx context.Context, labelType, uid string, resourceKey string, labels map[string]string) error

CreateOrUpdateLabel adds a new label or updates an existing label for the given resource, and then persists the updated label information in the Key-Value store.

func DeleteLabelObject added in v0.9.10

func DeleteLabelObject(labelType, uid string) error

DeleteLabelObject deletes the entire label object for a given resource identified by its labelType and uid.

func GetLabels

func GetLabels(labelType, uid string) (label model.LabelInfo, err error)

GetLabels retrieves the labels for a resource identified by its uid.

func GetResourcesByLabelSelector

func GetResourcesByLabelSelector(labelType, labelSelector string) ([]any, error)

GetResourcesByLabelSelector retrieves resources based on a label selector.

func ListCSPResourceLabel added in v0.10.7

func ListCSPResourceLabel(ctx context.Context, labelType, uid string, connectionName string) (labels map[string]string)

ListCSPResourceLabel best-effort lists the labels of a resource in the CSP

func MatchesLabelSelector

func MatchesLabelSelector(labels map[string]string, labelSelector string) bool

MatchesLabelSelector checks if the labels match the given label selector.

func MergeCSPResourceLabel added in v0.10.7

func MergeCSPResourceLabel(ctx context.Context, labelType, uid string, resourceKey string) error

MergeCSPResourceLabel merges the labels of a resource in the CSP with the existing labels

func RemoveCSPResourceLabel added in v0.10.7

func RemoveCSPResourceLabel(ctx context.Context, labelType, uid string, key string, connectionName string)

RemoveCSPResourceLabel best-effort removes the labels of a resource in the CSP

func RemoveLabel

func RemoveLabel(ctx context.Context, labelType, uid, key string) error

RemoveLabel removes a label from a resource identified by its uid.

func UpdateCSPResourceLabel added in v0.10.7

func UpdateCSPResourceLabel(ctx context.Context, labelType, uid string, labels map[string]string, connectionName string, cspResourceId string)

UpdateCSPResourceLabel best-effort updates the labels of a resource in the CSP. It first tries a batch upsert via direct CSP API (AWS CreateTags, Azure ARM Tags, etc.). If batch is not supported for the CSP or fails, it falls back to CB-Spider's tag API (one call per tag).

Types

type CSPSyncConfig added in v0.11.3

type CSPSyncConfig struct {
	// GlobalSkipResourceTypes contains resource types that should be skipped for all CSPs
	GlobalSkipResourceTypes map[string]bool
	// CSPSpecificSkipConfig contains CSP-specific skip configurations
	CSPSpecificSkipConfig map[string]map[string]bool // map[cspType][resourceType]bool
	// CSPGlobalSkip contains CSPs that don't support tags for any resource types
	CSPGlobalSkip map[string]bool // map[cspType]bool - if true, skip all resource types for this CSP
}

cspSyncSkipConfig contains resource types and CSP combinations that should be skipped when synchronizing with CSP

Jump to

Keyboard shortcuts

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