From 4393afb7e23d59004a5a984d3255ccec99526343 Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Tue, 21 Nov 2017 10:43:39 -0800 Subject: [PATCH] Remove checkGCSProjectID() as it needs extra permission setting (#5210) fixes #5209 --- cmd/gateway-gcs.go | 48 ---------------------------------------------- 1 file changed, 48 deletions(-) diff --git a/cmd/gateway-gcs.go b/cmd/gateway-gcs.go index abcbae832..86a5dc97c 100644 --- a/cmd/gateway-gcs.go +++ b/cmd/gateway-gcs.go @@ -35,8 +35,6 @@ import ( minio "github.com/minio/minio-go" "github.com/minio/minio-go/pkg/policy" "github.com/minio/minio/pkg/hash" - "golang.org/x/oauth2/google" - cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" "google.golang.org/api/googleapi" "google.golang.org/api/iterator" "google.golang.org/api/option" @@ -297,47 +295,6 @@ func isValidGCSProjectIDFormat(projectID string) bool { return gcsProjectIDRegex.MatchString(projectID) } -// checkGCSProjectID - checks if the project ID does really exist using resource manager API. -func checkGCSProjectID(ctx context.Context, projectID string) error { - // Check if a project id associated to the current account does really exist - resourceManagerClient, err := google.DefaultClient(ctx, cloudresourcemanager.CloudPlatformReadOnlyScope) - if err != nil { - return err - } - - baseSvc, err := cloudresourcemanager.New(resourceManagerClient) - if err != nil { - return err - } - - projectSvc := cloudresourcemanager.NewProjectsService(baseSvc) - - curPageToken := "" - - // Iterate over projects list result pages and immediately return nil when - // the project ID is found. - for { - resp, err := projectSvc.List().PageToken(curPageToken).Context(ctx).Do() - if err != nil { - return fmt.Errorf("Error getting projects list: %s", err.Error()) - } - - for _, p := range resp.Projects { - if p.ProjectId == projectID { - return nil - } - } - - if resp.NextPageToken != "" { - curPageToken = resp.NextPageToken - } else { - break - } - } - - return errGCSProjectIDNotFound -} - // gcsGateway - Implements gateway for Minio and GCS compatible object storage servers. type gcsGateway struct { gatewayUnsupported @@ -376,11 +333,6 @@ func newGCSGatewayLayer(projectID string) (GatewayLayer, error) { } } - err = checkGCSProjectID(ctx, projectID) - if err != nil { - return nil, err - } - // Initialize a GCS client. // Send user-agent in this format for Google to obtain usage insights while participating in the // Google Cloud Technology Partners (https://cloud.google.com/partners/)