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

Create Peer APIs #445

Merged
merged 6 commits into from
Sep 28, 2023
Merged

Create Peer APIs #445

merged 6 commits into from
Sep 28, 2023

Conversation

Amogh-Bharadwaj
Copy link
Contributor

  • Introduces two functions on the Flow API side:
    ValidatePeer and CreatePeer

}

enum ValidatePeerStatus {
VALID = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

For all enums add UNKNOWN as 0 and start from 1

// case protos.DBType_SQLSERVER:
// return conneventhub.NewEventHubConnector(ctx, config.GetEventhubConfig())
default:
return nil, ErrUnsupportedFunctionality
Copy link
Contributor

Choose a reason for hiding this comment

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

can you return a more detailed error with the info of the Peer and that it isn't supported?

config := req.Peer.Config
wrongConfigResponse := &protos.CreatePeerResponse{
Status: protos.CreatePeerStatus_FAILED,
Message: "wrong config for connector",
Copy link
Contributor

Choose a reason for hiding this comment

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

more detailed response

peerType := req.Peer.Type
switch peerType {
case protos.DBType_POSTGRES:
pgConfig := config.(*protos.Peer_PostgresConfig).PostgresConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

lets do pgConfig, ok and check if the cast is Ok, do this else where too

return wrongConfigResponse, nil
}
if encodingErr != nil {
log.Errorf("failed to encode peer config: %v", encodingErr)
Copy link
Contributor

Choose a reason for hiding this comment

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

for every error, add some info about the request that resulted in this response

if err != nil {
return &protos.ValidatePeerResponse{
Status: protos.ValidatePeerStatus_INVALID,
Message: fmt.Sprintf("peer type is missing or your requested configuration for %s peer %s was invalidated: %s",
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
line is 123 characters (lll)

@heavycrystal heavycrystal enabled auto-merge (squash) September 28, 2023 18:26
@heavycrystal heavycrystal merged commit bdba9ae into main Sep 28, 2023
20 checks passed
@serprex serprex deleted the create-peer-apis branch July 19, 2024 15:18
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.

3 participants