mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	add 'projects/' suffix if this library is used with an older version of the google api library
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
This commit is contained in:
		@@ -435,10 +435,16 @@ func CreateGCECloud(config *CloudConfig) (*Cloud, error) {
 | 
			
		||||
	serviceAlpha.UserAgent = userAgent
 | 
			
		||||
 | 
			
		||||
	if config.APIEndpoint != "" {
 | 
			
		||||
		if strings.HasSuffix(service.BasePath, "/projects/") {
 | 
			
		||||
			service.BasePath = getProjectsBasePath(config.APIEndpoint)
 | 
			
		||||
			serviceBeta.BasePath = getProjectsBasePath(strings.Replace(config.APIEndpoint, "v1", "beta", -1))
 | 
			
		||||
			serviceAlpha.BasePath = getProjectsBasePath(strings.Replace(config.APIEndpoint, "v1", "alpha", -1))
 | 
			
		||||
		} else {
 | 
			
		||||
			service.BasePath = config.APIEndpoint
 | 
			
		||||
			serviceBeta.BasePath = strings.Replace(config.APIEndpoint, "v1", "beta", -1)
 | 
			
		||||
			serviceAlpha.BasePath = strings.Replace(config.APIEndpoint, "v1", "alpha", -1)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	containerService, err := container.NewService(context.Background(), option.WithTokenSource(config.TokenSource))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user