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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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

#logoutObject

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.



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

def logout
  @vcloud.delete_logout
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.



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

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.



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

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.



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

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.



173
174
175
176
177
178
179
180
181
182
# File 'lib/vcloud/core/fog/service_interface.rb', line 173

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.



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

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.



166
167
168
169
170
171
# File 'lib/vcloud/core/fog/service_interface.rb', line 166

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



211
212
213
214
# File 'lib/vcloud/core/fog/service_interface.rb', line 211

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.



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

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.



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

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.



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

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.



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

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.



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

def vcloud_token
  @vcloud.vcloud_token
end