webee 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/examples/basics.rb CHANGED
@@ -179,3 +179,6 @@ vdc.virtual_appliances.each do |vapp|
179
179
  #puts vm.name
180
180
  end
181
181
  end
182
+
183
+ # Delete de VDC
184
+ vdc.delete
data/examples/test.rb CHANGED
@@ -5,21 +5,22 @@ require 'active_support'
5
5
 
6
6
  WeBee::Api.user = ENV['user'] || 'admin'
7
7
  WeBee::Api.password = ENV['pass'] || 'xabiquo'
8
- WeBee::Api.url = 'http://mothership.60.1.24/api'
8
+ WeBee::Api.url = 'http://10.60.1.24/api'
9
9
 
10
10
  include WeBee
11
11
 
12
- vdcs = WeBee::VDC.all(:datacenter_id => WeBee::Datacenter.all.first.datacenter_id, :enterprise_id => Enterprise.all.first.enterprise_id)
12
+ dc = Datacenter.all.first
13
+ ent = Enterprise.all.first
14
+ puts ent.name
15
+ rack = dc.racks.first
13
16
 
14
- #
15
- # List all the Virtual Apps in an VDC
16
- #
17
- vdc.virtual_appliances.each do |vapp|
18
- #
19
- # List the VM in a VAPP
20
- #
21
- vapp.virtual_machines.each do |vm|
22
- #puts vm.name
23
- end
24
- end
17
+ #machine = dc.discover_machine :ip => '10.60.1.24', :hypervisortype => 'kvm'
18
+ # Use the first virtual switch we find
19
+ #machine.virtual_switch = machine.virtual_switches.first
20
+ # Enable the first datastore found
21
+ #machine.datastores.first.enabled = true
22
+ # Add the hypervisor to the rack
23
+ #rack.add_machine(machine)
24
+ ent.set_limits_for_datacenter dc
25
+ vdc = ent.create_vdc :name => 'kvm-vdc2', :hypervisortype => 'KVM', :datacenter => dc
25
26
 
data/lib/webee.rb CHANGED
@@ -28,8 +28,7 @@ end
28
28
 
29
29
  module WeBee
30
30
 
31
- VERSION = '0.3'
32
-
31
+ VERSION = '0.3.1'
33
32
 
34
33
  module RestResource
35
34
 
@@ -582,6 +581,10 @@ module WeBee
582
581
  def self.find_by_name(name, options = {})
583
582
  VDC.all(options).find_all { |vdc| vdc.name =~ /#{name}/ }
584
583
  end
584
+
585
+ def delete
586
+ RestClient.delete(Api.url + "/cloud/virtualdatacenters/#{vdc_id}")
587
+ end
585
588
 
586
589
  #
587
590
  # List all the virtual appliances in this virtual datacenter
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webee
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- version: "0.3"
9
+ - 1
10
+ version: 0.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Sergio Rubio