Class: Wbem::CimxmlClient
- Inherits:
-
WbemClient
- Object
- WbemClient
- Wbem::CimxmlClient
- Defined in:
- lib/wbem/cimxml.rb
Instance Attribute Summary
Attributes inherited from WbemClient
#auth_scheme, #product, #response, #url
Instance Method Summary collapse
-
#class_names(namespace, deep_inheritance = false) ⇒ Object
Return list of classnames for given namespace.
-
#each_instance(ns, cn) ⇒ Object
Return instances for namespace and classname.
-
#initialize(url, auth_scheme = nil) ⇒ CimxmlClient
constructor
A new instance of CimxmlClient.
-
#instance_names(namespace, classname) ⇒ Object
Return list of Wbem::EndpointReference (object pathes) for instances of namespace, classname.
- #objectpath(namespace, classname = nil) ⇒ Object
Methods inherited from WbemClient
#fault_string, #namespaces, #networks, #processes, #response_code, #services, #storages, #systems
Constructor Details
#initialize(url, auth_scheme = nil) ⇒ CimxmlClient
Returns a new instance of CimxmlClient.
37 38 39 40 41 42 43 |
# File 'lib/wbem/cimxml.rb', line 37 def initialize url, auth_scheme = nil super url, auth_scheme STDERR.puts "CIMXML.connect >#{url}<" @client = Sfcc::Cim::Client.connect( { :uri => url, :verify => false } ) STDERR.puts "CIMXML.connect #{url} -> #{@client}" if Wbem.debug _identify end |
Instance Method Details
#class_names(namespace, deep_inheritance = false) ⇒ Object
Return list of classnames for given namespace
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/wbem/cimxml.rb', line 65 def class_names namespace, deep_inheritance = false STDERR.puts "#{@client}.class_names(#{namespace})" ret = [] op = Sfcc::Cim::ObjectPath.new(namespace) flags = deep_inheritance ? Sfcc::Flags::DeepInheritance : 0 begin @client.class_names(op,flags).each do |name| ret << name.to_s end rescue Sfcc::Cim::ErrorInvalidNamespace end ret end |
#each_instance(ns, cn) ⇒ Object
Return instances for namespace and classname
52 53 54 55 56 57 58 59 60 |
# File 'lib/wbem/cimxml.rb', line 52 def each_instance( ns, cn ) op = objectpath ns, cn begin @client.instances(op).each do |inst| yield inst end rescue Sfcc::Cim::ErrorInvalidClass, Sfcc::Cim::ErrorInvalidNamespace end end |
#instance_names(namespace, classname) ⇒ Object
Return list of Wbem::EndpointReference (object pathes) for instances
of namespace, classname
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/wbem/cimxml.rb', line 83 def instance_names namespace, classname objectpath = Sfcc::Cim::ObjectPath.new(namespace,classname) STDERR.puts "#{@client}.instance_names(#{objectpath})" ret = [] begin @client.instance_names(objectpath).each do |path| path.namespace = namespace # add missing data ret << path end rescue Sfcc::Cim::ErrorInvalidClass, Sfcc::Cim::ErrorInvalidNamespace end ret end |
#objectpath(namespace, classname = nil) ⇒ Object
45 46 47 |
# File 'lib/wbem/cimxml.rb', line 45 def objectpath namespace, classname = nil Sfcc::Cim::ObjectPath.new(namespace, classname) end |