Permalink
Browse files

Added Ruby bindings for VIM API.

- these work on 1.8 and 1.9
- based on the Python bindings
  • Loading branch information...
1 parent ac139ee commit 4a23c5181dea39d74a737e448a6d4a9f87c582a6 Vadim Spivak committed Mar 25, 2011
Showing with 7,833 additions and 0 deletions.
  1. +1 −0 ruby_vim_sdk/.gitignore
  2. +13 −0 ruby_vim_sdk/Gemfile
  3. 0 ruby_vim_sdk/README
  4. +40 −0 ruby_vim_sdk/Rakefile
  5. +2 −0 ruby_vim_sdk/TODO
  6. +64 −0 ruby_vim_sdk/assets/CoreTypes.py
  7. +3 −0 ruby_vim_sdk/assets/README
  8. +2,714 −0 ruby_vim_sdk/assets/ServerObjects.py
  9. +151 −0 ruby_vim_sdk/assets/VmomiSupport.py
  10. +48 −0 ruby_vim_sdk/lib/ruby_vim_sdk.rb
  11. +15 −0 ruby_vim_sdk/lib/ruby_vim_sdk/base_type.rb
  12. +32 −0 ruby_vim_sdk/lib/ruby_vim_sdk/const.rb
  13. +68 −0 ruby_vim_sdk/lib/ruby_vim_sdk/core_types.rb
  14. +14 −0 ruby_vim_sdk/lib/ruby_vim_sdk/data_type.rb
  15. +12 −0 ruby_vim_sdk/lib/ruby_vim_sdk/enum_type.rb
  16. +9 −0 ruby_vim_sdk/lib/ruby_vim_sdk/ext.rb
  17. +12 −0 ruby_vim_sdk/lib/ruby_vim_sdk/managed_type.rb
  18. +37 −0 ruby_vim_sdk/lib/ruby_vim_sdk/method.rb
  19. +11 −0 ruby_vim_sdk/lib/ruby_vim_sdk/missing_types.rb
  20. +49 −0 ruby_vim_sdk/lib/ruby_vim_sdk/property.rb
  21. +2,718 −0 ruby_vim_sdk/lib/ruby_vim_sdk/server_objects.rb
  22. +301 −0 ruby_vim_sdk/lib/ruby_vim_sdk/soap/deserializer.rb
  23. +225 −0 ruby_vim_sdk/lib/ruby_vim_sdk/soap/serializer.rb
  24. +128 −0 ruby_vim_sdk/lib/ruby_vim_sdk/soap/stub_adapter.rb
  25. +12 −0 ruby_vim_sdk/lib/ruby_vim_sdk/soap_exception.rb
  26. +9 −0 ruby_vim_sdk/lib/ruby_vim_sdk/typed_array.rb
  27. +22 −0 ruby_vim_sdk/lib/ruby_vim_sdk/types.rb
  28. +102 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmodl/data_object.rb
  29. +78 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmodl/managed_object.rb
  30. +7 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmodl/method_name.rb
  31. +7 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmodl/property_path.rb
  32. +7 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmodl/type_name.rb
  33. +30 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmodl_helper.rb
  34. +280 −0 ruby_vim_sdk/lib/ruby_vim_sdk/vmomi_support.rb
  35. +15 −0 ruby_vim_sdk/ruby_vim_sdk.gemspec
  36. +51 −0 ruby_vim_sdk/spec/Rakefile
  37. +9 −0 ruby_vim_sdk/spec/spec_helper.rb
  38. +180 −0 ruby_vim_sdk/spec/unit/soap/deserializer_spec.rb
  39. +261 −0 ruby_vim_sdk/spec/unit/soap/serializer_spec.rb
  40. +9 −0 ruby_vim_sdk/spec/unit/soap/stub_adapter_spec.rb
  41. +9 −0 ruby_vim_sdk/spec/unit/vmodl/data_object_spec.rb
  42. +9 −0 ruby_vim_sdk/spec/unit/vmodl/managed_object_spec.rb
  43. +36 −0 ruby_vim_sdk/spec/unit/vmodl_helper_spec.rb
  44. +33 −0 ruby_vim_sdk/spec/unit/vmomi_support_spec.rb
View
@@ -0,0 +1 @@
+Gemfile.lock
View
@@ -0,0 +1,13 @@
+source :rubygems
+
+gemspec
+
+group :test do
+ gem "ci_reporter"
+ gem "rake"
+ gem "rcov"
+ gem "rcov_analyzer"
+ gem "rspec"
+ gem "ruby-debug", :platforms => :ruby_18
+ gem "ruby-debug19", :platforms => :ruby_19
+end
View
No changes.
View
@@ -0,0 +1,40 @@
+require "rubygems"
+require "bundler"
+Bundler::GemHelper.install_tasks
+
+desc "Run specs"
+task :spec => [ "bundler:install:test", "test:spec" ]
+
+desc "Run specs for CI"
+task "spec:ci" => ["bundler:install:test", "test:spec:ci"]
+
+desc "Run specs w/coverage"
+task "spec:rcov" => ["bundler:install:test", "test:spec:rcov"]
+
+environments = %w(test development production)
+
+namespace "bundler" do
+
+ desc "Install gems"
+ task "install" do
+ sh("bundle install")
+ end
+
+ environments = %w(test development production)
+
+ environments.each do |env|
+ desc "Install gems for #{env}"
+ task "install:#{env}" do
+ sh("bundle install --local --without #{(environments - [env]).join(' ')}")
+ end
+ end
+
+end
+
+namespace "test" do
+ ["spec", "spec:rcov", "spec:ci" ].each do |task_name|
+ task task_name do
+ sh("cd spec && rake #{task_name}")
+ end
+ end
+end
View
@@ -0,0 +1,2 @@
+- finish the rest of the tests
+- get rid of guess_wsdl_type, should use default namespace
@@ -0,0 +1,64 @@
+# ******* WARNING - AUTO GENERATED CODE - DO NOT EDIT *******
+from VmomiSupport import CreateDataType, CreateManagedType, CreateEnumType, AddVersion, AddVersionParent, F_LINK, F_LINKABLE, F_OPTIONAL
+
+AddVersion("vmodl.version.version0", "", "", 0, "vim25")
+AddVersion("vmodl.version.version1", "", "", 0, "vim25")
+AddVersion("vmodl.query.version.version1", "", "", 0, "vim25")
+AddVersion("vmodl.query.version.version2", "", "", 0, "vim25")
+AddVersion("vmodl.query.version.version3", "", "", 0, "vim25")
+AddVersionParent("vmodl.version.version0", "vmodl.version.version0")
+AddVersionParent("vmodl.version.version1", "vmodl.version.version0")
+AddVersionParent("vmodl.version.version1", "vmodl.version.version1")
+AddVersionParent("vmodl.query.version.version1", "vmodl.version.version0")
+AddVersionParent("vmodl.query.version.version1", "vmodl.query.version.version1")
+AddVersionParent("vmodl.query.version.version2", "vmodl.version.version0")
+AddVersionParent("vmodl.query.version.version2", "vmodl.version.version1")
+AddVersionParent("vmodl.query.version.version2", "vmodl.query.version.version1")
+AddVersionParent("vmodl.query.version.version2", "vmodl.query.version.version2")
+AddVersionParent("vmodl.query.version.version3", "vmodl.version.version0")
+AddVersionParent("vmodl.query.version.version3", "vmodl.version.version1")
+AddVersionParent("vmodl.query.version.version3", "vmodl.query.version.version1")
+AddVersionParent("vmodl.query.version.version3", "vmodl.query.version.version2")
+AddVersionParent("vmodl.query.version.version3", "vmodl.query.version.version3")
+
+CreateDataType("vmodl.DynamicArray", "DynamicArray", "vmodl.DataObject", "vmodl.version.version0", [("dynamicType", "string", "vmodl.version.version0", F_OPTIONAL), ("val", "anyType[]", "vmodl.version.version0", 0)])
+CreateDataType("vmodl.DynamicData", "DynamicData", "vmodl.DataObject", "vmodl.version.version0", [("dynamicType", "string", "vmodl.version.version0", F_OPTIONAL), ("dynamicProperty", "vmodl.DynamicProperty[]", "vmodl.version.version0", F_OPTIONAL)])
+CreateDataType("vmodl.DynamicProperty", "DynamicProperty", "vmodl.DataObject", "vmodl.version.version0", [("name", "vmodl.PropertyPath", "vmodl.version.version0", 0), ("val", "anyType", "vmodl.version.version0", 0)])
+CreateDataType("vmodl.KeyAnyValue", "KeyAnyValue", "vmodl.DynamicData", "vmodl.version.version1", [("key", "string", "vmodl.version.version1", 0), ("value", "anyType", "vmodl.version.version1", 0)])
+CreateDataType("vmodl.LocalizableMessage", "LocalizableMessage", "vmodl.DynamicData", "vmodl.version.version1", [("key", "string", "vmodl.version.version1", 0), ("arg", "vmodl.KeyAnyValue[]", "vmodl.version.version1", F_OPTIONAL), ("message", "string", "vmodl.version.version1", F_OPTIONAL)])
+CreateDataType("vmodl.fault.HostCommunication", "HostCommunication", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.HostNotConnected", "HostNotConnected", "vmodl.fault.HostCommunication", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.HostNotReachable", "HostNotReachable", "vmodl.fault.HostCommunication", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.InvalidArgument", "InvalidArgument", "vmodl.RuntimeFault", "vmodl.version.version0", [("invalidProperty", "vmodl.PropertyPath", "vmodl.version.version0", F_OPTIONAL)])
+CreateDataType("vmodl.fault.InvalidRequest", "InvalidRequest", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.InvalidType", "InvalidType", "vmodl.fault.InvalidRequest", "vmodl.version.version0", [("argument", "vmodl.PropertyPath", "vmodl.version.version0", F_OPTIONAL)])
+CreateDataType("vmodl.fault.ManagedObjectNotFound", "ManagedObjectNotFound", "vmodl.RuntimeFault", "vmodl.version.version0", [("obj", "vmodl.ManagedObject", "vmodl.version.version0", 0)])
+CreateDataType("vmodl.fault.MethodNotFound", "MethodNotFound", "vmodl.fault.InvalidRequest", "vmodl.version.version0", [("receiver", "vmodl.ManagedObject", "vmodl.version.version0", 0), ("method", "string", "vmodl.version.version0", 0)])
+CreateDataType("vmodl.fault.NotEnoughLicenses", "NotEnoughLicenses", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.NotImplemented", "NotImplemented", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.NotSupported", "NotSupported", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.RequestCanceled", "RequestCanceled", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.SecurityError", "SecurityError", "vmodl.RuntimeFault", "vmodl.version.version0", None)
+CreateDataType("vmodl.fault.SystemError", "SystemError", "vmodl.RuntimeFault", "vmodl.version.version0", [("reason", "string", "vmodl.version.version0", 0)])
+CreateDataType("vmodl.fault.UnexpectedFault", "UnexpectedFault", "vmodl.RuntimeFault", "vmodl.version.version0", [("faultName", "vmodl.TypeName", "vmodl.version.version0", 0), ("fault", "vmodl.MethodFault", "vmodl.version.version0", F_OPTIONAL)])
+CreateDataType("vmodl.query.InvalidCollectorVersion", "InvalidCollectorVersion", "vmodl.MethodFault", "vmodl.query.version.version1", None)
+CreateDataType("vmodl.query.InvalidProperty", "InvalidProperty", "vmodl.MethodFault", "vmodl.query.version.version1", [("name", "vmodl.PropertyPath", "vmodl.query.version.version1", 0)])
+CreateManagedType("vmodl.query.PropertyCollector", "PropertyCollector", "vmodl.ManagedObject", "vmodl.query.version.version1", [("filter", "vmodl.query.PropertyCollector.Filter[]", "vmodl.query.version.version1", F_OPTIONAL, "System.View")], [("createFilter", "CreateFilter", "vmodl.query.version.version1", (("spec", "vmodl.query.PropertyCollector.FilterSpec", "vmodl.query.version.version1", 0, None),("partialUpdates", "boolean", "vmodl.query.version.version1", 0, None),), (0, "vmodl.query.PropertyCollector.Filter", "vmodl.query.PropertyCollector.Filter"), "System.View", ["vmodl.query.InvalidProperty", ]), ("retrieveContents", "RetrieveProperties", "vmodl.query.version.version1", (("specSet", "vmodl.query.PropertyCollector.FilterSpec[]", "vmodl.query.version.version1", 0, None),), (F_OPTIONAL, "vmodl.query.PropertyCollector.ObjectContent[]", "vmodl.query.PropertyCollector.ObjectContent[]"), "System.Anonymous", ["vmodl.query.InvalidProperty", ]), ("checkForUpdates", "CheckForUpdates", "vmodl.query.version.version1", (("version", "string", "vmodl.query.version.version1", F_OPTIONAL, None),), (F_OPTIONAL, "vmodl.query.PropertyCollector.UpdateSet", "vmodl.query.PropertyCollector.UpdateSet"), "System.View", ["vmodl.query.InvalidCollectorVersion", ]), ("waitForUpdates", "WaitForUpdates", "vmodl.query.version.version1", (("version", "string", "vmodl.query.version.version1", F_OPTIONAL, None),), (0, "vmodl.query.PropertyCollector.UpdateSet", "vmodl.query.PropertyCollector.UpdateSet"), "System.View", ["vmodl.query.InvalidCollectorVersion", ]), ("cancelWaitForUpdates", "CancelWaitForUpdates", "vmodl.query.version.version1", (), (0, "void", "void"), "System.View", None), ("waitForUpdatesEx", "WaitForUpdatesEx", "vmodl.query.version.version3", (("version", "string", "vmodl.query.version.version3", F_OPTIONAL, None),("options", "vmodl.query.PropertyCollector.WaitOptions", "vmodl.query.version.version3", F_OPTIONAL, None),), (F_OPTIONAL, "vmodl.query.PropertyCollector.UpdateSet", "vmodl.query.PropertyCollector.UpdateSet"), "System.View", ["vmodl.query.InvalidCollectorVersion", ]), ("retrievePropertiesEx", "RetrievePropertiesEx", "vmodl.query.version.version3", (("specSet", "vmodl.query.PropertyCollector.FilterSpec[]", "vmodl.query.version.version3", 0, None),("options", "vmodl.query.PropertyCollector.RetrieveOptions", "vmodl.query.version.version3", 0, None),), (F_OPTIONAL, "vmodl.query.PropertyCollector.RetrieveResult", "vmodl.query.PropertyCollector.RetrieveResult"), "System.Anonymous", ["vmodl.query.InvalidProperty", ]), ("continueRetrievePropertiesEx", "ContinueRetrievePropertiesEx", "vmodl.query.version.version3", (("token", "string", "vmodl.query.version.version3", 0, None),), (0, "vmodl.query.PropertyCollector.RetrieveResult", "vmodl.query.PropertyCollector.RetrieveResult"), "System.Anonymous", ["vmodl.query.InvalidProperty", ]), ("cancelRetrievePropertiesEx", "CancelRetrievePropertiesEx", "vmodl.query.version.version3", (("token", "string", "vmodl.query.version.version3", 0, None),), (0, "void", "void"), "System.Anonymous", ["vmodl.query.InvalidProperty", ]), ("createPropertyCollector", "CreatePropertyCollector", "vmodl.query.version.version3", (), (0, "vmodl.query.PropertyCollector", "vmodl.query.PropertyCollector"), "System.View", None), ("destroy", "DestroyPropertyCollector", "vmodl.query.version.version3", (), (0, "void", "void"), "System.View", None)])
+CreateDataType("vmodl.query.PropertyCollector.FilterSpec", "PropertyFilterSpec", "vmodl.DynamicData", "vmodl.query.version.version1", [("propSet", "vmodl.query.PropertyCollector.PropertySpec[]", "vmodl.query.version.version1", 0), ("objectSet", "vmodl.query.PropertyCollector.ObjectSpec[]", "vmodl.query.version.version1", 0), ("reportMissingObjectsInResults", "boolean", "vmodl.query.version.version3", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.PropertySpec", "PropertySpec", "vmodl.DynamicData", "vmodl.query.version.version1", [("type", "vmodl.TypeName", "vmodl.query.version.version1", 0), ("all", "boolean", "vmodl.query.version.version1", F_OPTIONAL), ("pathSet", "vmodl.PropertyPath[]", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.ObjectSpec", "ObjectSpec", "vmodl.DynamicData", "vmodl.query.version.version1", [("obj", "vmodl.ManagedObject", "vmodl.query.version.version1", 0), ("skip", "boolean", "vmodl.query.version.version1", F_OPTIONAL), ("selectSet", "vmodl.query.PropertyCollector.SelectionSpec[]", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.SelectionSpec", "SelectionSpec", "vmodl.DynamicData", "vmodl.query.version.version1", [("name", "string", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.TraversalSpec", "TraversalSpec", "vmodl.query.PropertyCollector.SelectionSpec", "vmodl.query.version.version1", [("type", "vmodl.TypeName", "vmodl.query.version.version1", 0), ("path", "vmodl.PropertyPath", "vmodl.query.version.version1", 0), ("skip", "boolean", "vmodl.query.version.version1", F_OPTIONAL), ("selectSet", "vmodl.query.PropertyCollector.SelectionSpec[]", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateManagedType("vmodl.query.PropertyCollector.Filter", "PropertyFilter", "vmodl.ManagedObject", "vmodl.query.version.version1", [("spec", "vmodl.query.PropertyCollector.FilterSpec", "vmodl.query.version.version1", 0, None), ("partialUpdates", "boolean", "vmodl.query.version.version1", 0, None)], [("destroy", "DestroyPropertyFilter", "vmodl.query.version.version1", (), (0, "void", "void"), None, None)])
+CreateDataType("vmodl.query.PropertyCollector.ObjectContent", "ObjectContent", "vmodl.DynamicData", "vmodl.query.version.version1", [("obj", "vmodl.ManagedObject", "vmodl.query.version.version1", 0), ("propSet", "vmodl.DynamicProperty[]", "vmodl.query.version.version1", F_OPTIONAL), ("missingSet", "vmodl.query.PropertyCollector.MissingProperty[]", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.UpdateSet", "UpdateSet", "vmodl.DynamicData", "vmodl.query.version.version1", [("version", "string", "vmodl.query.version.version1", 0), ("filterSet", "vmodl.query.PropertyCollector.FilterUpdate[]", "vmodl.query.version.version1", F_OPTIONAL), ("truncated", "boolean", "vmodl.query.version.version3", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.FilterUpdate", "PropertyFilterUpdate", "vmodl.DynamicData", "vmodl.query.version.version1", [("filter", "vmodl.query.PropertyCollector.Filter", "vmodl.query.version.version1", 0), ("objectSet", "vmodl.query.PropertyCollector.ObjectUpdate[]", "vmodl.query.version.version1", F_OPTIONAL), ("missingSet", "vmodl.query.PropertyCollector.MissingObject[]", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.ObjectUpdate", "ObjectUpdate", "vmodl.DynamicData", "vmodl.query.version.version1", [("kind", "vmodl.query.PropertyCollector.ObjectUpdate.Kind", "vmodl.query.version.version1", 0), ("obj", "vmodl.ManagedObject", "vmodl.query.version.version1", 0), ("changeSet", "vmodl.query.PropertyCollector.Change[]", "vmodl.query.version.version1", F_OPTIONAL), ("missingSet", "vmodl.query.PropertyCollector.MissingProperty[]", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateEnumType("vmodl.query.PropertyCollector.ObjectUpdate.Kind", "ObjectUpdateKind", "vmodl.query.version.version1", ["modify", "enter", "leave"])
+CreateDataType("vmodl.query.PropertyCollector.Change", "PropertyChange", "vmodl.DynamicData", "vmodl.query.version.version1", [("name", "vmodl.PropertyPath", "vmodl.query.version.version1", 0), ("op", "vmodl.query.PropertyCollector.Change.Op", "vmodl.query.version.version1", 0), ("val", "anyType", "vmodl.query.version.version1", F_OPTIONAL)])
+CreateEnumType("vmodl.query.PropertyCollector.Change.Op", "PropertyChangeOp", "vmodl.query.version.version1", ["add", "remove", "assign", "indirectRemove"])
+CreateDataType("vmodl.query.PropertyCollector.MissingProperty", "MissingProperty", "vmodl.DynamicData", "vmodl.query.version.version1", [("path", "vmodl.PropertyPath", "vmodl.query.version.version1", 0), ("fault", "vmodl.MethodFault", "vmodl.query.version.version1", 0)])
+CreateDataType("vmodl.query.PropertyCollector.MissingObject", "MissingObject", "vmodl.DynamicData", "vmodl.query.version.version1", [("obj", "vmodl.ManagedObject", "vmodl.query.version.version1", 0), ("fault", "vmodl.MethodFault", "vmodl.query.version.version1", 0)])
+CreateDataType("vmodl.query.PropertyCollector.WaitOptions", "WaitOptions", "vmodl.DynamicData", "vmodl.query.version.version3", [("maxWaitSeconds", "int", "vmodl.query.version.version3", F_OPTIONAL), ("maxObjectUpdates", "int", "vmodl.query.version.version3", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.RetrieveOptions", "RetrieveOptions", "vmodl.DynamicData", "vmodl.query.version.version3", [("maxObjects", "int", "vmodl.query.version.version3", F_OPTIONAL)])
+CreateDataType("vmodl.query.PropertyCollector.RetrieveResult", "RetrieveResult", "vmodl.DynamicData", "vmodl.query.version.version3", [("token", "string", "vmodl.query.version.version3", F_OPTIONAL), ("objects", "vmodl.query.PropertyCollector.ObjectContent[]", "vmodl.query.version.version3", 0)])
@@ -0,0 +1,3 @@
+CoreTypes.py and ServerObjects.py were copied from the Python VIM SDK.
+
+VmomiSupport.py translates them to Ruby.
Oops, something went wrong.

0 comments on commit 4a23c51

Please sign in to comment.