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
#initialize(url, auth_scheme = :basic) ⇒ WbemClient
Returns 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 rescue nil
end
|
Instance Attribute Details
#auth_scheme ⇒ Object
Returns the value of attribute auth_scheme.
19
20
21
|
# File 'lib/wbem/wbem.rb', line 19
def auth_scheme
@auth_scheme
end
|
#product ⇒ Object
Returns the value of attribute product.
18
19
20
|
# File 'lib/wbem/wbem.rb', line 18
def product
@product
end
|
#response ⇒ Object
Returns the value of attribute response.
17
18
19
|
# File 'lib/wbem/wbem.rb', line 17
def response
@response
end
|
#url ⇒ Object
Returns the value of attribute url.
17
18
19
|
# File 'lib/wbem/wbem.rb', line 17
def url
@url
end
|
Instance Method Details
#class_names(op, deep_inheritance = false) ⇒ Object
return list of classnames for ObjectPath op
44
45
46
|
# File 'lib/wbem/wbem.rb', line 44
def class_names op, deep_inheritance=false
raise "#{self.class}.class_names not implemented"
end
|
#fault_string ⇒ Object
30
31
32
|
# File 'lib/wbem/wbem.rb', line 30
def fault_string
@client.fault_string
end
|
#network_class_name ⇒ Object
75
76
77
78
79
80
81
82
|
# File 'lib/wbem/wbem.rb', line 75
def network_class_name
case @product
when :winrm then "Win32_NetworkAdapter"
when :iamt then "CIM_NetworkPort"
else
"CIM_NetworkAdapter"
end
end
|
#networks(ns = "root/cimv2") ⇒ Object
83
84
85
86
|
# File 'lib/wbem/wbem.rb', line 83
def networks ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, network_class_name
end
|
#objectpath(namespace, classname) ⇒ Object
34
35
36
|
# File 'lib/wbem/wbem.rb', line 34
def objectpath namespace, classname
raise "#{self.class}.objectpath not implemented"
end
|
#processes(ns = "root/cimv2") ⇒ Object
71
72
73
74
|
# File 'lib/wbem/wbem.rb', line 71
def processes ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, (@product == :winrm) ? "Win32_Process" : "CIM_Process"
end
|
#response_code ⇒ Object
26
27
28
|
# File 'lib/wbem/wbem.rb', line 26
def response_code
@client.response_code
end
|
#service_class_name ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/wbem/wbem.rb', line 60
def service_class_name
case @product
when :winrm then "Win32_Service"
else
"CIM_Service"
end
end
|
#services(ns = "root/cimv2") ⇒ Object
67
68
69
70
|
# File 'lib/wbem/wbem.rb', line 67
def services ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, service_class_name
end
|
#storage_class_name ⇒ Object
87
88
89
90
91
92
93
94
|
# File 'lib/wbem/wbem.rb', line 87
def storage_class_name
case @product
when :winrm then "Win32_DiskDrive"
when :iamt then "CIM_StorageExtent"
else
"CIM_DiskDrive"
end
end
|
#storages(ns = "root/cimv2") ⇒ Object
95
96
97
98
|
# File 'lib/wbem/wbem.rb', line 95
def storages ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, storage_class_name
end
|
#system_class_name ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/wbem/wbem.rb', line 48
def system_class_name
case @product
when :winrm then "Win32_ComputerSystem"
else
"CIM_ComputerSystem"
end
end
|
#systems(ns = "root/cimv2") ⇒ Object
55
56
57
58
|
# File 'lib/wbem/wbem.rb', line 55
def systems ns="root/cimv2"
ns = "" if @product == :iamt
instance_names ns, system_class_name
end
|
#to_s ⇒ Object
38
39
40
|
# File 'lib/wbem/wbem.rb', line 38
def to_s
"#{@product}(#{@url})"
end
|