All Projects → vmware → Rbvmomi

vmware / Rbvmomi

Licence: mit
Ruby interface to the VMware vSphere API.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Rbvmomi

vmware.vmware rest
Ansible Collection for VMWare (REST modules)
Stars: ✭ 60 (-80.26%)
Mutual labels:  vmware, vsphere
vic-ui
vSphere Integrated Containers Plug-In for vSphere Client provides information about your VIC setup and allows you to deploy VCHs directly from the vSphere Client.
Stars: ✭ 23 (-92.43%)
Mutual labels:  vmware, vsphere
Vic Product
vSphere Integrated Containers enables VMware customers to deliver a production-ready container solution to their developers and DevOps teams.
Stars: ✭ 143 (-52.96%)
Mutual labels:  vsphere, vmware
Cloud Portal
Self service web portal for different Cloud platforms like Azure, AWS and VMWare vSphere.
Stars: ✭ 60 (-80.26%)
Mutual labels:  vsphere, vmware
AsBuiltReport.VMware.vSphere
Repository for AsBuiltReport VMware vSphere module
Stars: ✭ 75 (-75.33%)
Mutual labels:  vmware, vsphere
Cloud Provider Vsphere
Kubernetes Cloud Provider for vSphere https://cloud-provider-vsphere.sigs.k8s.io
Stars: ✭ 120 (-60.53%)
Mutual labels:  vsphere, vmware
vSphere-6.5-API-Playbook-Examples
Examples of how to create Ansible playbooks to leverage vSphere 6.5 RESTful APIs. Playbooks will be isolate to specific APIs and roles added for example use cases.
Stars: ✭ 16 (-94.74%)
Mutual labels:  vmware, vsphere
vauth
VMware vSphere VM Identity Platform
Stars: ✭ 32 (-89.47%)
Mutual labels:  vmware, vsphere
tfc-agent
Examples related to the Terraform Cloud Agent, a remote runner for Terraform Cloud Business and Terraform Enterprise
Stars: ✭ 44 (-85.53%)
Mutual labels:  vmware, vsphere
pyVirtualize
A python interface to access and manage VMware vSphere and ~Horizon View~
Stars: ✭ 13 (-95.72%)
Mutual labels:  vmware, vsphere
Vsphere2metrics
VMware vSphere Performance Metrics Integration with Graphite & InfluxDB
Stars: ✭ 28 (-90.79%)
Mutual labels:  vsphere, vmware
vmSafeguard
vmSafeguard is a management, planning, backup system for a Vmware ESXi(s) solution, orchestrated through a Web Admin Panel. RTFM for more info. Under develop since Jun 2020
Stars: ✭ 20 (-93.42%)
Mutual labels:  vmware, vsphere
Vsphere Modules
This is my Module Collection for VMware vSphere
Stars: ✭ 18 (-94.08%)
Mutual labels:  vsphere, vmware
Terraform Vsphere Kubespray
Deploy a Kubernetes HA cluster on VMware vSphere
Stars: ✭ 141 (-53.62%)
Mutual labels:  vsphere, vmware
Vic
vSphere Integrated Containers Engine is a container runtime for vSphere.
Stars: ✭ 607 (+99.67%)
Mutual labels:  vsphere, vmware
inspec-vmware
InSpec VMware Resource Pack (Incubation)
Stars: ✭ 18 (-94.08%)
Mutual labels:  vmware, vsphere
ansible-vmware-http
Examples of Ansible playbook to manage VMware using HTTP APIs
Stars: ✭ 29 (-90.46%)
Mutual labels:  vmware, vsphere
vcenter-event-broker-appliance
The VMware Event Broker Appliance Fling enables customers to unlock the hidden potential of events in their SDDC to easily create event-driven automation.
Stars: ✭ 120 (-60.53%)
Mutual labels:  vmware, vsphere
meetings
Sharing of content from Automation User Group meetings etc.
Stars: ✭ 16 (-94.74%)
Mutual labels:  vmware
Project-Mendacius
A GUI based virtualisation tool for running Linux on macOS Big Sur (x86 or arm64)
Stars: ✭ 107 (-64.8%)
Mutual labels:  vmware

RbVmomi

gem-version Test Lint

This is a community-supported, open source project at VMware. It is built and maintained by programmers like you!

Introduction

RbVmomi is a Ruby interface to the vSphere API. Like the Perl and Java SDKs, you can use it to manage ESX and vCenter servers. The current release supports the vSphere 7.0 API. RbVmomi specific documentation is online and is meant to be used alongside the official documentation.

Installation

gem install rbvmomi

Usage

A simple example of turning on a VM:

require 'rbvmomi'

vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
dc = vim.serviceInstance.find_datacenter('my_datacenter') || fail('datacenter not found')
vm = dc.find_vm('my_vm') || fail('VM not found')
vm.PowerOnVM_Task.wait_for_completion

This code uses several RbVmomi extensions to the vSphere API for concision. The expanded snippet below uses only standard API calls and should be familiar to users of the Java SDK:

require 'rbvmomi'

vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
root_folder = vim.serviceInstance.content.rootFolder
dc = root_folder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == 'mydatacenter' } || fail('datacenter not found')
vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == 'my_vm' } || fail('VM not found')
task = vm.PowerOnVM_Task
filter = vim.propertyCollector.CreateFilter(
  spec: {
    propSet: [{ type: 'Task', all: false, pathSet: ['info.state']}],
    objectSet: [{ obj: task }]
  },
  partialUpdates: false
)
ver = ''
loop do
  result = vim.propertyCollector.WaitForUpdates(version: ver)
  ver = result.version
  break if ['success', 'error'].member?(task.info.state)
end
filter.DestroyPropertyFilter
raise(task.info.error) if task.info.state == 'error'

As you can see, the extensions RbVmomi adds can dramatically decrease the code needed to perform simple tasks while still letting you use the full power of the API when necessary. RbVmomi extensions are often more efficient than a naive implementation; for example, the find_vm method on VIM::Datacenter used in the first example uses the SearchIndex for fast lookups.

A few important points:

  • All class, method, parameter, and property names match the official documentation.
  • Properties are exposed as accessor methods.
  • Data object types can usually be inferred from context, so you may use a hash instead.
  • Enumeration values are simply strings.
  • Example code is included in the examples/ directory.
  • A set of helper methods for Optimist is included to speed up development of command line apps. See the included examples for usage.
  • If you don't have trusted SSL certificates installed on the host you're connecting to, you'll get an OpenSSL::SSL::SSLError "certificate verify failed". You can work around this by using the :insecure option to RbVmomi::VIM.connect.
  • This is a side project of a VMware employee and is entirely unsupported by VMware.

Built-in extensions are under lib/rbvmomi/vim/. You are encouraged to reopen VIM classes in your applications and add extensions of your own. If you write something generally useful please open a pull request so it can be merged back in

Development

Open an issue on the issues page or fork the project on GitHub and send a pull request.

Support

You can chat on Gitter or join the VMware {code} Slack team and join the #rbvmomi channel.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].