Class: Multiwoven::Integrations::Destination::AmazonS3::Client
- Inherits:
-
DestinationConnector
- Object
- DestinationConnector
- Multiwoven::Integrations::Destination::AmazonS3::Client
- Defined in:
- lib/multiwoven/integrations/destination/amazon_s3/client.rb
Instance Method Summary collapse
- #check_connection(connection_config) ⇒ Object
- #discover(connection_config) ⇒ Object
- #write(sync_config, records, _action = "destination_insert") ⇒ Object
Instance Method Details
#check_connection(connection_config) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/multiwoven/integrations/destination/amazon_s3/client.rb', line 7 def check_connection(connection_config) connection_config = connection_config.with_indifferent_access conn = create_connection(connection_config) conn.head_bucket(bucket: connection_config[:bucket_name]) ConnectionStatus.new(status: ConnectionStatusType["succeeded"]). rescue StandardError => e ConnectionStatus.new(status: ConnectionStatusType["failed"], message: e.). end |
#discover(connection_config) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/multiwoven/integrations/destination/amazon_s3/client.rb', line 16 def discover(connection_config) connection_config = connection_config.with_indifferent_access conn = create_connection(connection_config) records = discover_columns_from_s3(conn, connection_config) grouped = group_by_table(records, connection_config[:file_name]) catalog = Catalog.new(streams: create_streams(grouped)) catalog. rescue StandardError => e handle_exception(e, { context: "AMAZONS3:DISCOVER:EXCEPTION", type: "error" }) end |
#write(sync_config, records, _action = "destination_insert") ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/multiwoven/integrations/destination/amazon_s3/client.rb', line 30 def write(sync_config, records, _action = "destination_insert") records_size = records.size = [] write_success = upload_csv_content(sync_config, records) write_failure = records_size - write_success << log_request_response("info", @args, @response) (write_success, write_failure, ) rescue StandardError => e handle_exception(e, { context: "AMAZONS3:WRITE:EXCEPTION", type: "error", sync_id: sync_config.sync_id, sync_run_id: sync_config.sync_run_id }) end |