mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Feature: Test AWS DynamoDB connection
This commit is contained in:
parent
7887792881
commit
6ad3970212
4 changed files with 1113 additions and 3 deletions
1
Gemfile
1
Gemfile
|
|
@ -36,6 +36,7 @@ gem 'redis'
|
|||
gem 'simple_command'
|
||||
gem 'typhoeus'
|
||||
gem 'mongo'
|
||||
gem 'aws-sdk', '~> 3'
|
||||
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
|
|
|
|||
1084
Gemfile.lock
1084
Gemfile.lock
File diff suppressed because it is too large
Load diff
27
app/services/dynamodb_query_service.rb
Normal file
27
app/services/dynamodb_query_service.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class DynamodbQueryService
|
||||
attr_accessor :data_query, :data_source, :options, :source_options, :current_user
|
||||
|
||||
def initialize(data_query, options, source_options, current_user)
|
||||
@data_query = data_query
|
||||
@data_source = data_query.data_source
|
||||
@options = options
|
||||
@source_options = source_options
|
||||
@current_user = current_user
|
||||
end
|
||||
|
||||
def self.connection options
|
||||
|
||||
region = options.dig('region', 'value')
|
||||
access_key = options.dig('access_key', 'value')
|
||||
secret_key = options.dig('secret_key', 'value')
|
||||
|
||||
credentials = Aws::Credentials.new(access_key, secret_key)
|
||||
dynamodb = Aws::DynamoDB::Client.new(region: region, credentials: credentials)
|
||||
|
||||
dynamodb.list_tables
|
||||
end
|
||||
|
||||
def process
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
class MongodbQueryService
|
||||
require 'redis'
|
||||
|
||||
attr_accessor :data_query, :data_source, :options, :source_options, :current_user
|
||||
|
||||
def initialize(data_query, options, source_options, current_user)
|
||||
|
|
@ -28,7 +26,7 @@ class MongodbQueryService
|
|||
user: user,
|
||||
password: password
|
||||
)
|
||||
|
||||
|
||||
connection.collections
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue