Class: Azure::StorageAccount

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AzureUtility

#error_from_response_xml, #xml_content

Constructor Details

#initialize(connection) ⇒ StorageAccount

Returns a new instance of StorageAccount.



90
91
92
# File 'lib/azure/service_management/storageaccount.rb', line 90

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#affinityGroupObject

Returns the value of attribute affinityGroup.



89
90
91
# File 'lib/azure/service_management/storageaccount.rb', line 89

def affinityGroup
  @affinityGroup
end

#georeplicationenabledObject

Returns the value of attribute georeplicationenabled.



89
90
91
# File 'lib/azure/service_management/storageaccount.rb', line 89

def georeplicationenabled
  @georeplicationenabled
end

#locationObject

Returns the value of attribute location.



88
89
90
# File 'lib/azure/service_management/storageaccount.rb', line 88

def location
  @location
end

#nameObject

Returns the value of attribute name.



88
89
90
# File 'lib/azure/service_management/storageaccount.rb', line 88

def name
  @name
end

Instance Method Details

#create(params) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/azure/service_management/storageaccount.rb', line 104

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'
      if params[:azure_affinity_group]
        xml.AffinityGroup params[:azure_affinity_group]
      else 
        xml.Location params[:azure_service_location] || 'West US'
      end
    }
  end
  @connection.query_azure("storageservices", "post", builder.to_xml)
end

#parse(serviceXML) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/azure/service_management/storageaccount.rb', line 93

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