Class: VagrantPlugins::VCloud::Driver::Base
- Inherits:
-
Object
- Object
- VagrantPlugins::VCloud::Driver::Base
- Includes:
- Vagrant::Util::Retryable
- Defined in:
- lib/vagrant-vcloud/driver/base.rb
Overview
Main class to access vCloud rest APIs
Direct Known Subclasses
Instance Method Summary collapse
-
#compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = {}) ⇒ Object
Compose a vapp using existing virtual machines.
-
#create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_templateid, poweron = false) ⇒ Object
Create a vapp starting from a template.
-
#delete_vapp(vapp_id) ⇒ Object
Delete a given vapp NOTE: It doesn’t verify that the vapp is shutdown.
-
#get_catalog(catalog_id) ⇒ Object
Fetch details about a given catalog.
-
#get_catalog_by_name(organization, catalog_name) ⇒ Object
Friendly helper method to fetch an catalog by name - organization hash (from get_organization/get_organization_by_name) - catalog name.
-
#get_catalog_id_by_name(organization, catalog_name) ⇒ Object
Friendly helper method to fetch an catalog id by name - organization hash (from get_organization/get_organization_by_name) - catalog name.
-
#get_catalog_item(catalog_item_id) ⇒ Object
Fetch details about a given catalog item: - description - vApp templates.
-
#get_catalog_item_by_name(catalog_id, catalog_item_name) ⇒ Object
friendly helper method to fetch an catalogItem by name - catalogId (use get_catalog_name(org, name)) - catalagItemName.
-
#get_organization(org_id) ⇒ Object
Fetch details about an organization: - catalogs - vdcs - networks.
-
#get_organization_by_name(name) ⇒ Object
friendly helper method to fetch an Organization by name - name (this isn’t case sensitive).
-
#get_organization_id_by_name(name) ⇒ Object
friendly helper method to fetch an Organization Id by name - name (this isn’t case sensitive).
-
#get_organizations ⇒ Object
Fetch existing organizations and their IDs.
-
#get_task(task_id) ⇒ Object
Fetch information for a given task.
-
#get_vapp(vapp_id) ⇒ Object
Fetch details about a given vapp: - name - description - status - IP - Children VMs: – IP addresses – status – ID.
-
#get_vapp_edge_public_ip(vapp_id) ⇒ Object
get vApp edge public IP from the vApp ID Only works when: - vApp needs to be poweredOn - FenceMode is set to “natRouted” - NatType“ is set to ”portForwarding This will be required to know how to connect to VMs behind the Edge.
-
#get_vapp_port_forwarding_rules(vapp_id) ⇒ Object
Get vApp port forwarding rules.
-
#get_vapp_template(vapp_id) ⇒ Object
Fetch details about a given vapp template: - name - description - Children VMs: – ID.
-
#get_vdc(vdc_id) ⇒ Object
Fetch details about a given vdc: - description - vapps - networks.
-
#get_vdc_by_name(organization, vdc_name) ⇒ Object
Friendly helper method to fetch a Organization VDC by name - Organization object - Organization VDC Name.
-
#get_vdc_id_by_name(organization, vdc_name) ⇒ Object
Friendly helper method to fetch a Organization VDC Id by name - Organization object - Organization VDC Name.
-
#get_vm(vm_Id) ⇒ Object
Fetch details about a given VM.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#login ⇒ Object
Authenticate against the specified server.
-
#logout ⇒ Object
Destroy the current session.
-
#poweron_vapp(vapp_id) ⇒ Object
Boot a given vapp.
-
#reboot_vapp(vapp_id) ⇒ Object
reboot a given vapp This will basically initial a guest OS reboot, and will only work if VMware-tools are installed on the underlying VMs.
-
#reset_vapp(vapp_id) ⇒ Object
reset a given vapp This will basically reset the VMs within the vApp vShield Edge devices are not affected.
-
#set_vapp_network_config(vapp_id, network_name, config = {}) ⇒ Object
Set vApp Network Config.
-
#set_vapp_port_forwarding_rules(vapp_id, network_name, config = {}) ⇒ Object
Set vApp port forwarding rules.
-
#set_vm_guest_customization(vm_id, computer_name, config = {}) ⇒ Object
Set VM Guest Customization Config.
- #set_vm_hardware(vm_id, cfg) ⇒ Object
-
#set_vm_network_config(vm_id, network_name, config = {}) ⇒ Object
Set VM Network Config.
-
#suspend_vapp(vapp_id) ⇒ Object
Suspend a given vapp.
-
#upload_ovf(vdc_id, vapp_name, vapp_description, ovf_file, catalog_id, upload_options = {}) ⇒ Object
Upload an OVF package - vdcId - vappName - vappDescription - ovfFile - catalogId - uploadOptions {}.
-
#wait_task_completion(task_id) ⇒ Object
Poll a given task until completion.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
39 40 41 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 39 def initialize @logger = Log4r::Logger.new('vagrant::provider::vcloud::base') end |
Instance Method Details
#compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = {}) ⇒ Object
Compose a vapp using existing virtual machines
Params:
-
vdc: the associated VDC
-
vapp_name: name of the target vapp
-
vapp_description: description of the target vapp
-
vm_list: hash with IDs of the VMs used in the composing process
-
network_config: hash of the network configuration for the vapp
198 199 200 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 198 def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = {}) end |
#create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_templateid, poweron = false) ⇒ Object
Create a vapp starting from a template
Params:
-
vdc: the associated VDC
-
vapp_name: name of the target vapp
-
vapp_description: description of the target vapp
-
vapp_templateid: ID of the vapp template
185 186 187 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 185 def create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_templateid, poweron = false) end |
#delete_vapp(vapp_id) ⇒ Object
Delete a given vapp NOTE: It doesn’t verify that the vapp is shutdown
149 150 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 149 def delete_vapp(vapp_id) end |
#get_catalog(catalog_id) ⇒ Object
Fetch details about a given catalog
80 81 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 80 def get_catalog(catalog_id) end |
#get_catalog_by_name(organization, catalog_name) ⇒ Object
Friendly helper method to fetch an catalog by name
-
organization hash (from get_organization/get_organization_by_name)
-
catalog name
94 95 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 94 def get_catalog_by_name(organization, catalog_name) end |
#get_catalog_id_by_name(organization, catalog_name) ⇒ Object
Friendly helper method to fetch an catalog id by name
-
organization hash (from get_organization/get_organization_by_name)
-
catalog name
87 88 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 87 def get_catalog_id_by_name(organization, catalog_name) end |
#get_catalog_item(catalog_item_id) ⇒ Object
Fetch details about a given catalog item:
-
description
-
vApp templates
123 124 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 123 def get_catalog_item(catalog_item_id) end |
#get_catalog_item_by_name(catalog_id, catalog_item_name) ⇒ Object
friendly helper method to fetch an catalogItem by name
-
catalogId (use get_catalog_name(org, name))
-
catalagItemName
130 131 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 130 def get_catalog_item_by_name(catalog_id, catalog_item_name) end |
#get_organization(org_id) ⇒ Object
Fetch details about an organization:
-
catalogs
-
vdcs
-
networks
75 76 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 75 def get_organization(org_id) end |
#get_organization_by_name(name) ⇒ Object
friendly helper method to fetch an Organization by name
-
name (this isn’t case sensitive)
67 68 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 67 def get_organization_by_name(name) end |
#get_organization_id_by_name(name) ⇒ Object
friendly helper method to fetch an Organization Id by name
-
name (this isn’t case sensitive)
61 62 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 61 def get_organization_id_by_name(name) end |
#get_organizations ⇒ Object
Fetch existing organizations and their IDs
55 56 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 55 def get_organizations end |
#get_task(task_id) ⇒ Object
Fetch information for a given task
254 255 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 254 def get_task(task_id) end |
#get_vapp(vapp_id) ⇒ Object
Fetch details about a given vapp:
-
name
-
description
-
status
-
IP
-
Children VMs: – IP addresses – status – ID
143 144 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 143 def get_vapp(vapp_id) end |
#get_vapp_edge_public_ip(vapp_id) ⇒ Object
get vApp edge public IP from the vApp ID Only works when:
-
vApp needs to be poweredOn
-
FenceMode is set to “natRouted”
-
NatType“ is set to ”portForwarding
This will be required to know how to connect to VMs behind the Edge.
234 235 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 234 def get_vapp_edge_public_ip(vapp_id) end |
#get_vapp_port_forwarding_rules(vapp_id) ⇒ Object
Get vApp port forwarding rules
-
vappid: id of the vApp
224 225 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 224 def get_vapp_port_forwarding_rules(vapp_id) end |
#get_vapp_template(vapp_id) ⇒ Object
Fetch details about a given vapp template:
-
name
-
description
-
Children VMs: – ID
207 208 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 207 def get_vapp_template(vapp_id) end |
#get_vdc(vdc_id) ⇒ Object
Fetch details about a given vdc:
-
description
-
vapps
-
networks
102 103 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 102 def get_vdc(vdc_id) end |
#get_vdc_by_name(organization, vdc_name) ⇒ Object
Friendly helper method to fetch a Organization VDC by name
-
Organization object
-
Organization VDC Name
116 117 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 116 def get_vdc_by_name(organization, vdc_name) end |
#get_vdc_id_by_name(organization, vdc_name) ⇒ Object
Friendly helper method to fetch a Organization VDC Id by name
-
Organization object
-
Organization VDC Name
109 110 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 109 def get_vdc_id_by_name(organization, vdc_name) end |
#get_vm(vm_Id) ⇒ Object
Fetch details about a given VM
279 280 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 279 def get_vm(vm_Id) end |
#login ⇒ Object
Authenticate against the specified server
45 46 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 45 def login end |
#logout ⇒ Object
Destroy the current session
50 51 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 50 def logout end |
#poweron_vapp(vapp_id) ⇒ Object
Boot a given vapp
174 175 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 174 def poweron_vapp(vapp_id) end |
#reboot_vapp(vapp_id) ⇒ Object
reboot a given vapp This will basically initial a guest OS reboot, and will only work if VMware-tools are installed on the underlying VMs. vShield Edge devices are not affected
162 163 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 162 def reboot_vapp(vapp_id) end |
#reset_vapp(vapp_id) ⇒ Object
reset a given vapp This will basically reset the VMs within the vApp vShield Edge devices are not affected.
169 170 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 169 def reset_vapp(vapp_id) end |
#set_vapp_network_config(vapp_id, network_name, config = {}) ⇒ Object
Set vApp Network Config
264 265 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 264 def set_vapp_network_config(vapp_id, network_name, config = {}) end |
#set_vapp_port_forwarding_rules(vapp_id, network_name, config = {}) ⇒ Object
Set vApp port forwarding rules
-
vappid: id of the vapp to be modified
-
network_name: name of the vapp network to be modified
-
config: hash with network configuration specifications, must contain an array inside :nat_rules with the nat rules to be applied.
217 218 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 217 def set_vapp_port_forwarding_rules(vapp_id, network_name, config = {}) end |
#set_vm_guest_customization(vm_id, computer_name, config = {}) ⇒ Object
Set VM Guest Customization Config
274 275 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 274 def set_vm_guest_customization(vm_id, computer_name, config = {}) end |
#set_vm_hardware(vm_id, cfg) ⇒ Object
249 250 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 249 def set_vm_hardware(vm_id, cfg) end |
#set_vm_network_config(vm_id, network_name, config = {}) ⇒ Object
Set VM Network Config
269 270 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 269 def set_vm_network_config(vm_id, network_name, config = {}) end |
#suspend_vapp(vapp_id) ⇒ Object
Suspend a given vapp
154 155 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 154 def suspend_vapp(vapp_id) end |
#upload_ovf(vdc_id, vapp_name, vapp_description, ovf_file, catalog_id, upload_options = {}) ⇒ Object
Upload an OVF package
-
vdcId
-
vappName
-
vappDescription
-
ovfFile
-
catalogId
-
uploadOptions {}
245 246 247 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 245 def upload_ovf(vdc_id, vapp_name, vapp_description, ovf_file, catalog_id, = {}) end |
#wait_task_completion(task_id) ⇒ Object
Poll a given task until completion
259 260 |
# File 'lib/vagrant-vcloud/driver/base.rb', line 259 def wait_task_completion(task_id) end |