Class: Fog::Compute::AzureRM::AvailabilitySet

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/azurerm/models/compute/availability_set.rb

Overview

This class is giving implementation of create/save and delete/destroy for Availability Set.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(availability_set) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/azurerm/models/compute/availability_set.rb', line 18

def self.parse(availability_set)
  hash = {}
  hash['id'] = availability_set.id
  hash['name'] = availability_set.name
  hash['type'] = availability_set.type
  hash['location'] = availability_set.location
  hash['resource_group'] = get_resource_group_from_id(availability_set.id)
  hash['platform_update_domain_count'] = availability_set.platform_update_domain_count
  hash['platform_fault_domain_count'] = availability_set.platform_fault_domain_count

  unless availability_set.sku.nil?
    hash['sku_name'] = availability_set.sku.name
    hash['use_managed_disk'] = availability_set.sku.name.eql?(AS_SKU_ALIGNED)
  end

  hash['tags'] = availability_set.tags
  hash
end

Instance Method Details

#destroyObject



47
48
49
# File 'lib/fog/azurerm/models/compute/availability_set.rb', line 47

def destroy
  service.delete_availability_set(resource_group, name)
end

#saveObject



37
38
39
40
41
42
43
44
45
# File 'lib/fog/azurerm/models/compute/availability_set.rb', line 37

def save
  requires :name
  requires :location
  requires :resource_group
  # need to create the availability set
  as = service.create_availability_set(avail_set_params(platform_fault_domain_count, platform_update_domain_count, use_managed_disk))
  hash = Fog::Compute::AzureRM::AvailabilitySet.parse(as)
  merge_attributes(hash)
end