From 7b320119ba532fd409ec7dade7ad02011c309599 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Wed, 18 Oct 2017 13:15:14 +0100 Subject: Update dependencies --- vendor/cloud.google.com/go/storage/iam.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'vendor/cloud.google.com/go/storage/iam.go') diff --git a/vendor/cloud.google.com/go/storage/iam.go b/vendor/cloud.google.com/go/storage/iam.go index 0cd9501..6607d8c 100644 --- a/vendor/cloud.google.com/go/storage/iam.go +++ b/vendor/cloud.google.com/go/storage/iam.go @@ -15,8 +15,6 @@ package storage import ( - "errors" - "cloud.google.com/go/iam" "golang.org/x/net/context" raw "google.golang.org/api/storage/v1" @@ -58,8 +56,19 @@ func (c *iamClient) Set(ctx context.Context, resource string, p *iampb.Policy) e }) } -func (c *iamClient) Test(context.Context, string, []string) ([]string, error) { - return nil, errors.New("TestPermissions is unimplemented") +func (c *iamClient) Test(ctx context.Context, resource string, perms []string) ([]string, error) { + req := c.raw.Buckets.TestIamPermissions(resource, perms) + setClientHeader(req.Header()) + var res *raw.TestIamPermissionsResponse + var err error + err = runWithRetry(ctx, func() error { + res, err = req.Context(ctx).Do() + return err + }) + if err != nil { + return nil, err + } + return res.Permissions, nil } func iamToStoragePolicy(ip *iampb.Policy) *raw.Policy { -- cgit v1.2.3