Skip to content

Commit

Permalink
Merge pull request #1321 from rudderlabs/feat.sftp
Browse files Browse the repository at this point in the history
feat: onboard new destination sftp
  • Loading branch information
Gauravudia authored May 7, 2024
2 parents fa72fda + 63acdaa commit 346c3e5
Show file tree
Hide file tree
Showing 4 changed files with 423 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/configurations/destinations/sftp/db-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "SFTP",
"displayName": "SFTP",
"config": {
"transformAtV1": "none",
"saveDestinationResponse": true,
"disableJsonMapper": true,
"supportsVisualMapper": true,
"supportedSourceTypes": ["warehouse"],
"supportedMessageTypes": {
"cloud": ["record"]
},
"supportedConnectionModes": {
"warehouse": ["cloud"]
},
"syncBehaviours": ["mirror"],
"destConfig": {
"defaultConfig": [
"host",
"port",
"authMethod",
"username",
"password",
"privateKey",
"fileFormat",
"filePath",
"oneTrustCookieCategories"
]
},
"secretKeys": ["password", "privateKey"]
},
"options": {
"isBeta": true
}
}
134 changes: 134 additions & 0 deletions src/configurations/destinations/sftp/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"required": ["host", "port", "username", "authMethod", "fileFormat", "filePath"],
"type": "object",
"properties": {
"host": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(.{1,100})$"
},
"port": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(?:[1-9][0-9]{0,4}|[1-5][0-9]{4}|6[0-5]{4}|6553[0-5])$"
},
"username": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
},
"authMethod": {
"type": "string",
"enum": ["passwordAuth", "keyAuth"],
"default": "passwordAuth"
},
"fileFormat": {
"type": "string",
"enum": ["json", "csv"],
"default": "csv"
},
"filePath": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^.*\\.(json|csv)$"
},
"oneTrustCookieCategories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
}
}
}
},
"connectionMode": {
"type": "object",
"properties": {
"warehouse": {
"type": "string",
"enum": ["cloud"]
}
}
}
},
"allOf": [
{
"if": {
"properties": {
"authMethod": {
"const": "passwordAuth"
}
},
"required": ["authMethod"]
},
"then": {
"properties": {
"password": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
}
},
"required": ["password"]
}
},
{
"if": {
"properties": {
"authMethod": {
"const": "keyAuth"
}
},
"required": ["authMethod"]
},
"then": {
"properties": {
"privateKey": {
"type": "string",
"pattern": "^[\\s\\S]+$"
}
},
"required": ["privateKey"]
}
},
{
"if": {
"properties": {
"fileFormat": {
"const": "csv"
}
},
"required": ["fileFormat"]
},
"then": {
"properties": {
"filePath": {
"type": "string",
"pattern": "\\.csv$"
}
},
"required": ["filePath"]
}
},
{
"if": {
"properties": {
"fileFormat": {
"const": "json"
}
},
"required": ["fileFormat"]
},
"then": {
"properties": {
"filePath": {
"type": "string",
"pattern": "\\.json$"
}
},
"required": ["filePath"]
}
}
]
}
}
184 changes: 184 additions & 0 deletions src/configurations/destinations/sftp/ui-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"uiConfig": {
"baseTemplate": [
{
"title": "Initial setup",
"note": "Review how this destination is set up",
"sections": [
{
"groups": [
{
"title": "Connection settings",
"icon": "settings",
"fields": [
{
"type": "textInput",
"label": "Host",
"note": "Enter the Hostname or IP Address of the server. Do not include the port number.",
"configKey": "host",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(.{1,100})$",
"regexErrorMessage": "Invalid Host"
},
{
"type": "textInput",
"label": "Port",
"note": "Enter the Port Number of the server.",
"configKey": "port",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(?:[1-9][0-9]{0,4}|[1-5][0-9]{4}|6[0-5]{4}|6553[0-5])$",
"regexErrorMessage": "Invalid Port",
"placeholder": "e.g. 22"
},
{
"type": "textInput",
"label": "Username",
"configKey": "username",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Username",
"placeholder": "e.g. testUser"
},
{
"type": "singleSelect",
"label": "Authentication",
"note": "Select the Authentication method.",
"configKey": "authMethod",
"options": [
{
"label": "Username + Password",
"value": "passwordAuth"
},
{
"label": "Username + SSH Key",
"value": "keyAuth"
}
],
"default": "passwordAuth"
},
{
"type": "textInput",
"label": "Password",
"configKey": "password",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Password",
"placeholder": "e.g. passXXX123",
"secret": true,
"preRequisites": {
"fields": [
{
"configKey": "authMethod",
"value": "passwordAuth"
}
]
}
},
{
"type": "textInput",
"label": "Private Key",
"note": "Enter the full Private Key for the user including the header and footer.",
"configKey": "privateKey",
"regex": "^[\\s\\S]+$",
"regexErrorMessage": "Invalid Private Key",
"secret": true,
"preRequisites": {
"fields": [
{
"configKey": "authMethod",
"value": "keyAuth"
}
]
},
"isTextArea": true
},
{
"type": "singleSelect",
"label": "File Format",
"configKey": "fileFormat",
"options": [
{
"label": "JSON",
"value": "json"
},
{
"label": "CSV",
"value": "csv"
}
],
"default": "csv"
},
{
"type": "textInput",
"label": "File Path",
"note": "Enter the file path where the data will be stored. The parent directory of the file should already exist. Supported file types are JSON and CSV. We support date and time variables within '{}', including {YYYY}, {MM}, {DD}, {hh}, {mm}, {ss}, {ms}, {timestampInSec}, and {timestampInMS}.",
"configKey": "filePath",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^.*\\.(json|csv)$",
"regexErrorMessage": "Invalid File Path",
"placeholder": "e.g: directory/file_{YYYY}_{MM}_{DD}_{mm}.csv"
}
]
}
]
},
{
"groups": [
{
"title": "Connection mode",
"note": [
"Update how you want to route events from your source to destination. ",
{
"text": "Get help deciding",
"link": "https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/"
}
],
"icon": "sliders",
"fields": []
}
]
}
]
},
{
"title": "Configuration settings",
"note": "Manage the settings for your destination",
"sections": [
{
"title": "Other settings",
"note": "Configure advanced RudderStack features here",
"icon": "otherSettings",
"groups": [
{
"title": "OneTrust cookie consent settings",
"note": [
"Enter your OneTrust category names if you have them configured. ",
{
"text": "Learn more ",
"link": "https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/onetrust-consent-manager/"
},
"about RudderStack's OneTrust Consent Manager feature."
],
"fields": [
{
"type": "tagInput",
"label": "Cookie category name",
"note": "Input your OneTrust category names by pressing 'Enter' after each entry",
"configKey": "oneTrustCookieCategories",
"tagKey": "oneTrustCookieCategory",
"placeholder": "e.g: Credit card visit",
"default": [
{
"oneTrustCookieCategory": ""
}
]
}
]
}
]
}
]
}
],
"sdkTemplate": {
"title": "SDK settings",
"note": "not visible in the ui",
"fields": []
}
}
}
Loading

0 comments on commit 346c3e5

Please sign in to comment.