Skip to content

Commit

Permalink
feat: iam role support release (#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr authored Aug 7, 2024
1 parent 0ccefc4 commit 8ff299f
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/configurations/destinations/rs/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
"port",
"database",
"user",
"useIAMForAuth",
"password",
"iamRoleARNForAuth",
"clusterId",
"clusterRegion",
"bucketName",
"iamRoleARN",
"roleBasedAuth",
Expand Down
80 changes: 62 additions & 18 deletions src/configurations/destinations/rs/schema.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"host",
"port",
"database",
"user",
"password",
"syncFrequency",
"useRudderStorage"
],
"required": ["database", "user", "syncFrequency", "useRudderStorage"],
"type": "object",
"properties": {
"host": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(.{1,255})$"
},
"port": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
},
"database": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
Expand All @@ -28,7 +12,6 @@
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
},
"password": { "type": "string", "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|.*" },
"namespace": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^((?!pg_|PG_|pG_|Pg_).{0,64})$"
Expand All @@ -54,6 +37,7 @@
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.*)$"
},
"useRudderStorage": { "type": "boolean", "default": false },
"useIAMForAuth": { "type": "boolean", "default": false },
"preferAppend": { "type": "boolean", "default": true },
"oneTrustCookieCategories": {
"type": "array",
Expand Down Expand Up @@ -596,6 +580,66 @@
}
},
"allOf": [
{
"if": {
"properties": {
"useIAMForAuth": {
"const": false
}
},
"required": ["useIAMForAuth"]
},
"then": {
"properties": {
"host": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(.{1,255})$"
},
"port": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
},
"password": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|.*"
},
"useIAMForAuth": {
"const": false
}
},
"required": ["host", "port", "password"]
}
},
{
"if": {
"properties": {
"useIAMForAuth": {
"const": true
}
},
"required": ["useIAMForAuth"]
},
"then": {
"properties": {
"iamRoleARNForAuth": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"clusterId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$"
},
"clusterRegion": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$"
},
"useIAMForAuth": {
"const": true
}
},
"required": ["clusterId", "clusterRegion", "iamRoleARNForAuth", "useIAMForAuth"]
}
},
{
"if": {
"properties": { "useRudderStorage": { "const": false } },
Expand Down
70 changes: 70 additions & 0 deletions src/configurations/destinations/rs/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
{
"title": "Connection Credentials",
"fields": [
{
"type": "checkbox",
"label": "Use IAM for Authentication",
"value": "useIAMForAuth",
"required": false,
"default": false
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": false
}
],
"label": "Host",
"value": "host",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(.{1,255})$",
Expand All @@ -14,13 +27,49 @@
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": false
}
],
"label": "Port",
"value": "port",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Port",
"placeholder": "5439",
"required": true
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": true
}
],
"label": "Cluster Id",
"value": "clusterId",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$",
"regexErrorMessage": "Invalid ClusterID",
"placeholder": "Cluster Identifier",
"required": true
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": true
}
],
"label": "Cluster region",
"value": "clusterRegion",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$",
"regexErrorMessage": "Invalid Cluster region",
"placeholder": "Cluster Identifier",
"required": true
},
{
"type": "textInput",
"label": "Database",
Expand All @@ -41,13 +90,34 @@
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": false
}
],
"label": "Password",
"value": "password",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|.*",
"placeholder": "e.g: warehousepassword",
"required": true,
"secret": true
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": true
}
],
"label": "IAM Role ARN For Authentication",
"value": "iamRoleARNForAuth",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$",
"regexErrorMessage": "Invalid Role ARN",
"required": true,
"placeholder": "e.g: arn:aws:iam::12345X789012:role/RedshiftAccess"
},
{
"type": "textInput",
"label": "Namespace",
Expand Down
112 changes: 112 additions & 0 deletions test/data/validation/destinations/rs.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,118 @@
},
"result": true
},
{
"config": {
"host": "test-host",
"database": "test-database",
"user": "test-user",
"password": "test-password",
"useIAMForAuth": false,
"port": "0000",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": true
},
{
"config": {
"host": "test-host",
"database": "test-database",
"user": "test-user",
"password": "test-password",
"useIAMForAuth": false,
"iamRoleARNForAuth": "",
"clusterId": "",
"clusterRegion": "",
"port": "0000",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": true
},
{
"config": {
"database": "test-database",
"user": "test-user",
"useIAMForAuth": false,
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": false,
"err": [
" must have required property 'host'",
" must have required property 'port'",
" must have required property 'password'",
" must match \"then\" schema"
]
},
{
"config": {
"host": "",
"password": "",
"port": "",
"database": "test-database",
"user": "test-user",
"useIAMForAuth": true,
"iamRoleARNForAuth": "iamRoleARNForAuth",
"clusterId": "clusterId",
"clusterRegion": "clusterRegion",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": true
},
{
"config": {
"database": "test-database",
"user": "test-user",
"useIAMForAuth": true,
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": false,
"err": [
" must have required property 'clusterId'",
" must have required property 'clusterRegion'",
" must have required property 'iamRoleARNForAuth'",
" must match \"then\" schema"
]
},
{
"config": {
"host": "test-host",
Expand Down

0 comments on commit 8ff299f

Please sign in to comment.