class Azure::Service::StorageService

A base class for StorageService implementations

Public Class Methods

new(signer=Core::Auth::SharedKey.new, account_name=nil, options = {}) click to toggle source

Create a new instance of the StorageService

@param signer [Azure::Core::Auth::Signer] An implementation of Signer used for signing requests. (optional, Default=Azure::Core::Auth::SharedKey.new) @param account_name [String] The account name (optional, Default=Azure.config.storage_account_name) @param options [Azure::Configurable] the client configuration context

Calls superclass method
# File lib/azure/service/storage_service.rb, line 27
def initialize(signer=Core::Auth::SharedKey.new, account_name=nil, options = {})
  super(signer, account_name, options)
end

Public Instance Methods

add_metadata_to_headers(metadata, headers) click to toggle source

Adds metadata properties to header hash with required prefix

metadata - A Hash of metadata name/value pairs headers - A Hash of HTTP headers

# File lib/azure/service/storage_service.rb, line 74
def add_metadata_to_headers(metadata, headers)
  metadata.each do |key, value|
    headers["x-ms-meta-#{key}"] = value
  end
end
get_service_properties() click to toggle source

Public: Get Storage Service properties

See msdn.microsoft.com/en-us/library/azure/hh452239 See msdn.microsoft.com/en-us/library/azure/hh452243

Returns a Hash with the service properties or nil if the operation failed

# File lib/azure/service/storage_service.rb, line 38
def get_service_properties
  uri = service_properties_uri
  response = call(:get, uri, nil, service_properties_headers)
  Serialization.service_properties_from_xml response.body
end
service_properties_headers() click to toggle source
# File lib/azure/service/storage_service.rb, line 80
def service_properties_headers
  {'x-ms-version' => '2014-02-14'}
end
service_properties_uri(query={}) click to toggle source

Public: Generate the URI for the service properties

query - see Azure::Services::GetServiceProperties#call documentation.

Returns a URI.

# File lib/azure/service/storage_service.rb, line 65
def service_properties_uri(query={})
  query.update(restype: 'service', comp: 'properties')
  generate_uri('', query)
end
set_service_properties(service_properties) click to toggle source

Public: Set Storage Service properties

service_properties - An instance of Azure::Entity::Service::StorageServiceProperties

See msdn.microsoft.com/en-us/library/azure/hh452235 See msdn.microsoft.com/en-us/library/azure/hh452232

Returns boolean indicating success.

# File lib/azure/service/storage_service.rb, line 52
def set_service_properties(service_properties)
  body = Serialization.service_properties_to_xml service_properties

  uri = service_properties_uri
  call(:put, uri, body, service_properties_headers)
  nil
end