Class: Outhad::Integrations::Destination::AmazonS3::Client
- Inherits:
-
DestinationConnector
- Object
- DestinationConnector
- Outhad::Integrations::Destination::AmazonS3::Client
- Defined in:
- lib/outhad/integrations/destination/amazon_s3/client.rb
Instance Method Summary collapse
- #check_connection(connection_config) ⇒ Object
- #discover(_connection_config = nil) ⇒ 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/outhad/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 = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/outhad/integrations/destination/amazon_s3/client.rb', line 16 def discover(_connection_config = nil) catalog_json = read_json(CATALOG_SPEC_PATH) catalog = build_catalog(catalog_json) catalog. rescue StandardError => e handle_exception(e, { context: "AMAZONS3:DISCOVER:EXCEPTION", type: "error" }) end |
#write(sync_config, records, _action = "destination_insert") ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/outhad/integrations/destination/amazon_s3/client.rb', line 27 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 |