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.



94
95
96
# File 'lib/azure/service_management/storageaccount.rb', line 94

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#affinityGroupObject

Returns the value of attribute affinityGroup.



93
94
95
# File 'lib/azure/service_management/storageaccount.rb', line 93

def affinityGroup
  @affinityGroup
end

#georeplicationenabledObject

Returns the value of attribute georeplicationenabled.



93
94
95
# File 'lib/azure/service_management/storageaccount.rb', line 93

def georeplicationenabled
  @georeplicationenabled
end

#locationObject

Returns the value of attribute location.



92
93
94
# File 'lib/azure/service_management/storageaccount.rb', line 92

def location
  @location
end

#nameObject

Returns the value of attribute name.



92
93
94
# File 'lib/azure/service_management/storageaccount.rb', line 92

def name
  @name
end

Instance Method Details

#create(params) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/azure/service_management/storageaccount.rb', line 110

def create(params)
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.CreateStorageServiceInput("xmlns" => "http://schemas.microsoft.com/windowsazure") do
      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
  end
  @connection.query_azure("storageservices", "post", builder.to_xml)
end

#parse(serviceXML) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/azure/service_management/storageaccount.rb', line 98

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