-
Notifications
You must be signed in to change notification settings - Fork 97
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
Create Peer APIs #445
Conversation
991ddb6
to
bbe7c0c
Compare
protos/route.proto
Outdated
} | ||
|
||
enum ValidatePeerStatus { | ||
VALID = 0; |
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.
For all enums add UNKNOWN
as 0
and start from 1
flow/connectors/core.go
Outdated
// case protos.DBType_SQLSERVER: | ||
// return conneventhub.NewEventHubConnector(ctx, config.GetEventhubConfig()) | ||
default: | ||
return nil, ErrUnsupportedFunctionality |
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.
can you return a more detailed error with the info of the Peer and that it isn't supported?
flow/cmd/handler.go
Outdated
config := req.Peer.Config | ||
wrongConfigResponse := &protos.CreatePeerResponse{ | ||
Status: protos.CreatePeerStatus_FAILED, | ||
Message: "wrong config for connector", |
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.
more detailed response
flow/cmd/handler.go
Outdated
peerType := req.Peer.Type | ||
switch peerType { | ||
case protos.DBType_POSTGRES: | ||
pgConfig := config.(*protos.Peer_PostgresConfig).PostgresConfig |
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.
lets do pgConfig, ok
and check if the cast is Ok, do this else where too
flow/cmd/handler.go
Outdated
return wrongConfigResponse, nil | ||
} | ||
if encodingErr != nil { | ||
log.Errorf("failed to encode peer config: %v", encodingErr) |
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.
for every error, add some info about the request that resulted in this response
flow/cmd/handler.go
Outdated
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", |
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.
🚫 [golangci] reported by reviewdog 🐶
line is 123 characters (lll)
ValidatePeer and CreatePeer