Skip to content
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

Merged
merged 1 commit into from Apr 9, 2021

Conversation

mikhailshilkov
Copy link
Member

Also, fixes the DELETE for storage bucket/object

}
count++
// delay 10s, 20s, then 30s and stay at 30s
if sleep > 30 {
Copy link
Contributor

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?

Copy link
Member Author

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.

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps just use this?

Suggested change
uri := fmt.Sprintf("%s%s", res.BaseUrl, id)
uri := path.Join(res.BaseUrl, id)

Copy link
Member Author

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.

@mikhailshilkov mikhailshilkov force-pushed the mikhailshilkov/function-example branch from f504a2c to 6216c14 Compare April 9, 2021 10:10
@mikhailshilkov mikhailshilkov force-pushed the mikhailshilkov/function-example branch from 6216c14 to 916a9ee Compare April 9, 2021 10:32
@mikhailshilkov mikhailshilkov merged commit f414526 into master Apr 9, 2021
@pulumi-bot pulumi-bot deleted the mikhailshilkov/function-example branch April 9, 2021 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants