Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchDescribeInstanceStatuses ¶ added in v0.12.9
func BatchDescribeInstanceStatuses(ctx context.Context, region string, instanceIds []string) (map[string]string, error)
BatchDescribeInstanceStatuses queries GCP Compute Engine AggregatedList for all instances in the project and returns a map of instanceName → TB status string, filtered to instances whose zone starts with the given region prefix and whose name appears in instanceIds.
GCP instances are zone-scoped, so AggregatedList (one call for the whole project) is used instead of per-zone calls to avoid needing zone information per node.
func BatchUpsertTags ¶
func BatchUpsertTags(ctx context.Context, region, zone, cspResourceId, resourceType string, tags map[string]string) error
BatchUpsertTags sets labels on a GCP Compute resource (VM instance or disk). Labels are sanitized to meet GCP naming rules (lowercase, no special chars). Only "vm" and "dataDisk" resource types are supported; others return an error so the caller can fall back to CB-Spider.
Types ¶
type GCPPriceCache ¶
type GCPPriceCache struct {
// contains filtered or unexported fields
}
GCPPriceCache holds all parsed GCP pricing data, keyed by region. Key: region code (e.g., "us-central1") Value: map of machine type name -> nodePriceEntry
func FetchAllGCPPrices ¶
func FetchAllGCPPrices() (*GCPPriceCache, error)
FetchAllGCPPrices fetches all 5 GCP pricing sub-pages and returns a GCPPriceCache containing region -> machine_type -> price mappings.
func (*GCPPriceCache) GetPriceForRegion ¶
func (c *GCPPriceCache) GetPriceForRegion(region string) model.SpiderCloudPrice
GetPriceForRegion returns a SpiderCloudPrice containing all machine type prices for a specific region. This is compatible with the existing cb-tumblebug price processing.
func (*GCPPriceCache) Regions ¶
func (c *GCPPriceCache) Regions() []string
Regions returns a sorted list of all region codes in the cache.