From d5ded2d1f09aada8bb86f116cc852b66a86b96ea Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Fri, 30 Aug 2024 18:49:28 +0530 Subject: [PATCH 1/3] add field for roleArn --- ui/app/peers/create/[peerType]/helpers/ch.ts | 9 +++++++++ ui/app/peers/create/[peerType]/schema.ts | 3 +++ ui/components/PeerForms/ClickhouseConfig.tsx | 1 + 3 files changed, 13 insertions(+) diff --git a/ui/app/peers/create/[peerType]/helpers/ch.ts b/ui/app/peers/create/[peerType]/helpers/ch.ts index d04a954d8f..3088a05c20 100644 --- a/ui/app/peers/create/[peerType]/helpers/ch.ts +++ b/ui/app/peers/create/[peerType]/helpers/ch.ts @@ -82,6 +82,15 @@ export const clickhouseSetting: PeerSetting[] = [ tips: 'An endpoint is the URL of the entry point for an AWS web service.', optional: true, }, + { + label: 'Role ARN', + stateHandler: (value, setter) => + setter((curr) => ({ ...curr, roleArn: value as string })), + tips: 'If set, the role ARN will be used to assume the role before accessing the bucket.', + helpfulLink: + 'https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns', + optional: true, + }, { label: 'Certificate', stateHandler: (value, setter) => { diff --git a/ui/app/peers/create/[peerType]/schema.ts b/ui/app/peers/create/[peerType]/schema.ts index 5b4494ad15..545649d799 100644 --- a/ui/app/peers/create/[peerType]/schema.ts +++ b/ui/app/peers/create/[peerType]/schema.ts @@ -296,6 +296,9 @@ export const chSchema = (hostDomains: string[]) => endpoint: z .string({ invalid_type_error: 'Endpoint must be a string' }) .optional(), + roleArn: z + .string({ invalid_type_error: 'Role ARN must be a string' }) + .optional(), disableTls: z.boolean(), certificate: z .string({ diff --git a/ui/components/PeerForms/ClickhouseConfig.tsx b/ui/components/PeerForms/ClickhouseConfig.tsx index 825bfe8e9c..aef1c8ceb1 100644 --- a/ui/components/PeerForms/ClickhouseConfig.tsx +++ b/ui/components/PeerForms/ClickhouseConfig.tsx @@ -24,6 +24,7 @@ export default function ClickhouseForm({ settings, setter }: ConfigProps) { 'Secret Access Key', 'Region', 'Endpoint', + 'Role ARN', ]; const handleFile = ( From 6dee494a397ec6a4c038e548c5a7bd13b4779b5e Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Fri, 30 Aug 2024 18:51:36 +0530 Subject: [PATCH 2/3] add to proto --- protos/peers.proto | 1 + ui/app/peers/create/[peerType]/helpers/ch.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/protos/peers.proto b/protos/peers.proto index f28823199a..4a2105990d 100644 --- a/protos/peers.proto +++ b/protos/peers.proto @@ -122,6 +122,7 @@ message ClickhouseConfig{ optional string endpoint = 11; optional string certificate = 12 [(peerdb_redacted) = true]; optional string private_key = 13 [(peerdb_redacted) = true]; + optional string role_arn = 14; } message SqlServerConfig { diff --git a/ui/app/peers/create/[peerType]/helpers/ch.ts b/ui/app/peers/create/[peerType]/helpers/ch.ts index 3088a05c20..d3713f5aa7 100644 --- a/ui/app/peers/create/[peerType]/helpers/ch.ts +++ b/ui/app/peers/create/[peerType]/helpers/ch.ts @@ -135,4 +135,5 @@ export const blankClickhouseSetting: ClickhouseConfig = { region: '', disableTls: false, endpoint: undefined, + roleArn: undefined, }; From 50e6740ee17e2a74982763deaec722e8d0f36e5a Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Fri, 30 Aug 2024 18:56:57 +0530 Subject: [PATCH 3/3] query layer patch --- nexus/analyzer/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/nexus/analyzer/src/lib.rs b/nexus/analyzer/src/lib.rs index 55ec8987c3..35f844947e 100644 --- a/nexus/analyzer/src/lib.rs +++ b/nexus/analyzer/src/lib.rs @@ -750,6 +750,7 @@ fn parse_db_options(db_type: DbType, with_options: &[SqlOption]) -> anyhow::Resu .map(|s| s.parse::().unwrap_or_default()) .unwrap_or_default(), endpoint: opts.get("endpoint").map(|s| s.to_string()), + role_arn: opts.get("role_arn").map(|s| s.to_string()), certificate: opts.get("certificate").map(|s| s.to_string()), private_key: opts.get("private_key").map(|s| s.to_string()), };