app/models/aws/s3_storage.rb
# If success, return URI which has the s3 bucket key
# else return nil
# raises exception if exception occurs
If success, return URI which has the s3 bucket key
else return nil
raises exception if exception occurs
If success return URI which has the s3 bucket key else return nil raises exception if exception occurs
def save(file_path:, bucket_name: env_bucket_for_glue_report, key:SecureRandom.uuid, options: {})
      bucket_name = fetch_bucket(bucket_name, options)
      uri = "urn:openhbx:terms:v1:file_storage:s3:bucket:#{bucket_name}##{key}"
      begin
        object = get_object(bucket_name, key)
        if object.upload_file(file_path, :server_side_encryption => 'AES256')
          uri
        else
          nil
        end
      rescue Exception => e
        raise e
      end
    end
def save ( file_path : , bucket_name : env_bucket_for_glue_report , key : SecureRandom . uuid , options : { } ) bucket_name = fetch_bucket ( bucket_name , options ) uri = "urn:openhbx:terms:v1:file_storage:s3:bucket:#{bucket_name}##{key}" begin object = get_object ( bucket_name , key ) if object . upload_file ( file_path , :server_side_encryption => 'AES256' ) uri else nil end rescue Exception => e raise e end end
If success, return URI which has the s3 bucket key
else return nil
raises exception if exception occurs
If success return URI which has the s3 bucket key else return nil raises exception if exception occurs
file_path
bucket_name
env_bucket_for_glue_report
key
uuid
options