lib/azure/armrest/model/storage_account.rb
# Create new blob for a container.
#
# The options parameter is a hash that contains information used
# when creating the blob:
#
# * type - "BlockBlob", "PageBlob" or "AppendBlob". Mandatory.
#
# * content_disposition
# * content_encoding
# * content_language
# * content_md5
# * content_type
# * cache_control
# * lease_id
# * payload (block blobs only)
# * sequence_number (page blobs only)
# * timeout (part of the request)
#
# Returns a ResponseHeaders object since this method is asynchronous.
#
Create new blob for a container.
The options parameter is a hash that contains information used
when creating the blob.





Returns a ResponseHeaders object since this method is asynchronous.
Create new blob for a container . The options parameter is a hash that contains information used when creating the blob . Returns a ResponseHeaders object since this method is asynchronous .
def create_blob(container, blob, key = access_key, options = {})
        raise ArgumentError, "No access key specified" unless key
        timeout = options.delete(:timeout)
        payload = options.delete(:payload) || ''
        url = File.join(properties.primary_endpoints.blob, container, blob)
        url += "&timeout=#{timeout}" if timeout
        hash = options.transform_keys do |okey|
          if okey.to_s =~ /^if/i
            okey.to_s.tr('_', '-')
          elsif %w[date meta_name lease_id version].include?(okey.to_s)
            'x-ms-' + okey.to_s.tr('_', '-')
          else
            'x-ms-blob-' + okey.to_s.tr('_', '-')
          end
        end
        unless hash['x-ms-blob-type']
          raise ArgumentError, "The :type option must be specified"
        end
        hash['x-ms-date'] ||= Time.now.httpdate
        hash['x-ms-version'] ||= storage_api_version
        hash['verb'] = 'PUT'
        if %w[pageblob appendblob].include?(hash['x-ms-blob-type'].downcase)
          hash['content-length'] = ''
        else
          hash['content-length'] ||= hash['x-ms-blob-content-length']
        end
        hash['content-type'] ||= hash['x-ms-blob-content-type'] || 'application/octet-stream'
        headers = build_headers(url, key, :blob, hash)
        response = ArmrestService.send(
          :rest_put,
          :url         => url,
          :payload     => payload,
          :headers     => headers,
          :proxy       => configuration.proxy,
          :ssl_version => configuration.ssl_version,
          :ssl_verify  => configuration.ssl_verify,
          :timeout     => configuration.timeout
        )
        resp_headers = Azure::Armrest::ResponseHeaders.new(response.headers)
        resp_headers.response_code = response.code
        resp_headers
      end
def create_blob ( container , blob , key = access_key , options = { } ) raise ArgumentError , "No access key specified" unless key timeout = options . delete ( :timeout ) payload = options . delete ( :payload ) || '' url = File . join ( properties . primary_endpoints . blob , container , blob ) url += "&timeout=#{timeout}" if timeout hash = options . transform_keys do | okey | if okey . to_s =~ / ^if /i okey . to_s . tr ( '_' , '-' ) elsif %w[ date meta_name lease_id version ] . include? ( okey . to_s ) 'x-ms-' + okey . to_s . tr ( '_' , '-' ) else 'x-ms-blob-' + okey . to_s . tr ( '_' , '-' ) end end unless hash [ 'x-ms-blob-type' ] raise ArgumentError , "The :type option must be specified" end hash [ 'x-ms-date' ] ||= Time . now . httpdate hash [ 'x-ms-version' ] ||= storage_api_version hash [ 'verb' ] = 'PUT' if %w[ pageblob appendblob ] . include? ( hash [ 'x-ms-blob-type' ] . downcase ) hash [ 'content-length' ] = '' else hash [ 'content-length' ] ||= hash [ 'x-ms-blob-content-length' ] end hash [ 'content-type' ] ||= hash [ 'x-ms-blob-content-type' ] || 'application/octet-stream' headers = build_headers ( url , key , :blob , hash ) response = ArmrestService . send ( :rest_put , :url => url , :payload => payload , :headers => headers , :proxy => configuration . proxy , :ssl_version => configuration . ssl_version , :ssl_verify => configuration . ssl_verify , :timeout => configuration . timeout ) resp_headers = Azure :: Armrest :: ResponseHeaders . new ( response . headers ) resp_headers . response_code = response . code resp_headers end
Create new blob for a container.
Create new blob for a container .
# Content length must be 0 (blank) for Page or Append blobs # Override the default empty string
container
<not_specific>
blob
<not_specific>
key
<not_specific>
access_key
<not_specific>
options
<not_specific>