...

Source file src/edge-infra.dev/pkg/lib/gcp/resource/ref.go

Documentation: edge-infra.dev/pkg/lib/gcp/resource

     1  // Pacakage resource provides basic utilities for working with Google Cloud Platform
     2  // resource strings.
     3  package resource
     4  
     5  import "path"
     6  
     7  const (
     8  	Global = "global"
     9  )
    10  
    11  // Ref produces a reference to a GCP resource that can be used when interacting with
    12  // the GCP API, either directly or with K8s Config Connector
    13  func Ref(projectID string, location string, resourceType string, resourceName string) string {
    14  	e := []string{"projects", projectID}
    15  	if location == Global {
    16  		e = append(e, Global)
    17  	} else {
    18  		e = append(e, "locations", location)
    19  	}
    20  	e = append(e, resourceType, resourceName)
    21  	return path.Join(e...)
    22  }
    23  

View as plain text