Class: VagrantPlugins::Cloudstack::Service::CloudstackResourceService

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-cloudstack/service/cloudstack_resource_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(cloudstack_compute, ui) ⇒ CloudstackResourceService

Returns a new instance of CloudstackResourceService.



5
6
7
8
# File 'lib/vagrant-cloudstack/service/cloudstack_resource_service.rb', line 5

def initialize(cloudstack_compute, ui)
  @cloudstack_compute = cloudstack_compute
  @ui                 = ui
end

Instance Method Details

#sync_resource(resource, api_parameters = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-cloudstack/service/cloudstack_resource_service.rb', line 10

def sync_resource(resource, api_parameters = {})
  @resource_details = nil
  if resource.id.nil? and resource.name
    resource.id = name_to_id(resource.name, resource.kind, api_parameters)
  elsif resource.id
    resource.name = id_to_name(resource.id, resource.kind, api_parameters)
  end

  unless resource.is_undefined?
    resource.details = @resource_details
    @ui.detail("Syncronized resource: #{resource}")
  end
end