New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Cloud Function example #36
Conversation
} | ||
count++ | ||
// delay 10s, 20s, then 30s and stay at 30s | ||
if sleep > 30 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just replace with "github.com/jpillora/backoff" as we do in the provider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this 1:1 from the examples repo. We could improve both I guess.
provider/pkg/provider/provider.go
Outdated
@@ -510,7 +510,7 @@ func (k *googleCloudProvider) Delete(ctx context.Context, req *rpc.DeleteRequest | |||
} | |||
|
|||
id := req.GetId() | |||
uri := fmt.Sprintf("%s/%s", res.BaseUrl, id) | |||
uri := fmt.Sprintf("%s%s", res.BaseUrl, id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just use this?
uri := fmt.Sprintf("%s%s", res.BaseUrl, id) | |
uri := path.Join(res.BaseUrl, id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out path.Join
doesn't quite work for URLs with all kinds of weirdness re-encoding the strings. I refactored this to a function on the resource and made some extra slashes trimmed just in case.
f504a2c
to
6216c14
Compare
6216c14
to
916a9ee
Compare
Also, fixes the DELETE for storage bucket/object