Class: Wbem::WbemClient
- Inherits:
-
Object
show all
- Defined in:
- lib/wbem/wbem.rb
Overview
WbemClient - base class for CimxmlClient and WsmanClient
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Constructor Details
- (WbemClient) initialize(url, auth_scheme = :basic)
A new instance of WbemClient
21
22
23
24
|
# File 'lib/wbem/wbem.rb', line 21
def initialize url, auth_scheme = :basic
@url = (url.is_a? URI) ? url : URI.parse(url)
@auth_scheme = auth_scheme.to_s.to_sym
end
|
Instance Attribute Details
- (Object) auth_scheme
Returns the value of attribute auth_scheme
19
20
21
|
# File 'lib/wbem/wbem.rb', line 19
def auth_scheme
@auth_scheme
end
|
- (Object) product
Returns the value of attribute product
18
19
20
|
# File 'lib/wbem/wbem.rb', line 18
def product
@product
end
|
- (Object) response
Returns the value of attribute response
17
18
19
|
# File 'lib/wbem/wbem.rb', line 17
def response
@response
end
|
- (Object) url
Returns the value of attribute url
17
18
19
|
# File 'lib/wbem/wbem.rb', line 17
def url
@url
end
|
Instance Method Details
- (Object) class_names(ns, deep_inheritance = false)
return list of classnames for namespace ns
67
68
69
|
# File 'lib/wbem/wbem.rb', line 67
def class_names ns, deep_inheritance=false
raise "#{self.class}.class_names not implemented"
end
|
- (Object) fault_string
30
31
32
|
# File 'lib/wbem/wbem.rb', line 30
def fault_string
@client.fault_string
end
|
- (Object) namespaces
return list of namespaces
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/wbem/wbem.rb', line 55
def namespaces
STDERR.puts "Namespaces for #{@url}"
result = []
['root', 'Interop', 'interop'].each do |ns|
["CIM_Namespace", "__Namespace", "__NAMESPACE"].each do |cn|
result.concat(_namespaces ns, cn)
end
end
result.uniq
end
|
- (Object) network_class_name
98
99
100
101
102
103
104
105
|
# File 'lib/wbem/wbem.rb', line 98
def network_class_name
case @product
when :winrm then "Win32_NetworkAdapter"
when :iamt then "CIM_NetworkPort"
else
"CIM_NetworkAdapter"
end
end
|
- (Object) networks(ns = "root/cimv2")
106
107
108
109
|
# File 'lib/wbem/wbem.rb', line 106
def networks ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, network_class_name
end
|
- (Object) objectpath(namespace, classname)
34
35
36
|
# File 'lib/wbem/wbem.rb', line 34
def objectpath namespace, classname
raise "#{self.class}.objectpath not implemented"
end
|
- (Object) processes(ns = "root/cimv2")
94
95
96
97
|
# File 'lib/wbem/wbem.rb', line 94
def processes ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, (@product == :winrm) ? "Win32_Process" : "CIM_Process"
end
|
- (Object) response_code
26
27
28
|
# File 'lib/wbem/wbem.rb', line 26
def response_code
@client.response_code
end
|
- (Object) service_class_name
83
84
85
86
87
88
89
|
# File 'lib/wbem/wbem.rb', line 83
def service_class_name
case @product
when :winrm then "Win32_Service"
else
"CIM_Service"
end
end
|
- (Object) services(ns = "root/cimv2")
90
91
92
93
|
# File 'lib/wbem/wbem.rb', line 90
def services ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, service_class_name
end
|
- (Object) storage_class_name
110
111
112
113
114
115
116
117
|
# File 'lib/wbem/wbem.rb', line 110
def storage_class_name
case @product
when :winrm then "Win32_DiskDrive"
when :iamt then "CIM_StorageExtent"
else
"CIM_DiskDrive"
end
end
|
- (Object) storages(ns = "root/cimv2")
118
119
120
121
|
# File 'lib/wbem/wbem.rb', line 118
def storages ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, storage_class_name
end
|
- (Object) system_class_name
71
72
73
74
75
76
77
|
# File 'lib/wbem/wbem.rb', line 71
def system_class_name
case @product
when :winrm then "Win32_ComputerSystem"
else
"CIM_ComputerSystem"
end
end
|
- (Object) systems(ns = "root/cimv2")
78
79
80
81
|
# File 'lib/wbem/wbem.rb', line 78
def systems ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, system_class_name
end
|