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



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/azurerm/models/compute/availability_set.rb', line 15

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
  hash
end

Instance Method Details

#destroyObject



37
38
39
# File 'lib/fog/azurerm/models/compute/availability_set.rb', line 37

def destroy
  service.delete_availability_set(resource_group, name)
end

#saveObject



27
28
29
30
31
32
33
34
35
# File 'lib/fog/azurerm/models/compute/availability_set.rb', line 27

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