Class: Azure::StorageAccount

Inherits:
Object
  • Object
show all
Includes:
AzureUtility
Defined in:
lib/azure/storageaccount.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AzureUtility

#xml_content

Constructor Details

#initialize(connection) ⇒ StorageAccount

Returns a new instance of StorageAccount.



81
82
83
# File 'lib/azure/storageaccount.rb', line 81

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#affinityGroupObject

Returns the value of attribute affinityGroup.



80
81
82
# File 'lib/azure/storageaccount.rb', line 80

def affinityGroup
  @affinityGroup
end

#georeplicationenabledObject

Returns the value of attribute georeplicationenabled.



80
81
82
# File 'lib/azure/storageaccount.rb', line 80

def georeplicationenabled
  @georeplicationenabled
end

#locationObject

Returns the value of attribute location.



79
80
81
# File 'lib/azure/storageaccount.rb', line 79

def location
  @location
end

#nameObject

Returns the value of attribute name.



79
80
81
# File 'lib/azure/storageaccount.rb', line 79

def name
  @name
end

Instance Method Details

#create(params) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/azure/storageaccount.rb', line 95

def create(params)
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.CreateStorageServiceInput('xmlns'=>'http://schemas.microsoft.com/windowsazure') {
      xml.ServiceName params[:azure_storage_account]
      xml.Label Base64.encode64(params[:azure_storage_account])
      xml.Description params[:azure_storage_account_description] || 'Explicitly created storage service'
      # Location defaults to 'West US'
      xml.Location params[:azure_service_location] || 'West US'
    }
  end
  @connection.query_azure("storageservices", "post", builder.to_xml)
end

#parse(serviceXML) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/azure/storageaccount.rb', line 84

def parse(serviceXML)
  @name = xml_content(serviceXML, 'ServiceName')
  @description = xml_content(serviceXML, 'Description')
  @label = xml_content(serviceXML, 'Label')
  @affinitygroup = xml_content(serviceXML, 'AffinityGroup')
  @location = xml_content(serviceXML, 'Location')
  @georeplicationenabled = xml_content(serviceXML, 'GeoReplicationEnabled')
  @extendpropertyname = xml_content(serviceXML, 'ExtendedProperties ExtendedProperty Name')
  @extendpropertyvalue = xml_content(serviceXML, 'ExtendedProperties ExtendedProperty Value')
  self
end