1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Rename Vcloudng to VcloudDirector

This commit is contained in:
Rodrigo Estebanez 2013-08-27 11:19:54 +02:00
parent 30adc65597
commit 063678f840
86 changed files with 274 additions and 284 deletions

View file

@ -37,7 +37,7 @@ require 'fog/serverlove'
require 'fog/storm_on_demand'
require 'fog/terremark'
require 'fog/vcloud'
require 'fog/vcloudng'
require 'fog/vcloud_director'
require 'fog/vmfusion'
require 'fog/vsphere'
require 'fog/voxel'

View file

@ -38,9 +38,9 @@ module Fog
when :vcloud
require 'fog/vcloud/compute'
Fog::Vcloud::Compute.new(attributes)
when :vcloudng
require 'fog/vcloudng/compute'
Fog::Vcloudng::Compute.new(attributes)
when :vcloud_director
require 'fog/vcloud_director/compute'
Fog::VcloudDirector::Compute.new(attributes)
else
if self.providers.include?(provider)
require "fog/#{provider}/compute"

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'vcloudng/compute', 'Compute')
service(:compute, 'vcloud_director/compute', 'Compute')
end
end

View file

@ -1,8 +1,8 @@
require 'fog/vcloudng'
require 'fog/vcloud_director'
require 'fog/compute'
require 'fog/vcloudng/requests/compute/helper'
require 'fog/vcloud_director/requests/compute/helper'
class VcloudngParser < Fog::Parsers::Base
class VcloudDirectorParser < Fog::Parsers::Base
def extract_attributes(attributes_xml)
attributes = {}
@ -28,7 +28,7 @@ end
module Fog
module Compute
class Vcloudng < Fog::Service
class VcloudDirector < Fog::Service
module Defaults
PATH = '/api'
@ -42,15 +42,15 @@ module Fog
end
requires :vcloudng_username, :vcloudng_password, :vcloudng_host
requires :vcloud_director_username, :vcloud_director_password, :vcloud_director_host
secrets :vcloudng_password
secrets :vcloud_director_password
model_path 'fog/vcloudng/models/compute'
model :organization
collection :organizations
model_path 'fog/vcloud_director/models/compute'
model :catalog
collection :catalogs
model :organization
collection :organizations
model :catalog_item
collection :catalog_items
model :vdc
@ -72,7 +72,8 @@ module Fog
model :tag # this is called metadata in vcloud
collection :tags
request_path 'fog/vcloudng/requests/compute'
request_path 'fog/vcloud_director/requests/compute'
request :get_organizations
request :get_organization
request :get_catalog
@ -176,14 +177,14 @@ module Fog
attr_reader :end_point
def initialize(options={})
@vcloudng_password = options[:vcloudng_password]
@vcloudng_username = options[:vcloudng_username]
@vcloud_director_password = options[:vcloud_director_password]
@vcloud_director_username = options[:vcloud_director_username]
@connection_options = options[:connection_options] || {}
@host = options[:vcloudng_host]
@path = options[:path] || Fog::Compute::Vcloudng::Defaults::PATH
@host = options[:vcloud_director_host]
@path = options[:path] || Fog::Compute::VcloudDirector::Defaults::PATH
@persistent = options[:persistent] || false
@port = options[:port] || Fog::Compute::Vcloudng::Defaults::PORT
@scheme = options[:scheme] || Fog::Compute::Vcloudng::Defaults::SCHEME
@port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT
@scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
@end_point = "#{@scheme}://#{@host}#{@path}/"
end
@ -191,7 +192,7 @@ module Fog
def auth_token
response = @connection.request({
:expects => 200,
:headers => { 'Authorization' => "Basic #{Base64.encode64("#{@vcloudng_username}:#{@vcloudng_password}").delete("\r\n")}",
:headers => { 'Authorization' => "Basic #{Base64.encode64("#{@vcloud_director_username}:#{@vcloud_director_password}").delete("\r\n")}",
'Accept' => 'application/*+xml;version=1.5'
},
:host => @host,

View file

@ -2,7 +2,7 @@
### Introduction
Collection and Model representation in vcloudng fog provider
Collection and Model representation in vcloud_director fog provider
```
Organizations
@ -52,7 +52,7 @@ Lazy load isn't used with ```get``` and ```get_by_name``` methods are used
```ruby
vcloud = Fog::Compute::Vcloudng.new(vcloudng_username: "<username>@org_name_", vcloudng_password: "<password>", vcloudng_host: 'example.com', :connection_options => {:ssl_verify_peer => false, :connect_timeout => 200, :read_timeout => 200 } )
vcloud = Fog::Compute::VcloudDirector.new(vcloud_director_username: "<username>@org_name_", vcloud_director_password: "<password>", vcloud_director_host: 'example.com', :connection_options => {:ssl_verify_peer => false, :connect_timeout => 200, :read_timeout => 200 } )
```
### Organizations
@ -66,9 +66,9 @@ Note that when listing, by default all the attrs but **id, name, type** and **hr
vcloud.organizations
```
```
<Fog::Compute::Vcloudng::Organizations
<Fog::Compute::VcloudDirector::Organizations
[
<Fog::Compute::Vcloudng::Organization
<Fog::Compute::VcloudDirector::Organization
id="c6a4c623-c158-41cf-a87a-dbc1637ad55a",
name="DevOps",
type="application/vnd.vmware.vcloud.org+xml",
@ -101,8 +101,8 @@ org = vcloud.organizations.first
org.vdcs
```
```ruby
<Fog::Compute::Vcloudng::Vdcs
organization= <Fog::Compute::Vcloudng::Organization
<Fog::Compute::VcloudDirector::Vdcs
organization= <Fog::Compute::VcloudDirector::Organization
id="c6a4c623-c158-41cf-a87a-dbc1637ad55a",
name="DevOps",
type="application/vnd.vmware.vcloud.org+xml",
@ -110,7 +110,7 @@ org.vdcs
description=NonLoaded
>
[
<Fog::Compute::Vcloudng::Vdc
<Fog::Compute::VcloudDirector::Vdc
id="9a06a16b-12c6-44dc-aee1-06aa52262ea3",
name="DevOps - VDC",
type="application/vnd.vmware.vcloud.vdc+xml",
@ -138,7 +138,7 @@ org = vcloud.organizations.first
org.vdcs.get_by_name("DevOps - VDC")
```
```ruby
<Fog::Compute::Vcloudng::Vdc
<Fog::Compute::VcloudDirector::Vdc
id="9a06a16b-12c6-44dc-aee1-06aa52262ea3",
name="DevOps - VDC",
type="application/vnd.vmware.vcloud.vdc+xml",
@ -168,8 +168,8 @@ vdc = org.vdcs.first
vdc.vapps
```
```ruby
<Fog::Compute::Vcloudng::Vapps
vdc= <Fog::Compute::Vcloudng::Vdc
<Fog::Compute::VcloudDirector::Vapps
vdc= <Fog::Compute::VcloudDirector::Vdc
id="9a06a16b-12c6-44dc-aee1-06aa52262ea3",
name="DevOps - VDC",
type="application/vnd.vmware.vcloud.vdc+xml",
@ -187,7 +187,7 @@ vdc.vapps
is_enabled=NonLoaded
>
[
<Fog::Compute::Vcloudng::Vapp
<Fog::Compute::VcloudDirector::Vapp
id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="segundo",
type="application/vnd.vmware.vcloud.vApp+xml",
@ -203,7 +203,7 @@ vdc.vapps
owner=NonLoaded,
InMaintenanceMode=NonLoaded
>,
<Fog::Compute::Vcloudng::Vapp
<Fog::Compute::VcloudDirector::Vapp
id="vapp-6ac43e0e-13e2-4642-a58a-6dc3a12f585b",
name="vApp_restebanez_9",
type="application/vnd.vmware.vcloud.vApp+xml",
@ -230,7 +230,7 @@ vdc = org.vdcs.first
vdc.vapps.get_by_name("segundo")
```
```ruby
<Fog::Compute::Vcloudng::Vapp
<Fog::Compute::VcloudDirector::Vapp
id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="segundo",
type="application/vnd.vmware.vcloud.vApp+xml",
@ -262,8 +262,8 @@ vapp = vdc.vapps.get_by_name("segundo")
vapp.vms
```
```ruby
<Fog::Compute::Vcloudng::Vms
vapp= <Fog::Compute::Vcloudng::Vapp
<Fog::Compute::VcloudDirector::Vms
vapp= <Fog::Compute::VcloudDirector::Vapp
id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="segundo",
type="application/vnd.vmware.vcloud.vApp+xml",
@ -280,7 +280,7 @@ vapp.vms
InMaintenanceMode=false
>
[
<Fog::Compute::Vcloudng::Vm
<Fog::Compute::VcloudDirector::Vm
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
vapp_id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="DEVWEB",
@ -307,7 +307,7 @@ vapp = vdc.vapps.get_by_name("segundo")
vapp.vms.get_by_name("DEVWEB")
```
```ruby
<Fog::Compute::Vcloudng::Vm
<Fog::Compute::VcloudDirector::Vm
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
vapp_id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="DEVWEB",
@ -380,7 +380,7 @@ vm = vapp.vms.get_by_name("DEVWEB")
vm.customization
```
```ruby
<Fog::Compute::Vcloudng::VmCustomization
<Fog::Compute::VcloudDirector::VmCustomization
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
type="application/vnd.vmware.vcloud.guestCustomizationSection+xml",
href="https://example.com/api/vApp/vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192/guestCustomizationSection/",
@ -431,7 +431,7 @@ vm = vapp.vms.get_by_name("DEVWEB")
vm.network
```
```ruby
<Fog::Compute::Vcloudng::VmNetwork
<Fog::Compute::VcloudDirector::VmNetwork
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
type="application/vnd.vmware.vcloud.networkConnectionSection+xml",
href="https://example.com/api/vApp/vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192/networkConnectionSection/",
@ -482,8 +482,8 @@ vm = vapp.vms.get_by_name("DEVWEB")
vm.disks
```
```ruby
<Fog::Compute::Vcloudng::Disks
vm= <Fog::Compute::Vcloudng::Vm
<Fog::Compute::VcloudDirector::Disks
vm= <Fog::Compute::VcloudDirector::Vm
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
vapp_id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="DEVWEB",
@ -497,7 +497,7 @@ vm.disks
hard_disks=[{"Hard disk 1"=>163840}]
>
[
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=2,
address=0,
description="SCSI Controller",
@ -510,7 +510,7 @@ vm.disks
bus_sub_type=nil,
bus_type=nil
>,
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=2000,
address=nil,
description="Hard disk",
@ -523,7 +523,7 @@ vm.disks
bus_sub_type="lsilogicsas",
bus_type=6
>,
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=3,
address=0,
description="IDE Controller",
@ -558,8 +558,8 @@ true
The new disk should show up
```ruby
>> vm.disks
<Fog::Compute::Vcloudng::Disks
vm= <Fog::Compute::Vcloudng::Vm
<Fog::Compute::VcloudDirector::Disks
vm= <Fog::Compute::VcloudDirector::Vm
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
vapp_id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="DEVWEB",
@ -573,7 +573,7 @@ The new disk should show up
hard_disks=[{"Hard disk 1"=>163840}]
>
[
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=2,
address=0,
description="SCSI Controller",
@ -586,7 +586,7 @@ The new disk should show up
bus_sub_type=nil,
bus_type=nil
>,
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=2000,
address=nil,
description="Hard disk",
@ -599,7 +599,7 @@ The new disk should show up
bus_sub_type="lsilogicsas",
bus_type=6
>,
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=2001,
address=nil,
description="Hard disk",
@ -612,7 +612,7 @@ The new disk should show up
bus_sub_type="lsilogicsas",
bus_type=6
>,
<Fog::Compute::Vcloudng::Disk
<Fog::Compute::VcloudDirector::Disk
id=3,
address=0,
description="IDE Controller",
@ -676,8 +676,8 @@ vm = vapp.vms.get_by_name("DEVWEB")
vm.tags
```
```ruby
<Fog::Compute::Vcloudng::Tags
vm= <Fog::Compute::Vcloudng::Vm
<Fog::Compute::VcloudDirector::Tags
vm= <Fog::Compute::VcloudDirector::Vm
id="vm-2ddeea36-ac71-470f-abc5-c6e3c2aca192",
vapp_id="vapp-11c7102f-443d-40fd-b1da-cca981fb44b6",
name="DEVWEB",
@ -691,19 +691,19 @@ vm.tags
hard_disks=[{"Hard disk 1"=>163840}]
>
[
<Fog::Compute::Vcloudng::Tag
<Fog::Compute::VcloudDirector::Tag
id="environment",
value="devlab"
>,
<Fog::Compute::Vcloudng::Tag
<Fog::Compute::VcloudDirector::Tag
id="product",
value="devlabtest"
>,
<Fog::Compute::Vcloudng::Tag
<Fog::Compute::VcloudDirector::Tag
id="hello",
value="ddd"
>,
<Fog::Compute::Vcloudng::Tag
<Fog::Compute::VcloudDirector::Tag
id="uno",
value="jander"
>
@ -738,7 +738,7 @@ vm = vapp.vms.get_by_name("DEVWEB")
vm.tags.get_by_name('this_is_a_key')
```
```ruby
<Fog::Compute::Vcloudng::Tag
<Fog::Compute::VcloudDirector::Tag
id="this_is_a_key",
value="this_is_a_value"
>
@ -784,8 +784,8 @@ org = vcloud.organizations.first
org.networks
```
```ruby
<Fog::Compute::Vcloudng::Networks
organization= <Fog::Compute::Vcloudng::Organization
<Fog::Compute::VcloudDirector::Networks
organization= <Fog::Compute::VcloudDirector::Organization
id="c6a4c623-c158-41cf-a87a-dbc1637ad55a",
name="DevOps",
type="application/vnd.vmware.vcloud.org+xml",
@ -793,7 +793,7 @@ org.networks
description=NonLoaded
>
[
<Fog::Compute::Vcloudng::Network
<Fog::Compute::VcloudDirector::Network
id="d5f47bbf-de27-4cf5-aaaa-56772f2ccd17",
name="DevOps - Dev Network Connection",
type="application/vnd.vmware.vcloud.orgNetwork+xml",
@ -817,7 +817,7 @@ org = vcloud.organizations.first
org.networks.get_by_name("DevOps - Dev Network Connection")
```
```ruby
<Fog::Compute::Vcloudng::Network
<Fog::Compute::VcloudDirector::Network
id="d5f47bbf-de27-4cf5-aaaa-56772f2ccd17",
name="DevOps - Dev Network Connection",
type="application/vnd.vmware.vcloud.orgNetwork+xml",
@ -843,8 +843,8 @@ it shows the Organization's Catalogs
org = vcloud.organizations.first
```
```ruby
<Fog::Compute::Vcloudng::Catalogs
organization= <Fog::Compute::Vcloudng::Organization
<Fog::Compute::VcloudDirector::Catalogs
organization= <Fog::Compute::VcloudDirector::Organization
id="c6a4c623-c158-41cf-a87a-dbc1637ad55a",
name="DevOps",
type="application/vnd.vmware.vcloud.org+xml",
@ -852,7 +852,7 @@ org = vcloud.organizations.first
description=NonLoaded
>
[
<Fog::Compute::Vcloudng::Catalog
<Fog::Compute::VcloudDirector::Catalog
id="4ee720e5-173a-41ac-824b-6f4908bac975",
name="Public VM Templates",
type="application/vnd.vmware.vcloud.catalog+xml",
@ -860,7 +860,7 @@ org = vcloud.organizations.first
description=NonLoaded,
is_published=NonLoaded
>,
<Fog::Compute::Vcloudng::Catalog
<Fog::Compute::VcloudDirector::Catalog
id="ea0c6acf-c9c0-46b7-b19f-4b2d3bf8aa33",
name="prueba",
type="application/vnd.vmware.vcloud.catalog+xml",
@ -879,7 +879,7 @@ org = vcloud.organizations.first
org.catalogs.get("4ee720e5-173a-41ac-824b-6f4908bac975") # or get_by_name("Public VM Templates")
```
```ruby
<Fog::Compute::Vcloudng::Catalog
<Fog::Compute::VcloudDirector::Catalog
id="4ee720e5-173a-41ac-824b-6f4908bac975",
name="Public VM Templates",
type="application/vnd.vmware.vcloud.catalog+xml",
@ -900,8 +900,8 @@ catalog = org.catalogs.first
catalog.catalog_items
```
```ruby
<Fog::Compute::Vcloudng::CatalogItems
catalog= <Fog::Compute::Vcloudng::Catalog
<Fog::Compute::VcloudDirector::CatalogItems
catalog= <Fog::Compute::VcloudDirector::Catalog
id="4ee720e5-173a-41ac-824b-6f4908bac975",
name="Public VM Templates",
type="application/vnd.vmware.vcloud.catalog+xml",
@ -910,7 +910,7 @@ catalog.catalog_items
is_published=NonLoaded
>
[
<Fog::Compute::Vcloudng::CatalogItem
<Fog::Compute::VcloudDirector::CatalogItem
id="2bd55629-2734-420c-9068-2ff06a4a8028",
name="DEVWIN",
type="application/vnd.vmware.vcloud.catalogItem+xml",
@ -918,7 +918,7 @@ catalog.catalog_items
description=NonLoaded,
vapp_template_id=NonLoaded
>,
<Fog::Compute::Vcloudng::CatalogItem
<Fog::Compute::VcloudDirector::CatalogItem
id="5437aa3f-e369-40b2-b985-2e63e1bc9f2e",
name="DEVRHL",
type="application/vnd.vmware.vcloud.catalogItem+xml",
@ -926,7 +926,7 @@ catalog.catalog_items
description=NonLoaded,
vapp_template_id=NonLoaded
>,
<Fog::Compute::Vcloudng::CatalogItem
<Fog::Compute::VcloudDirector::CatalogItem
id="54cf5deb-326f-4770-a91a-39048689b6ea",
name="DEVAPP",
type="application/vnd.vmware.vcloud.catalogItem+xml",
@ -945,7 +945,7 @@ catalog = org.catalogs.first
catalog.catalog_items.get_by_name('DEVAPP')
```
```ruby
<Fog::Compute::Vcloudng::CatalogItem
<Fog::Compute::VcloudDirector::CatalogItem
id="54cf5deb-326f-4770-a91a-39048689b6ea",
name="DEVAPP",
type="application/vnd.vmware.vcloud.catalogItem+xml",

View file

@ -40,7 +40,7 @@
module Fog
module Generators
module Compute
module Vcloudng
module VcloudDirector
class Customization

View file

@ -54,7 +54,7 @@
module Fog
module Generators
module Compute
module Vcloudng
module VcloudDirector
class Disks

View file

@ -20,7 +20,7 @@
module Fog
module Generators
module Compute
module Vcloudng
module VcloudDirector
class Metadata

View file

@ -32,7 +32,7 @@
module Fog
module Generators
module Compute
module Vcloudng
module VcloudDirector
class VmNetwork

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Catalog < Model

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class CatalogItem < Model

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/catalog_item'
require 'fog/vcloud_director/models/compute/catalog_item'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class CatalogItems < Collection
model Fog::Compute::Vcloudng::CatalogItem
model Fog::Compute::VcloudDirector::CatalogItem
attribute :catalog

View file

@ -1,12 +1,14 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/catalog'
require 'fog/vcloud_director/models/compute/catalog'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Catalogs < Collection
model Fog::Compute::Vcloudng::Catalog
model Fog::Compute::VcloudDirector::Catalog
attribute :organization

View file

@ -2,9 +2,9 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Disk < Fog::Model # there is no lazy_load in disks
class Disk < Model # there is no lazy_load in disks
identity :id
@ -25,7 +25,7 @@ module Fog
not_first_set = !capacity.nil?
attributes[:capacity] = new_capacity.to_i
if not_first_set && has_changed
data = Fog::Generators::Compute::Vcloudng::Disks.new(all_disks)
data = Fog::Generators::Compute::VcloudDirector::Disks.new(all_disks)
num_disk = name.scan(/\d+/).first.to_i
data.modify_hard_disk_size(num_disk, new_capacity)
response = service.put_vm_disks(attributes[:vm].id, data.disks)
@ -39,7 +39,7 @@ module Fog
def destroy
num_disk = name.scan(/\d+/).first.to_i
data = Fog::Generators::Compute::Vcloudng::Disks.new(all_disks)
data = Fog::Generators::Compute::VcloudDirector::Disks.new(all_disks)
data.delete_hard_disk(num_disk)
response = service.put_vm_disks(attributes[:vm].id, data.disks)
service.process_task(response.body)

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/disk'
require 'fog/vcloud_director/models/compute/disk'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Disks < Collection
model Fog::Compute::Vcloudng::Disk
model Fog::Compute::VcloudDirector::Disk
attribute :vm
@ -32,7 +32,7 @@ module Fog
def create(size)
item_list unless @disks
data = Fog::Generators::Compute::Vcloudng::Disks.new(@disks)
data = Fog::Generators::Compute::VcloudDirector::Disks.new(@disks)
puts data
puts data.disks
data.add_hard_disk(size)

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Network < Model

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/network'
require 'fog/vcloud_director/models/compute/network'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Networks < Collection
model Fog::Compute::Vcloudng::Network
model Fog::Compute::VcloudDirector::Network
attribute :organization

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Organization < Model

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/organization'
require 'fog/vcloud_director/models/compute/organization'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Organizations < Collection
model Fog::Compute::Vcloudng::Organization
model Fog::Compute::VcloudDirector::Organization
private

View file

@ -2,9 +2,9 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Tag < Fog::Model
class Tag < Model
identity :id

View file

@ -1,35 +1,22 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/tag'
require 'fog/vcloud_director/models/compute/tag'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Tags < Collection
model Fog::Compute::Vcloudng::Tag
model Fog::Compute::VcloudDirector::Tag
attribute :vm
# def index
# tags.keys.map{ |key| new({key: key, value: tags[key] }.merge(vm: vm)) }
# end
#
# def all
# index
# end
#
# def get(tag_id)
# return nil unless tags[tag_id]
# new({key: tag_id, value: tags[tag_id] }.merge(vm: vm))
# end
def get_by_name(tag_name)
get(tag_name)
end
def create(key,value)
item_list unless @tags
data = Fog::Generators::Compute::Vcloudng::Metadata.new(@tags)
data = Fog::Generators::Compute::VcloudDirector::Metadata.new(@tags)
data.add_item(key, value)
response = service.post_vm_metadata(vm.id, data.attrs)
service.process_task(response.body)

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Task < Fog::Model

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/task'
require 'fog/vcloud_director/models/compute/task'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Tasks < Fog::Collection
model Fog::Compute::Vcloudng::Task
class Tasks < Collection
model Fog::Compute::VcloudDirector::Task

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Vapp < Model

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/vapp'
require 'fog/vcloud_director/models/compute/vapp'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Vapps < Collection
model Fog::Compute::Vcloudng::Vapp
model Fog::Compute::VcloudDirector::Vapp
attribute :vdc

View file

@ -2,7 +2,7 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Vdc < Model

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/vdc'
require 'fog/vcloud_director/models/compute/vdc'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Vdcs < Collection
model Fog::Compute::Vcloudng::Vdc
model Fog::Compute::VcloudDirector::Vdc
attribute :organization

View file

@ -1,10 +1,10 @@
require 'fog/core/model'
require 'fog/vcloudng/models/compute/vm_customization'
require 'fog/vcloud_director/models/compute/vm_customization'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Vm < Model
identity :id

View file

@ -2,9 +2,9 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class VmCustomization < Fog::Model
class VmCustomization < Model
identity :id

View file

@ -0,0 +1,17 @@
require 'fog/core/collection'
require 'fog/vcloud_director/models/compute/vm_customization'
module Fog
module Compute
class VcloudDirector
class VmCustomizations < Collection
model Fog::Compute::VcloudDirector::VmCustomization
attribute :vm
end
end
end
end

View file

@ -2,9 +2,9 @@ require 'fog/core/model'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class VmNetwork < Fog::Model
class VmNetwork < Model
identity :id

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/vm_network'
require 'fog/vcloud_director/models/compute/vm_network'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class VmNetworks < Fog::Collection
model Fog::Compute::Vcloudng::VmNetwork
class VmNetworks < Collection
model Fog::Compute::VcloudDirector::VmNetwork
attribute :vm

View file

@ -1,12 +1,12 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/vm'
require 'fog/vcloud_director/models/compute/vm'
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Vms < Collection
model Fog::Compute::Vcloudng::Vm
model Fog::Compute::VcloudDirector::Vm
attribute :vapp

View file

@ -1,11 +1,11 @@
module Fog
module Parsers
module Compute
module Vcloudng
module VcloudDirector
class Disks < VcloudngParser
class Disks < VcloudDirectorParser
def reset
@disk = {}

View file

@ -28,9 +28,9 @@
module Fog
module Parsers
module Compute
module Vcloudng
module VcloudDirector
class Metadata < VcloudngParser
class Metadata < VcloudDirectorParser
def reset
@response = { :metadata => {} }

View file

@ -61,9 +61,9 @@
module Fog
module Parsers
module Compute
module Vcloudng
module VcloudDirector
class Network < VcloudngParser
class Network < VcloudDirectorParser
def reset
@response = { :ip_ranges => [] }

View file

@ -1,11 +1,11 @@
module Fog
module Parsers
module Compute
module Vcloudng
module VcloudDirector
class Vm < VcloudngParser
class Vm < VcloudDirectorParser
def reset
@vm = { :ip_address => '' }

View file

@ -1,9 +1,9 @@
module Fog
module Parsers
module Compute
module Vcloudng
module VcloudDirector
class VmCustomization < VcloudngParser
class VmCustomization < VcloudDirectorParser
def reset
@response = { }

View file

@ -61,9 +61,9 @@
module Fog
module Parsers
module Compute
module Vcloudng
module VcloudDirector
class VmNetwork < VcloudngParser
class VmNetwork < VcloudDirectorParser
def reset
@response = { }

View file

@ -1,10 +1,10 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def delete_metadata(vm_id, metadata_key)
require 'fog/vcloudng/parsers/compute/metadata'
require 'fog/vcloud_director/parsers/compute/metadata'
request(
:expects => 202,

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_catalog(catalog_uuid)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_catalog_item(catalog_item_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_href(href)

View file

@ -1,16 +1,16 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_metadata(vm_id)
require 'fog/vcloudng/parsers/compute/metadata'
require 'fog/vcloud_director/parsers/compute/metadata'
request(
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::Metadata.new,
:parser => Fog::Parsers::Compute::VcloudDirector::Metadata.new,
:path => "vApp/#{vm_id}/metadata/"
)
end

View file

@ -1,15 +1,15 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/parsers/compute/network'
require 'fog/vcloud_director/parsers/compute/network'
def get_network(network_id)
request(
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::Network.new,
:parser => Fog::Parsers::Compute::VcloudDirector::Network.new,
:path => "network/#{network_id}"
)
end

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_organization(organization_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_request(uri)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_task(task_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_tasks_list(tasks_list_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_vapp(vapp_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_vapp_template(vapp_template_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_vdc(vdc_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_vm_cpu(vm_id)

View file

@ -1,15 +1,15 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/parsers/compute/vm_customization'
require 'fog/vcloud_director/parsers/compute/vm_customization'
def get_vm_customization(vm_id)
request(
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::VmCustomization.new,
:parser => Fog::Parsers::Compute::VcloudDirector::VmCustomization.new,
:path => "vApp/#{vm_id}/guestCustomizationSection"
)
end

View file

@ -1,8 +1,8 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/parsers/compute/disks'
require 'fog/vcloud_director/parsers/compute/disks'
def get_vm_disks(vm_id)
@ -10,7 +10,7 @@ module Fog
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::Disks.new,
:parser => Fog::Parsers::Compute::VcloudDirector::Disks.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/disks"
)
end

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_vm_memory(vm_id)

View file

@ -1,16 +1,16 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def get_vm_network(vm_id)
require 'fog/vcloudng/parsers/compute/vm_network'
require 'fog/vcloud_director/parsers/compute/vm_network'
request(
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::VmNetwork.new,
:parser => Fog::Parsers::Compute::VcloudDirector::VmNetwork.new,
:path => "vApp/#{vm_id}/networkConnectionSection/"
)
end

View file

@ -1,15 +1,15 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/parsers/compute/vm'
require 'fog/vcloud_director/parsers/compute/vm'
def get_vms(vapp_id)
request(
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Compute::Vcloudng::Vm.new,
:parser => Fog::Parsers::Compute::VcloudDirector::Vm.new,
:path => "vApp/#{vapp_id}"
)
end

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
#TODO move all the logic to a generator

View file

@ -1,13 +1,13 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/generators/compute/metadata'
require 'fog/vcloud_director/generators/compute/metadata'
def post_vm_metadata(vm_id, metadata={})
data = Fog::Generators::Compute::Vcloudng::Metadata.new(metadata)
data = Fog::Generators::Compute::VcloudDirector::Metadata.new(metadata)
request(
:body => data.generate_xml,

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def post_vm_poweron(vm_id)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def put_metadata_value(vm_id, metadata_key, metadata_value)

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def put_vm_cpu(vm_id, num_cpus)

View file

@ -1,11 +1,11 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/generators/compute/customization'
require 'fog/vcloud_director/generators/compute/customization'
def put_vm_customization(vm_id, customization={})
data = Fog::Generators::Compute::Vcloudng::Customization.new(customization)
data = Fog::Generators::Compute::VcloudDirector::Customization.new(customization)
request(
:body => data.generate_xml,

View file

@ -1,12 +1,12 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
require 'fog/vcloudng/generators/compute/disks'
require 'fog/vcloud_director/generators/compute/disks'
# disks is the body of get_vm_disks
def put_vm_disks(vm_id, disks=[])
data = Fog::Generators::Compute::Vcloudng::Disks.new(disks)
data = Fog::Generators::Compute::VcloudDirector::Disks.new(disks)
request(
:body => data.generate_xml,

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def put_vm_memory(vm_id, memory)

View file

@ -1,12 +1,12 @@
module Fog
module Compute
class Vcloudng
class VcloudDirector
class Real
def put_vm_network(vm_id, network={})
require 'fog/vcloudng/generators/compute/vm_network'
require 'fog/vcloud_director/generators/compute/vm_network'
data = Fog::Generators::Compute::Vcloudng::VmNetwork.new(network)
data = Fog::Generators::Compute::VcloudDirector::VmNetwork.new(network)
request(
:body => data.generate_xml,

View file

@ -1,17 +0,0 @@
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/vm_customization'
module Fog
module Compute
class Vcloudng
class VmCustomizations < Fog::Collection
model Fog::Compute::Vcloudng::VmCustomization
attribute :vm
end
end
end
end

View file

@ -2,39 +2,39 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | catalog_items", ['all']) do
Shindo.tests("Compute::VcloudDirector | catalog_items", ['all']) do
pending if Fog.mocking?
tests("#There is more than one catalog").returns(true){ catalog.catalog_items.size >= 1 }
catalog_items = catalog.catalog_items
catalog_item = catalog_items.first
tests("Compute::Vcloudng | catalog_item") do
tests("Compute::VcloudDirector | catalog_item") do
tests("#id").returns(String){ catalog_item.id.class }
tests("#name").returns(String){ catalog_item.name.class }
tests("#href").returns(String){ catalog_item.href.class }
tests("#type").returns("application/vnd.vmware.vcloud.catalogItem+xml"){ catalog_item.type }
end
tests("Compute::Vcloudng | catalog_item", ['lazy load attrs']) do
tests("Compute::VcloudDirector | catalog_item", ['lazy load attrs']) do
catalog_item.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { catalog_item.attributes[lazy_attr] }
end
end
tests("Compute::Vcloudng | catalog_item", ['load on demand']) do
tests("Compute::VcloudDirector | catalog_item", ['load on demand']) do
tests("#description is not loaded yet").returns(NonLoaded) { catalog_item.attributes[:description] }
tests("#description is loaded on demand").returns(String) { catalog_item.description.class }
tests("#description is now loaded").returns(true) { catalog_item.attributes[:description] != NonLoaded }
end
tests("Compute::Vcloudng | catalog_item", ['lazy load attrs']) do
tests("Compute::VcloudDirector | catalog_item", ['lazy load attrs']) do
catalog.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is now loaded").returns(true) { catalog_item.attributes[lazy_attr] != NonLoaded }
end
end
tests("Compute::Vcloudng | catalog_item", ['get']) do
tests("Compute::VcloudDirector | catalog_item", ['get']) do
tests("#get_by_name").returns(catalog_item.name) { catalog_items.get_by_name(catalog_item.name).name }
tests("#get").returns(catalog_item.id) { catalog_items.get(catalog_item.id).id }
end

View file

@ -2,39 +2,39 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | catalogs", ['all']) do
Shindo.tests("Compute::VcloudDirector | catalogs", ['all']) do
pending if Fog.mocking?
tests("#There is one or more catalog").returns(true){ organization.catalogs.size >= 1 }
catalogs = organization.catalogs
catalog = catalogs.first
tests("Compute::Vcloudng | catalog") do
tests("Compute::VcloudDirector | catalog") do
tests("#id").returns(String){ catalog.id.class }
tests("#name").returns(String){ catalog.name.class }
tests("#href").returns(String){ catalog.href.class }
tests("#type").returns("application/vnd.vmware.vcloud.catalog+xml"){ catalog.type }
end
tests("Compute::Vcloudng | catalog", ['lazy load attrs']) do
tests("Compute::VcloudDirector | catalog", ['lazy load attrs']) do
catalog.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { catalog.attributes[lazy_attr] }
end
end
tests("Compute::Vcloudng | catalog", ['load on demand']) do
tests("Compute::VcloudDirector | catalog", ['load on demand']) do
tests("#description is not loaded yet").returns(NonLoaded) { catalog.attributes[:description] }
tests("#description is loaded on demand").returns(String) { catalog.description.class }
tests("#description is now loaded").returns(true) { catalog.attributes[:description] != NonLoaded }
end
tests("Compute::Vcloudng | catalog", ['lazy load attrs']) do
tests("Compute::VcloudDirector | catalog", ['lazy load attrs']) do
catalog.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is now loaded").returns(true) { catalog.attributes[lazy_attr] != NonLoaded }
end
end
tests("Compute::Vcloudng | catalog", ['get']) do
tests("Compute::VcloudDirector | catalog", ['get']) do
tests("#get_by_name").returns(catalog.name) { catalogs.get_by_name(catalog.name).name }
tests("#get").returns(catalog.id) { catalogs.get(catalog.id).id }
end

View file

@ -1,8 +1,8 @@
require 'vcr'
require 'fog/vcloudng/compute'
require 'fog/vcloud_director/compute'
VCR.configure do |c|
c.cassette_library_dir = 'tests/vcloudng/vcr_cassettes'
c.cassette_library_dir = 'tests/vcloud_director/vcr_cassettes'
c.hook_into :webmock
end
@ -10,10 +10,10 @@ def boolean?(item)
[TrueClass, FalseClass].include?(item.class)
end
def vcloudng
@vcloudng ||= Fog::Compute::Vcloudng.new(:vcloudng_username => "#{ENV['IMEDIDATA_COM_USERNAME']}@devops",
:vcloudng_password => ENV['IMEDIDATA_COM_PASSWORD'],
:vcloudng_host => 'devlab.mdsol.com',
def vcloud_director
@vcloud_director ||= Fog::Compute::VcloudDirector.new(:vcloud_director_username => "#{ENV['IMEDIDATA_COM_USERNAME']}@devops",
:vcloud_director_password => ENV['IMEDIDATA_COM_PASSWORD'],
:vcloud_director_host => 'devlab.mdsol.com',
:connection_options => {
:ssl_verify_peer => false,
:connect_timeout => 200,
@ -23,7 +23,7 @@ def vcloudng
end
def organizations
@organizations ||= vcloudng.organizations
@organizations ||= vcloud_director.organizations
end
def organization

View file

@ -2,19 +2,19 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | organizations", ['all']) do
Shindo.tests("Compute::VcloudDirector | organizations", ['all']) do
pending if Fog.mocking?
organizations = vcloudng.organizations
organizations = vcloud_director.organizations
tests("#There is one organization").returns(1){ organizations.size }
org = organizations.first
tests("Compute::Vcloudng | organization") do
tests("Compute::VcloudDirector | organization") do
tests("#name").returns("DevOps"){ org.name }
tests("#type").returns("application/vnd.vmware.vcloud.org+xml"){ org.type }
end
tests("Compute::Vcloudng | organization", ['get']) do
tests("Compute::VcloudDirector | organization", ['get']) do
tests("#get_by_name").returns(org.name) { organizations.get_by_name(org.name).name }
tests("#get").returns(org.id) { organizations.get(org.id).id }
end

View file

@ -11,15 +11,15 @@ TAGS = { :company => "acme", :environment => "testing" }
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | vapp", ['creation']) do
Shindo.tests("Compute::VcloudDirector | vapp", ['creation']) do
pending if Fog.mocking?
tests("#it creates a vApp from a catalog item").returns(true){ the_catalog_item.instantiate(VAPP_NAME, { :network_id => the_network.id, :network_name => NETWORK_NAME}) }
vapp = vapps.get_by_name(VAPP_NAME)
tests("#Finds the just created vApp").returns(VAPP_NAME) { vapp.name }
tests("#it has one vm").returns(1) { vapp.vms.size}
tests("Compute::Vcloudng | vm", ['configuration']) do
tests("Compute::VcloudDirector | vm", ['configuration']) do
vm = vapp.vms.first
tests("Compute::Vcloudng | vm", ['network']) do
tests("Compute::VcloudDirector | vm", ['network']) do
network = vm.network
network.network = NETWORK_NAME
network.is_connected = true
@ -31,7 +31,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#ip_address_allocation_mode").returns(NETWORK_MODE) { network.ip_address_allocation_mode }
end
tests("Compute::Vcloudng | vm", ['customization']) do
tests("Compute::VcloudDirector | vm", ['customization']) do
customization = vm.customization
customization.script = 'this is the user data'
customization.enabled = true
@ -40,7 +40,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#enabled").returns(true) { customization.enabled }
end
tests("Compute::Vcloudng | vm", ['doble the disk size']) do
tests("Compute::VcloudDirector | vm", ['doble the disk size']) do
disk = vm.disks.get_by_name('Hard disk 1')
tests("#disk_size").returns(Fixnum) { disk.capacity.class}
new_size = disk.capacity * 2
@ -49,7 +49,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#disk_size is now doubled").returns(new_size) { disk.capacity }
end
tests("Compute::Vcloudng | vm", ['add a new disk']) do
tests("Compute::VcloudDirector | vm", ['add a new disk']) do
tests("hard disk 2 doesn't exist").returns(nil) { vm.disks.get_by_name('Hard disk 2') }
tests("#create").returns(true) { vm.disks.create(1024) }
tests("hard disk 2 exists").returns(1024) { vm.disks.get_by_name('Hard disk 2').capacity }
@ -57,7 +57,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("hard disk 2 doesn't exist anymore").returns(nil) { vm.disks.get_by_name('Hard disk 2') }
end
tests("Compute::Vcloudng | vm", ['doble the memory size']) do
tests("Compute::VcloudDirector | vm", ['doble the memory size']) do
tests("#memory").returns(Fixnum) { vm.memory.class}
new_size = vm.memory * 2
vm.memory = new_size
@ -65,7 +65,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#memory is now doubled").returns(new_size) { vm.memory }
end
tests("Compute::Vcloudng | vm", ['doble the cpu size']) do
tests("Compute::VcloudDirector | vm", ['doble the cpu size']) do
tests("#cpu").returns(Fixnum) { vm.cpu.class}
new_size = vm.cpu * 2
vm.cpu = new_size
@ -73,7 +73,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#memory is now doubled").returns(new_size) { vm.cpu }
end
tests("Compute::Vcloudng | vm", ['tags']) do
tests("Compute::VcloudDirector | vm", ['tags']) do
TAGS.each_pair do |k,v|
tests('create tag').returns(true) {vm.tags.create(k, v)}
end
@ -85,7 +85,7 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests('there is only one tag').returns(1){ vm.tags.size }
end
tests("Compute::Vcloudng | vm", ['power on']) do
tests("Compute::VcloudDirector | vm", ['power on']) do
tests('#vm is off').returns("off"){ vm.status }
tests('#power_on').returns(true){ vm.power_on }
vm.reload

View file

@ -2,39 +2,39 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | vapps", ['all']) do
Shindo.tests("Compute::VcloudDirector | vapps", ['all']) do
pending if Fog.mocking?
tests("#There is more than one vapp").returns(true){ vdc.vapps.size >= 1 }
vapps = vdc.vapps
vapp = vapps.first
tests("Compute::Vcloudng | vapp") do
tests("Compute::VcloudDirector | vapp") do
tests("#id").returns(String){ vapp.id.class }
tests("#name").returns(String){ vapp.name.class }
tests("#href").returns(String){ vapp.href.class }
tests("#type").returns("application/vnd.vmware.vcloud.vApp+xml"){ vapp.type }
end
tests("Compute::Vcloudng | vapp", ['lazy load attrs']) do
tests("Compute::VcloudDirector | vapp", ['lazy load attrs']) do
vapp.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { vapp.attributes[lazy_attr] }
end
end
tests("Compute::Vcloudng | vapp", ['load on demand']) do
tests("Compute::VcloudDirector | vapp", ['load on demand']) do
tests("#description is not loaded yet").returns(NonLoaded) { vapp.attributes[:description] }
tests("#description is loaded on demand").returns(String) { vapp.description.class }
tests("#description is now loaded").returns(true) { vapp.attributes[:description] != NonLoaded }
end
tests("Compute::Vcloudng | vapp", ['lazy load attrs']) do
tests("Compute::VcloudDirector | vapp", ['lazy load attrs']) do
vapp.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is now loaded").returns(true) { vapp.attributes[lazy_attr] != NonLoaded }
end
end
tests("Compute::Vcloudng | vapp", ['get']) do
tests("Compute::VcloudDirector | vapp", ['get']) do
tests("#get_by_name").returns(vapp.name) { vapps.get_by_name(vapp.name).name }
tests("#get").returns(vapp.id) { vapps.get(vapp.id).id }
end

View file

@ -2,39 +2,39 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | vdcs", ['all']) do
Shindo.tests("Compute::VcloudDirector | vdcs", ['all']) do
pending if Fog.mocking?
tests("#There is one or more vdc").returns(true){ organization.vdcs.size >= 1 }
vdcs = organization.vdcs
vdc = vdcs.first
tests("Compute::Vcloudng | vdc") do
tests("Compute::VcloudDirector | vdc") do
tests("#id").returns(String){ vdc.id.class }
tests("#name").returns(String){ vdc.name.class }
tests("#href").returns(String){ vdc.href.class }
tests("#type").returns("application/vnd.vmware.vcloud.vdc+xml"){ vdc.type }
end
tests("Compute::Vcloudng | vdc", ['lazy load attrs']) do
tests("Compute::VcloudDirector | vdc", ['lazy load attrs']) do
vdc.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { vdc.attributes[lazy_attr] }
end
end
tests("Compute::Vcloudng | vdc", ['load on demand']) do
tests("Compute::VcloudDirector | vdc", ['load on demand']) do
tests("#description is not loaded yet").returns(NonLoaded) { vdc.attributes[:description] }
tests("#description is loaded on demand").returns(String) { vdc.description.class }
tests("#description is now loaded").returns(true) { vdc.attributes[:description] != NonLoaded }
end
tests("Compute::Vcloudng | vdc", ['lazy load attrs']) do
tests("Compute::VcloudDirector | vdc", ['lazy load attrs']) do
vdc.lazy_load_attrs.each do |lazy_attr|
tests("##{lazy_attr} is now loaded").returns(true) { vdc.attributes[lazy_attr] != NonLoaded }
end
end
tests("Compute::Vcloudng | vdc", ['get']) do
tests("Compute::VcloudDirector | vdc", ['get']) do
tests("#get_by_name").returns(vdc.name) { vdcs.get_by_name(vdc.name).name }
tests("#get").returns(vdc.id) { vdcs.get(vdc.id).id }
end

View file

@ -2,7 +2,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
VCR.use_cassette(File.basename(__FILE__)) do
Shindo.tests("Compute::Vcloudng | vms", ['all']) do
Shindo.tests("Compute::VcloudDirector | vms", ['all']) do
pending if Fog.mocking?
vapp = vapps.detect {|vapp| vapp.vms.size >= 1 }
@ -11,8 +11,8 @@ VCR.use_cassette(File.basename(__FILE__)) do
vms = vapp.vms
vm = vms.first
tests("Compute::Vcloudng | vm") do
tests("#model").returns(Fog::Compute::Vcloudng::Vm){vm.class}
tests("Compute::VcloudDirector | vm") do
tests("#model").returns(Fog::Compute::VcloudDirector::Vm){vm.class}
tests("#id").returns(String){ vm.id.class }
tests("#name").returns(String){ vm.name.class }
tests("#href").returns(String){ vm.href.class }
@ -26,14 +26,14 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#hard_disks").returns(Array){ vm.hard_disks.class }
end
tests("Compute::Vcloudng | vm", ['get']) do
tests("Compute::VcloudDirector | vm", ['get']) do
tests("#get_by_name").returns(vm.name) { vms.get_by_name(vm.name).name }
tests("#get").returns(vm.id) { vms.get(vm.id).id }
end
tests("Compute::Vcloudng | vm | disks") do
tests("#collection").returns(Fog::Compute::Vcloudng::Disks){ vm.disks.class }
tests("#get_by_name").returns(Fog::Compute::Vcloudng::Disk) { vm.disks.get_by_name("Hard disk 1").class }
tests("Compute::VcloudDirector | vm | disks") do
tests("#collection").returns(Fog::Compute::VcloudDirector::Disks){ vm.disks.class }
tests("#get_by_name").returns(Fog::Compute::VcloudDirector::Disk) { vm.disks.get_by_name("Hard disk 1").class }
hard_disk = vm.disks.get_by_name("Hard disk 1")
tests("#id").returns(2000){ hard_disk.id }
@ -47,9 +47,9 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#bus_type").returns(6){ hard_disk.bus_type }
end
tests("Compute::Vcloudng | vm | customization") do
tests("Compute::VcloudDirector | vm | customization") do
customization = vm.customization
tests("#model").returns(Fog::Compute::Vcloudng::VmCustomization){customization.class}
tests("#model").returns(Fog::Compute::VcloudDirector::VmCustomization){customization.class}
tests("#id").returns(String){ customization.id.class }
tests("#href").returns(String){ customization.href.class }
tests("#type").returns("application/vnd.vmware.vcloud.guestCustomizationSection+xml"){ customization.type }
@ -63,9 +63,9 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#reset_password_required").returns(true){ boolean? customization.reset_password_required }
end
tests("Compute::Vcloudng | vm | network") do
tests("Compute::VcloudDirector | vm | network") do
network = vm.network
tests("#model").returns(Fog::Compute::Vcloudng::VmNetwork){network.class}
tests("#model").returns(Fog::Compute::VcloudDirector::VmNetwork){network.class}
tests("#id").returns(String){ network.id.class }
tests("#href").returns(String){ network.href.class }
tests("#type").returns("application/vnd.vmware.vcloud.networkConnectionSection+xml"){ network.type }
@ -79,9 +79,9 @@ VCR.use_cassette(File.basename(__FILE__)) do
tests("#is_connected").returns(true){ boolean? network.is_connected }
end
tests("Compute::Vcloudng | vm | tags") do
tests("Compute::VcloudDirector | vm | tags") do
tags = vm.tags
tests("#collection").returns(Fog::Compute::Vcloudng::Tags){ tags.class }
tests("#collection").returns(Fog::Compute::VcloudDirector::Tags){ tags.class }
end