-
Notifications
You must be signed in to change notification settings - Fork 297
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
feat: onboard new generic destination sftp #4601
Conversation
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4601 +/- ##
==========================================
- Coverage 74.66% 74.55% -0.11%
==========================================
Files 409 412 +3
Lines 48417 48703 +286
==========================================
+ Hits 36150 36311 +161
- Misses 9929 10014 +85
- Partials 2338 2378 +40 ☔ View full report in Codecov by Sentry. |
@@ -43,3 +25,21 @@ func NewManager(destination *backendconfig.DestinationT, backendConfig backendco | |||
} | |||
return nil, errors.New("invalid destination type") | |||
} | |||
|
|||
func NewSFTPManager(destination *backendconfig.DestinationT, backendConfig backendconfig.BackendConfig) (common.AsyncDestinationManager, error) { |
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.
Are we planning to have more SFTP based destinations ?
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.
Yes, Klaviyo and Salesforce also supports SFTP based file uploads. Targeting it for next quarter
AuthMethod string `json:"authMethod"` | ||
Username string `json:"username"` | ||
Host string `json:"host"` | ||
Port string `json:"port"` |
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.
Port string `json:"port"` | |
Port int `json:"port"` |
Suggesting changing to int to avoid converting the string back to int again
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.
JSON.unmarhsal is not giving the desired output for string to int conversion.
router/batchrouter/asyncdestinationmanager/bing-ads/bulk_uploader.go
Outdated
Show resolved
Hide resolved
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.
Some more minor comments.
@@ -17,13 +24,13 @@ func (f *InvalidManager) Upload(asyncDestStruct *AsyncDestinationStruct) AsyncUp | |||
} | |||
} | |||
|
|||
func (f *InvalidManager) Poll(_ AsyncPoll) PollStatusResponse { | |||
func (*InvalidManager) Poll(_ AsyncPoll) PollStatusResponse { | |||
return PollStatusResponse{ | |||
StatusCode: 400, |
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.
StatusCode: 400, | |
StatusCode: http.StatusBadRequest, |
return PollStatusResponse{ | ||
StatusCode: 400, | ||
} | ||
} | ||
|
||
func (f *InvalidManager) GetUploadStats(_ GetUploadStatsInput) GetUploadStatsResponse { | ||
func (*InvalidManager) GetUploadStats(_ GetUploadStatsInput) GetUploadStatsResponse { | ||
return GetUploadStatsResponse{ | ||
StatusCode: 400, |
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.
StatusCode: 400, | |
StatusCode: http.StatusBadRequest, |
|
||
func newDefaultManager(fileManager sftp.FileManager) *defaultManager { | ||
return &defaultManager{ | ||
FileManager: fileManager, |
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.
Does it needs to be exported?
FileManager: fileManager, | |
fileManager: fileManager, |
|
||
var ( | ||
json = jsoniter.ConfigCompatibleWithStandardLibrary | ||
re = regexp.MustCompile(`{([^}]+)}`) |
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 we name it better? Something like placeholderRegex
?
} | ||
} | ||
|
||
func generateJSONFile(filePath string) (string, error) { |
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.
Adding some context around error branches would be helpful?
return tmpFilePath, nil | ||
} | ||
|
||
func generateCSVFile(filePath string) (string, error) { |
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.
Adding some context around error branches would be helpful?
Description
AsyncUploadAndTransformManager
, was created.record
event type as this is a generic destination that don't have any predefined schema.transfromer
call for transformation and handling it directly on the server side due to straightforward transformation.Linear Ticket
Resolves INT-1923
https://linear.app/rudderstack/issue/INT-1923/sftp-destination-development-in-rudder-server
Security