func parseMIGLabels()

in logger/logger.go [74:96]


func parseMIGLabels(mig string) map[string]string {
	labels := make(map[string]string)
	if mig == "" {
		return labels
	}

	migRe := regexp.MustCompile(`^projects/[^/]+/(zones|regions)/([^/]+)/instanceGroupManagers/([^/]+)$`)
	matches := migRe.FindStringSubmatch(mig)
	if matches == nil {
		return labels
	}

	var locationLabel string
	switch matches[1] {
	case "zones":
		locationLabel = migZoneLabel
	case "regions":
		locationLabel = migRegionLabel
	}
	labels[migNameLabel] = matches[3]
	labels[locationLabel] = matches[2]
	return labels
}