Class: Vcloud::Core::Fog::ServiceInterface::FogFacade Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vcloud/core/fog/service_interface.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

FogFacade Inner class to represent a logic free facade over our interactions with Fog

Instance Method Summary collapse

Constructor Details

#initializeFogFacade

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FogFacade.



27
28
29
# File 'lib/vcloud/core/fog/service_interface.rb', line 27

def initialize
  @vcloud = ::Fog::Compute::VcloudDirector.new
end

Instance Method Details

#delete_disk(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



134
135
136
137
# File 'lib/vcloud/core/fog/service_interface.rb', line 134

def delete_disk(id)
  task = @vcloud.delete_disk(id).body
  @vcloud.process_task(task)
end

#delete_network(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



125
126
127
128
# File 'lib/vcloud/core/fog/service_interface.rb', line 125

def delete_network(id)
  task = @vcloud.delete_network(id).body
  @vcloud.process_task(task)
end

#delete_vapp(vapp_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



116
117
118
119
# File 'lib/vcloud/core/fog/service_interface.rb', line 116

def delete_vapp(vapp_id)
  task = @vcloud.delete_vapp(vapp_id).body
  @vcloud.process_task(task)
end

#end_pointObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



85
86
87
# File 'lib/vcloud/core/fog/service_interface.rb', line 85

def end_point
  @vcloud.end_point
end

#get_disk(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



130
131
132
# File 'lib/vcloud/core/fog/service_interface.rb', line 130

def get_disk(id)
  @vcloud.get_disk(id).body
end

#get_edge_gateway(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



202
203
204
# File 'lib/vcloud/core/fog/service_interface.rb', line 202

def get_edge_gateway(id)
  @vcloud.get_edge_gateway(id).body
end

#get_execute_query(type = nil, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



94
95
96
# File 'lib/vcloud/core/fog/service_interface.rb', line 94

def get_execute_query(type=nil, options={})
  @vcloud.get_execute_query(type, options).body
end

#get_network_complete(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



121
122
123
# File 'lib/vcloud/core/fog/service_interface.rb', line 121

def get_network_complete(id)
  @vcloud.get_network_complete(id).body
end

#get_organization(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
# File 'lib/vcloud/core/fog/service_interface.rb', line 35

def get_organization (id)
  @vcloud.get_organization(id).body
end

#get_vapp(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



60
61
62
# File 'lib/vcloud/core/fog/service_interface.rb', line 60

def get_vapp(id)
  @vcloud.get_vapp(id).body
end

#get_vapp_metadata(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



98
99
100
# File 'lib/vcloud/core/fog/service_interface.rb', line 98

def (id)
  @vcloud.(id).body
end

#get_vapps_in_lease_from_query(options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
# File 'lib/vcloud/core/fog/service_interface.rb', line 43

def get_vapps_in_lease_from_query(options)
  @vcloud.get_vapps_in_lease_from_query(options).body
end

#get_vdc(id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/vcloud/core/fog/service_interface.rb', line 31

def get_vdc(id)
  @vcloud.get_vdc(id).body
end

#get_vms_disk_attached_to(disk_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



157
158
159
# File 'lib/vcloud/core/fog/service_interface.rb', line 157

def get_vms_disk_attached_to(disk_id)
  @vcloud.get_vms_disk_attached_to(disk_id).body
end

#org_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



107
108
109
# File 'lib/vcloud/core/fog/service_interface.rb', line 107

def org_name
  @vcloud.org_name
end

#organizationsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



103
104
105
# File 'lib/vcloud/core/fog/service_interface.rb', line 103

def organizations
  @vcloud.organizations
end

#post_attach_disk(vm_id, disk_id, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



147
148
149
150
# File 'lib/vcloud/core/fog/service_interface.rb', line 147

def post_attach_disk(vm_id, disk_id, options = {})
  task = @vcloud.post_attach_disk(vm_id, disk_id, options).body
  @vcloud.process_task(task)
end

#post_configure_edge_gateway_services(edgegw_id, config) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



168
169
170
171
172
173
174
175
176
177
# File 'lib/vcloud/core/fog/service_interface.rb', line 168

def post_configure_edge_gateway_services(edgegw_id, config)
  Vcloud::Core.logger.info("Updating EdgeGateway #{edgegw_id}")
  begin
    task = @vcloud.post_configure_edge_gateway_services(edgegw_id, config).body
    @vcloud.process_task(task)
  rescue => ex
    Vcloud::Core.logger.error("Could not update EdgeGateway #{edgegw_id} : #{ex}")
    raise
  end
end

#post_create_disk(vdc_id, disk_id, size_in_bytes, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



139
140
141
142
143
144
145
# File 'lib/vcloud/core/fog/service_interface.rb', line 139

def post_create_disk(vdc_id, disk_id, size_in_bytes, options = {})
  # Fog method is incorrectly named 'post_upload_disk', and will be fixed
  # in a future version to match our post_create_disk method name.
  attrs = @vcloud.post_upload_disk(vdc_id, disk_id, size_in_bytes, options).body
  @vcloud.process_task(attrs[:Tasks][:Task])
  get_disk(extract_id(attrs))
end

#post_create_org_vdc_network(vdc_id, name, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



161
162
163
164
165
166
# File 'lib/vcloud/core/fog/service_interface.rb', line 161

def post_create_org_vdc_network(vdc_id, name, options)
  Vcloud::Core.logger.debug("creating #{options[:fence_mode]} OrgVdcNetwork #{name} in vDC #{vdc_id}")
  attrs = @vcloud.post_create_org_vdc_network(vdc_id, name, options).body
  @vcloud.process_task(attrs[:Tasks][:Task])
  get_network_complete(extract_id(attrs))
end

#post_detach_disk(vm_id, disk_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



152
153
154
155
# File 'lib/vcloud/core/fog/service_interface.rb', line 152

def post_detach_disk(vm_id, disk_id)
  task = @vcloud.post_detach_disk(vm_id, disk_id).body
  @vcloud.process_task(task)
end

#post_instantiate_vapp_template(vdc, template, name, params) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
50
51
52
# File 'lib/vcloud/core/fog/service_interface.rb', line 47

def post_instantiate_vapp_template(vdc, template, name, params)
  Vcloud::Core.logger.debug("instantiating #{name} vapp in #{vdc[:name]}")
  vapp = @vcloud.post_instantiate_vapp_template(extract_id(vdc), template, name, params).body
  @vcloud.process_task(vapp[:Tasks][:Task])
  @vcloud.get_vapp(extract_id(vapp)).body
end

#post_undeploy_vapp(vapp_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



111
112
113
114
# File 'lib/vcloud/core/fog/service_interface.rb', line 111

def post_undeploy_vapp(vapp_id)
  task = @vcloud.post_undeploy_vapp(vapp_id).body
  @vcloud.process_task(task)
end

#power_off_vapp(vapp_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



179
180
181
182
# File 'lib/vcloud/core/fog/service_interface.rb', line 179

def power_off_vapp(vapp_id)
  task = @vcloud.post_power_off_vapp(vapp_id).body
  @vcloud.process_task(task)
end

#power_on_vapp(vapp_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



184
185
186
187
188
# File 'lib/vcloud/core/fog/service_interface.rb', line 184

def power_on_vapp(vapp_id)
  Vcloud::Core.logger.debug("Powering on vApp #{vapp_id}")
  task = @vcloud.post_power_on_vapp(vapp_id).body
  @vcloud.process_task(task)
end

#put_cpu(vm_id, cpu) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



69
70
71
72
73
# File 'lib/vcloud/core/fog/service_interface.rb', line 69

def put_cpu(vm_id, cpu)
  Vcloud::Core.logger.debug("putting #{cpu} CPU(s) into VM #{vm_id}")
  task = @vcloud.put_cpu(vm_id, cpu).body
  @vcloud.process_task(task)
end

#put_guest_customization_section_vapp(vm_id, customization_req) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



89
90
91
92
# File 'lib/vcloud/core/fog/service_interface.rb', line 89

def put_guest_customization_section_vapp(vm_id, customization_req)
  task = @vcloud.put_guest_customization_section_vapp(vm_id, customization_req).body
  @vcloud.process_task(task)
end

#put_memory(vm_id, memory) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
57
58
# File 'lib/vcloud/core/fog/service_interface.rb', line 54

def put_memory(vm_id, memory)
  Vcloud::Core.logger.debug("putting #{memory}MB memory into VM #{vm_id}")
  task = @vcloud.put_memory(vm_id, memory).body
  @vcloud.process_task(task)
end

#put_network_connection_system_section_vapp(vm_id, section) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



64
65
66
67
# File 'lib/vcloud/core/fog/service_interface.rb', line 64

def put_network_connection_system_section_vapp(vm_id, section)
  task = @vcloud.put_network_connection_system_section_vapp(vm_id, section).body
  @vcloud.process_task(task)
end

#put_product_sections(id, items) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



206
207
208
209
# File 'lib/vcloud/core/fog/service_interface.rb', line 206

def put_product_sections(id, items)
  task = @vcloud.put_product_sections(id, items).body
  @vcloud.process_task(task)
end

#put_vapp_metadata_value(id, k, v) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



195
196
197
198
199
200
# File 'lib/vcloud/core/fog/service_interface.rb', line 195

def (id, k, v)
  Vcloud::Core.logger.debug("putting metadata pair '#{k}'=>'#{v}' to #{id}")
  # need to convert key to_s since Fog 0.17 borks on symbol key
  task = @vcloud.(id, k.to_s, v).body
  @vcloud.process_task(task)
end

#put_vm(id, name, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



75
76
77
78
79
# File 'lib/vcloud/core/fog/service_interface.rb', line 75

def put_vm(id, name, options={})
  Vcloud::Core.logger.debug("updating name : #{name}, :options => #{options} in vm : #{id}")
  task = @vcloud.put_vm(id, name, options).body
  @vcloud.process_task(task)
end

#sessionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/vcloud/core/fog/service_interface.rb', line 39

def session
  @vcloud.get_current_session.body
end

#shutdown_vapp(vapp_id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



190
191
192
193
# File 'lib/vcloud/core/fog/service_interface.rb', line 190

def shutdown_vapp(vapp_id)
  task = @vcloud.post_shutdown_vapp(vapp_id).body
  @vcloud.process_task(task)
end

#vcloud_tokenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



81
82
83
# File 'lib/vcloud/core/fog/service_interface.rb', line 81

def vcloud_token
  @vcloud.vcloud_token
end