Class: Azure::AGs

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

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ AGs

Returns a new instance of AGs.



21
22
23
# File 'lib/azure/service_management/ag.rb', line 21

def initialize(connection)
  @connection = connection
end

Instance Method Details

#allObject



42
43
44
# File 'lib/azure/service_management/ag.rb', line 42

def all
  load.values
end

#create(params) ⇒ Object



54
55
56
57
# File 'lib/azure/service_management/ag.rb', line 54

def create(params)
  ag = AG.new(@connection)
  ag.create(params)
end

#exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/azure/service_management/ag.rb', line 46

def exists?(name)
  load.key?(name)
end

#find(name) ⇒ Object



50
51
52
# File 'lib/azure/service_management/ag.rb', line 50

def find(name)
  load[name]
end

#loadObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/azure/service_management/ag.rb', line 25

def load
  @ags ||= begin
    @ags = {}
    response = @connection.query_azure("affinitygroups",
      "get",
      "",
      "",
      true,
      false)
    response.css("AffinityGroup").each do |ag|
      item = AG.new(@connection).parse(ag)
      @ags[item.name] = item
    end
    @ags
  end
end