rbvmomi 1.11.2 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +114 -0
- data/lib/rbvmomi/version.rb +1 -1
- data/vmodl.db +0 -0
- metadata +4 -4
- data/README.rdoc +0 -105
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 291486048aa5b6cbd7146d49d7324a4b236212d5
|
4
|
+
data.tar.gz: 1586964068b6036bbee0a7b2beb3c0ca430c8aa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7869ac4308e5c56472c42bb1359a1808956d9f2f83b30066825e88b7ab9be434d94b42521a45c335bf7718d8ae624a9102565ffe8c5abb04d3027b735476ca79
|
7
|
+
data.tar.gz: 7779212ffb10678dcae454875a381ff0beed76488fc77106490506d032b7b166f348a8678ea5577cfe0e2be3bf61967775d001f5f3a0776b0f145078056b372c
|
data/.yardopts
CHANGED
data/README.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# RbVmomi
|
2
|
+
|
3
|
+
[<img src="https://badge.fury.io/rb/rbvmomi.svg" alt="gem-version">](https://rubygems.org/gems/rbvmomi)
|
4
|
+
[<img src="https://travis-ci.org/vmware/rbvmomi.svg?branch=master" alt="travis-ci">](http://travis-ci.org/vmware/rbvmomi)
|
5
|
+
[<img src="https://badges.gitter.im/vmware/rbvmomi.svg">](https://gitter.im/vmware/rbvmomi)
|
6
|
+
|
7
|
+
This is a community-supported, open source project at VMware. It is built and
|
8
|
+
maintained by programmers like you!
|
9
|
+
|
10
|
+
## Introduction
|
11
|
+
|
12
|
+
RbVmomi is a Ruby interface to the vSphere API. Like the Perl and Java SDKs,
|
13
|
+
you can use it to manage ESX and vCenter servers. The current release
|
14
|
+
supports the vSphere 6.5 API. RbVmomi specific documentation is
|
15
|
+
[online](http://rdoc.info/github/vmware/rbvmomi/master/frames) and is meant to
|
16
|
+
be used alongside the official [documentation](http://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html).
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
gem install rbvmomi
|
21
|
+
|
22
|
+
### Support for older Ruby versions
|
23
|
+
|
24
|
+
RbVmomi supports Ruby 1.8.7 and higher, but certain dependencies may need
|
25
|
+
pinning to older versions to get a compatible set of gems.
|
26
|
+
|
27
|
+
On Ruby 1.8.7:
|
28
|
+
|
29
|
+
* use `nokogiri` 1.5.x (Gemfile: `gem 'nokogiri', '< 1.6'`)
|
30
|
+
|
31
|
+
|
32
|
+
On both Ruby 1.9 and 1.8.7:
|
33
|
+
|
34
|
+
* use `json` 1.x (Gemfile: `gem 'json', '< 2'`)
|
35
|
+
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
A simple example of turning on a VM:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
require 'rbvmomi'
|
43
|
+
|
44
|
+
vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
|
45
|
+
dc = vim.serviceInstance.find_datacenter('my_datacenter') || fail('datacenter not found')
|
46
|
+
vm = dc.find_vm('my_vm') || fail('VM not found')
|
47
|
+
vm.PowerOnVM_Task.wait_for_completion
|
48
|
+
```
|
49
|
+
|
50
|
+
This code uses several RbVmomi extensions to the vSphere API for concision.
|
51
|
+
The expanded snippet below uses only standard API calls and should be familiar
|
52
|
+
to users of the Java SDK:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
require 'rbvmomi'
|
56
|
+
|
57
|
+
vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
|
58
|
+
root_folder = vim.serviceInstance.content.rootFolder
|
59
|
+
dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == 'mydatacenter' } || fail('datacenter not found')
|
60
|
+
vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == 'my_vm' } || fail('VM not found')
|
61
|
+
task = vm.PowerOnVM_Task
|
62
|
+
filter = vim.propertyCollector.CreateFilter(
|
63
|
+
spec: {
|
64
|
+
propSet: [{ type: 'Task', all: false, pathSet: ['info.state']}],
|
65
|
+
objectSet: [{ obj: task }]
|
66
|
+
},
|
67
|
+
partialUpdates: false
|
68
|
+
)
|
69
|
+
ver = ''
|
70
|
+
loop do
|
71
|
+
result = vim.propertyCollector.WaitForUpdates(version: ver)
|
72
|
+
ver = result.version
|
73
|
+
break if ['success', 'error'].member?(task.info.state)
|
74
|
+
end
|
75
|
+
filter.DestroyPropertyFilter
|
76
|
+
raise(task.info.error) if task.info.state == 'error'
|
77
|
+
```
|
78
|
+
|
79
|
+
As you can see, the extensions RbVmomi adds can dramatically decrease the code
|
80
|
+
needed to perform simple tasks while still letting you use the full power of
|
81
|
+
the API when necessary. RbVmomi extensions are often more efficient than a
|
82
|
+
naive implementation; for example, the find_vm method on VIM::Datacenter used
|
83
|
+
in the first example uses the SearchIndex for fast lookups.
|
84
|
+
|
85
|
+
A few important points:
|
86
|
+
|
87
|
+
* All class, method, parameter, and property names match the official [documentation](http://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html).
|
88
|
+
* Properties are exposed as accessor methods.
|
89
|
+
* Data object types can usually be inferred from context, so you may use a hash instead.
|
90
|
+
* Enumeration values are simply strings.
|
91
|
+
* Example code is included in the examples/ directory.
|
92
|
+
* A set of helper methods for Trollop is included to speed up development of
|
93
|
+
command line apps. See the included examples for usage.
|
94
|
+
* If you don't have trusted SSL certificates installed on the host you're
|
95
|
+
connecting to, you'll get an `OpenSSL::SSL::SSLError` "certificate verify
|
96
|
+
failed". You can work around this by using the `:insecure` option to
|
97
|
+
`RbVmomi::VIM.connect`.
|
98
|
+
* This is a side project of a VMware employee and is entirely unsupported by
|
99
|
+
VMware.
|
100
|
+
|
101
|
+
|
102
|
+
Built-in extensions are under `lib/rbvmomi/vim/`. You are encouraged to reopen
|
103
|
+
VIM classes in your applications and add extensions of your own. If you write
|
104
|
+
something generally useful please open a [pull request](https://github.com/vmware/rbvmomi/pulls) so it can be merged back in
|
105
|
+
|
106
|
+
## Development
|
107
|
+
|
108
|
+
Open an issue on the [issues page](https://github.com/vmware/rbvmomi/issues)
|
109
|
+
or fork the project on [GitHub](https://github.com/vmware/rbvmomi) and send a
|
110
|
+
[pull request](https://github.com/vmware/rbvmomi/pulls).
|
111
|
+
|
112
|
+
## Support
|
113
|
+
|
114
|
+
You can chat on [Gitter](https://gitter.im/vmware/rbvmomi) or join the [VMware {code} Slack team](https://vmwarecode.slack.com/) and join the [#rbvmomi channel](https://vmwarecode.slack.com/messages/rbvmomi).
|
data/lib/rbvmomi/version.rb
CHANGED
data/vmodl.db
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbvmomi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Lane
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -136,7 +136,7 @@ files:
|
|
136
136
|
- CONTRIBUTORS.md
|
137
137
|
- Gemfile
|
138
138
|
- LICENSE
|
139
|
-
- README.
|
139
|
+
- README.md
|
140
140
|
- Rakefile
|
141
141
|
- devel/analyze-vim-declarations.rb
|
142
142
|
- devel/analyze-xml.rb
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
224
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.6.
|
225
|
+
rubygems_version: 2.6.12
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Ruby interface to the VMware vSphere API
|
data/README.rdoc
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
= RbVmomi
|
2
|
-
|
3
|
-
{<img src="https://badge.fury.io/rb/rbvmomi.svg" alt="gem-version">}[https://rubygems.org/gems/rbvmomi]
|
4
|
-
{<img src="https://travis-ci.org/vmware/rbvmomi.svg?branch=master" alt="travis-ci">}[http://travis-ci.org/vmware/rbvmomi]
|
5
|
-
{<img src="https://badges.gitter.im/vmware/rbvmomi.svg">}[https://gitter.im/vmware/rbvmomi]
|
6
|
-
|
7
|
-
This is a community-supported, open source project at VMware. It is built and maintained by programmers like you!
|
8
|
-
|
9
|
-
== Introduction
|
10
|
-
|
11
|
-
RbVmomi is a Ruby interface to the vSphere API. Like the Perl and Java SDKs,
|
12
|
-
you can use it to manage ESX and vCenter servers. The current release
|
13
|
-
supports the vSphere 6.5 API. RbVmomi specific documentation is
|
14
|
-
online[http://rdoc.info/github/vmware/rbvmomi/master/frames] and is meant to
|
15
|
-
be used alongside the official documentation[http://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html].
|
16
|
-
|
17
|
-
== Installation
|
18
|
-
|
19
|
-
gem install rbvmomi
|
20
|
-
|
21
|
-
=== Support for older Ruby versions
|
22
|
-
|
23
|
-
RbVmomi supports Ruby 1.8.7 and higher, but certain dependencies may need
|
24
|
-
pinning to older versions to get a compatible set of gems.
|
25
|
-
|
26
|
-
On Ruby 1.8.7:
|
27
|
-
|
28
|
-
* use +nokogiri+ 1.5.x (Gemfile: <code>gem 'nokogiri', '< 1.6'</code>)
|
29
|
-
|
30
|
-
On both Ruby 1.9 and 1.8.7:
|
31
|
-
|
32
|
-
* use +json+ 1.x (Gemfile: <code>gem 'json', '< 2'</code>)
|
33
|
-
|
34
|
-
== Usage
|
35
|
-
|
36
|
-
A simple example of turning on a VM:
|
37
|
-
|
38
|
-
require 'rbvmomi'
|
39
|
-
|
40
|
-
vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
|
41
|
-
dc = vim.serviceInstance.find_datacenter('my_datacenter') || fail('datacenter not found')
|
42
|
-
vm = dc.find_vm('my_vm') || fail('VM not found')
|
43
|
-
vm.PowerOnVM_Task.wait_for_completion
|
44
|
-
|
45
|
-
This code uses several RbVmomi extensions to the vSphere API for concision. The
|
46
|
-
expanded snippet below uses only standard API calls and should be familiar to
|
47
|
-
users of the Java SDK:
|
48
|
-
|
49
|
-
require 'rbvmomi'
|
50
|
-
|
51
|
-
vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
|
52
|
-
root_folder = vim.serviceInstance.content.rootFolder
|
53
|
-
dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == 'mydatacenter' } || fail('datacenter not found')
|
54
|
-
vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == 'my_vm' } || fail('VM not found')
|
55
|
-
task = vm.PowerOnVM_Task
|
56
|
-
filter = vim.propertyCollector.CreateFilter(
|
57
|
-
spec: {
|
58
|
-
propSet: [{ type: 'Task', all: false, pathSet: ['info.state']}],
|
59
|
-
objectSet: [{ obj: task }]
|
60
|
-
},
|
61
|
-
partialUpdates: false
|
62
|
-
)
|
63
|
-
ver = ''
|
64
|
-
loop do
|
65
|
-
result = vim.propertyCollector.WaitForUpdates(version: ver)
|
66
|
-
ver = result.version
|
67
|
-
break if ['success', 'error'].member?(task.info.state)
|
68
|
-
end
|
69
|
-
filter.DestroyPropertyFilter
|
70
|
-
raise(task.info.error) if task.info.state == 'error'
|
71
|
-
|
72
|
-
As you can see, the extensions RbVmomi adds can dramatically decrease the code
|
73
|
-
needed to perform simple tasks while still letting you use the full power of
|
74
|
-
the API when necessary. RbVmomi extensions are often more efficient than a
|
75
|
-
naive implementation; for example, the find_vm method on VIM::Datacenter used
|
76
|
-
in the first example uses the SearchIndex for fast lookups.
|
77
|
-
|
78
|
-
A few important points:
|
79
|
-
|
80
|
-
* All class, method, parameter, and property names match the official documentation[http://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html].
|
81
|
-
* Properties are exposed as accessor methods.
|
82
|
-
* Data object types can usually be inferred from context, so you may use a hash instead.
|
83
|
-
* Enumeration values are simply strings.
|
84
|
-
* Example code is included in the examples/ directory.
|
85
|
-
* A set of helper methods for Trollop is included to speed up development of
|
86
|
-
command line apps. See the included examples for usage.
|
87
|
-
* If you don't have trusted SSL certificates installed on the host you're
|
88
|
-
connecting to, you'll get an +OpenSSL::SSL::SSLError+ "certificate verify failed".
|
89
|
-
You can work around this by using the +:insecure+ option to +RbVmomi::VIM.connect+.
|
90
|
-
* This is a side project of a VMware employee and is entirely unsupported by VMware.
|
91
|
-
|
92
|
-
Built-in extensions are under +lib/rbvmomi/vim/+. You are encouraged to
|
93
|
-
reopen VIM classes in your applications and add extensions of your own. If you
|
94
|
-
write something generally useful please open a {pull request}[https://github.com/vmware/rbvmomi/pulls] so it
|
95
|
-
can be merged back in
|
96
|
-
|
97
|
-
== Development
|
98
|
-
|
99
|
-
Open an issue on the {issues page}[https://github.com/vmware/rbvmomi/issues] or
|
100
|
-
fork the project on {GitHub}[https://github.com/vmware/rbvmomi] and send a {pull request}[https://github.com/vmware/rbvmomi/pulls].
|
101
|
-
|
102
|
-
== Support
|
103
|
-
|
104
|
-
You can chat on {Gitter}[https://gitter.im/vmware/rbvmomi] or join the {VMware \{code} Slack team}[https://vmwarecode.slack.com/]
|
105
|
-
and join the {#rbvmomi channel}[https://vmwarecode.slack.com/messages/rbvmomi].
|