lib/logstash/outputs/google_cloud_storage.rb
##
# Uploads a local file to the configured bucket.
Uploads a local file to the configured bucket.
Uploads a local file to the configured bucket .
def upload_object(filename)
    begin
      @logger.debug("GCS: upload object.", :filename => filename)
      media = Google::APIClient::UploadIO.new(filename, @content_type)
      metadata_insert_result = @client.execute(:api_method => @storage.objects.insert,
                                               :parameters => {
                                                 'uploadType' => 'multipart',
                                                 'bucket' => @bucket,
                                                 'contentEncoding' => @content_encoding,
                                                 'name' => File.basename(filename)
                                               },
                                               :body_object => {contentType: @content_type},
                                               :media => media)
      contents = metadata_insert_result.data
      @logger.debug("GCS: multipart insert",
                    :object => contents.name,
                    :self_link => contents.self_link)
    rescue => e
      @logger.error("GCS: failed to upload file", :exception => e)
      sleep 1
      retry
    end
  end
def upload_object ( filename ) begin @logger . debug ( "GCS: upload object." , :filename => filename ) media = Google :: APIClient :: UploadIO . new ( filename , @content_type ) metadata_insert_result = @client . execute ( :api_method => @storage . objects . insert , :parameters => { 'uploadType' => 'multipart' , 'bucket' => @bucket , 'contentEncoding' => @content_encoding , 'name' => File . basename ( filename ) } , :body_object => { contentType : @content_type } , :media => media ) contents = metadata_insert_result . data @logger . debug ( "GCS: multipart insert" , :object => contents . name , :self_link => contents . self_link ) rescue => e @logger . error ( "GCS: failed to upload file" , :exception => e ) sleep 1 retry end end
Uploads a local file to the configured bucket.
Uploads a local file to the configured bucket .
# TODO(rdc): limit retries?
filename
<not_specific>