Class: Fog::Compute::VcloudDirector::Vapp

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

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #lazy_load_attrs, #make_attr_loaded_method, #make_lazy_load_method

Constructor Details

This class inherits a constructor from Fog::Compute::VcloudDirector::Model

Instance Method Details

#custom_fieldsObject


31
32
33
34
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 31

def custom_fields
  requires :id
  service.custom_fields( :vapp => self)
end

#destroyObject


131
132
133
134
135
136
137
138
139
140
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 131

def destroy
  requires :id
  begin
    response = service.delete_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#power_offObject

Power off all VMs in the vApp.


60
61
62
63
64
65
66
67
68
69
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 60

def power_off
  requires :id
  begin
    response = service.post_power_off_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#power_onObject

Power on all VMs in the vApp.


72
73
74
75
76
77
78
79
80
81
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 72

def power_on
  requires :id
  begin
    response = service.post_power_on_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#rebootObject

Reboot all VMs in the vApp.


84
85
86
87
88
89
90
91
92
93
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 84

def reboot
  requires :id
  begin
    response = service.post_reboot_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#resetObject

Reset all VMs in the vApp.


96
97
98
99
100
101
102
103
104
105
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 96

def reset
  requires :id
  begin
    response = service.post_reset_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#shutdownObject

Shut down all VMs in the vApp.


108
109
110
111
112
113
114
115
116
117
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 108

def shutdown
  requires :id
  begin
    response = service.post_shutdown_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#suspendObject

Suspend all VMs in the vApp.


120
121
122
123
124
125
126
127
128
129
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 120

def suspend
  requires :id
  begin
    response = service.post_suspend_vapp(id)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#tagsObject


26
27
28
29
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 26

def tags
  requires :id
  service.tags(:vm => self)
end

#undeploy(action = 'powerOff') ⇒ Object

  • powerOff (Power off the virtual machines. This is the default action if this attribute is missing or empty)

  • suspend (Suspend the virtual machines)

  • shutdown (Shut down the virtual machines)

  • force (Attempt to power off the virtual machines. Failures in undeploying the virtual machine or associated networks are ignored. All references to the vApp and its virtual machines are removed from the database)

  • default (Use the actions, order, and delay specified in the StartupSection)

Parameters:

  • action (String) (defaults to: 'powerOff')

    The specified action is applied to all virtual machines in the vApp. All values other than *default* ignore actions, order, and delay specified in the StartupSection. One of:


49
50
51
52
53
54
55
56
57
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 49

def undeploy(action='powerOff')
  begin
    response = service.post_undeploy_vapp(id, :UndeployPowerAction => action)
  rescue Fog::Compute::VcloudDirector::BadRequest => ex
    Fog::Logger.debug(ex.message)
    return false
  end
  service.process_task(response.body)
end

#vmsObject


21
22
23
24
# File 'lib/fog/vcloud_director/models/compute/vapp.rb', line 21

def vms
  requires :id
  service.vms(:vapp => self)
end