Class: Azure::AG

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/service_management/ag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ AG

Returns a new instance of AG.



65
66
67
# File 'lib/azure/service_management/ag.rb', line 65

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



63
64
65
# File 'lib/azure/service_management/ag.rb', line 63

def description
  @description
end

#labelObject

Returns the value of attribute label.



63
64
65
# File 'lib/azure/service_management/ag.rb', line 63

def label
  @label
end

#locationObject

Returns the value of attribute location.



63
64
65
# File 'lib/azure/service_management/ag.rb', line 63

def location
  @location
end

#nameObject

Returns the value of attribute name.



63
64
65
# File 'lib/azure/service_management/ag.rb', line 63

def name
  @name
end

Instance Method Details

#create(params) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/azure/service_management/ag.rb', line 78

def create(params)
  builder = Nokogiri::XML::Builder.new(encoding: "utf-8") do |xml|
    xml.CreateAffinityGroup(
      xmlns: "http://schemas.microsoft.com/windowsazure"
    ) do
      xml.Name params[:azure_ag_name]
      xml.Label Base64.strict_encode64(params[:azure_ag_name])
      unless params[:azure_ag_desc].nil?
        xml.Description params[:azure_ag_desc]
      end
      xml.Location params[:azure_location]
    end
  end
  @connection.query_azure("affinitygroups",
    "post",
    builder.to_xml,
    "",
    true,
    false)
end

#parse(image) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/azure/service_management/ag.rb', line 69

def parse(image)
  @name = image.at_css("Name").content
  @label = image.at_css("Label").content
  @description = image.at_css("Description").content if
    image.at_css("Description")
  @location = image.at_css("Location").content if image.at_css("Location")
  self
end