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

client-side implementation of provider functions #34385

Merged
merged 6 commits into from
Dec 20, 2023

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Dec 8, 2023

This PR build on #34383, adding the machinery to handle the new provider defined functions in the update protocol. We add the grpc handling code, add internal interface types and methods, and and flush out the various internal implementations which fulfill the provider interface.

@jbardin jbardin marked this pull request as ready for review December 13, 2023 13:51
Base automatically changed from jbardin/provider-functions-proto to main December 14, 2023 14:55
Copy link
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

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

This makes sense to me. One thing I'm not quite clear on is behaviour with marked values passed as arguments to a function call. Is that covered somewhere that I'm not seeing, or not implemented yet?

}
args[i] = argVal
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I can see we're checking for too many parameters here, but what happens if we don't have enough parameters in the request?

if len(r.Arguments) < len(funcDecl.Parameters) {
resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("not enough arguments for function %q", r.FunctionName))
return resp
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I think this answers my question above, unless I'm misunderstanding!

@jbardin
Copy link
Member Author

jbardin commented Dec 20, 2023

Marks are automatically handled by the cty function call implementation (called via a function expression within hcl), which transfers the marks from the arguments to the result.

@jbardin jbardin merged commit 2574b89 into main Dec 20, 2023
6 checks passed
@jbardin jbardin deleted the jbardin/provider-functions-impl branch December 20, 2023 20:15
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants