func toFullURI()

in internal/proxy/proxy.go [445:462]


func toFullURI(short string) (string, error) {
	m := unixRegex.FindSubmatch([]byte(short))
	if m == nil {
		return "", fmt.Errorf("invalid short name: %v", short)
	}
	project := string(m[1])
	// Adjust short name for legacy projects. Google Cloud projects cannot have
	// underscores in them. When there's an underscore in the short name, it's a
	// marker for a colon. So replace the underscore with the original colon.
	project = strings.ReplaceAll(project, "_", ":")
	region := string(m[2])
	cluster := string(m[3])
	name := string(m[4])
	return fmt.Sprintf(
		"projects/%s/locations/%s/clusters/%s/instances/%s",
		project, region, cluster, name,
	), nil
}