Skip to content

Commit

Permalink
Make gce endpoint strings configurable.
Browse files Browse the repository at this point in the history
This will allow packages who import this to configure the endpoints to something like https://mydomain.com/compute/v1.
These endpoints are only used for SelfLink().
  • Loading branch information
spencerhance committed Mar 3, 2023
1 parent 90c4af4 commit b8edbc9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/cloud/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
)

const (
gaPrefix = "https://www.googleapis.com/compute/v1"
alphaPrefix = "https://www.googleapis.com/compute/alpha"
betaPrefix = "https://www.googleapis.com/compute/beta"
var (
GAPrefix = "https://www.googleapis.com/compute/v1"
AlphaPrefix = "https://www.googleapis.com/compute/alpha"
BetaPrefix = "https://www.googleapis.com/compute/beta"
)

// ResourceID identifies a GCE resource as parsed from compute resource URL.
Expand Down Expand Up @@ -191,11 +191,11 @@ func SelfLink(ver meta.Version, project, resource string, key *meta.Key) string
var prefix string
switch ver {
case meta.VersionAlpha:
prefix = alphaPrefix
prefix = AlphaPrefix
case meta.VersionBeta:
prefix = betaPrefix
prefix = BetaPrefix
case meta.VersionGA:
prefix = gaPrefix
prefix = GAPrefix
default:
prefix = "invalid-prefix"
}
Expand Down

0 comments on commit b8edbc9

Please sign in to comment.