| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package XAS::Lib::WS::Manage; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use XAS::Class |
|
6
|
1
|
|
|
|
|
18
|
version => $VERSION, |
|
7
|
|
|
|
|
|
|
base => 'XAS::Lib::WS::Base', |
|
8
|
|
|
|
|
|
|
utils => ':validation dotid', |
|
9
|
|
|
|
|
|
|
constants => 'SCALAR HASHREF ARRAYREF', |
|
10
|
1
|
|
|
1
|
|
2004
|
; |
|
|
1
|
|
|
|
|
1
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#use Data::Dumper; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
15
|
|
|
|
|
|
|
# Public Methods |
|
16
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub create { |
|
19
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
20
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
21
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
22
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
23
|
|
|
|
|
|
|
-selector => { type => SCALAR }, |
|
24
|
|
|
|
|
|
|
-xml => { type => SCALAR }, |
|
25
|
|
|
|
|
|
|
}); |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $data = $p->{'xml'}; |
|
28
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
29
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
30
|
0
|
|
|
|
|
|
my $selector = $p->{'selector'}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $uuid = $self->uuid->create_str; |
|
35
|
0
|
|
|
|
|
|
my $xml = $self->_create_xml($uuid, $object, $selector, $data); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $self->_create_response($uuid); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub delete { |
|
44
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
45
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
46
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
47
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
48
|
|
|
|
|
|
|
-selector => { type => SCALAR }, |
|
49
|
|
|
|
|
|
|
}); |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
52
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
53
|
0
|
|
|
|
|
|
my $selector = $p->{'selector'}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $uuid = $self->uuid->create_str; |
|
58
|
0
|
|
|
|
|
|
my $xml = $self->_delete_xml($uuid, $object, $selector); |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $self->_delete_response($uuid); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub enumerate { |
|
67
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
68
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
69
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
70
|
|
|
|
|
|
|
-selector => { optional => 1, type => HASHREF, default => undef }, |
|
71
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
72
|
|
|
|
|
|
|
}); |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
75
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
76
|
0
|
|
|
|
|
|
my $selector = $p->{'selector'}; |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $xml; |
|
81
|
0
|
|
|
|
|
|
my $uuid = $self->uuid->create_str; |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if (defined($selector)) { |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$xml = $self->_enumerate_filter_xml($uuid, $object, $selector) |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} else { |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
$xml = $self->_enumerate_xml($uuid, $object) |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return $self->_enumerate_response($uuid, $resource, $class); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub get { |
|
100
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
101
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
102
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
103
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
104
|
|
|
|
|
|
|
-selector => { type => HASHREF } |
|
105
|
|
|
|
|
|
|
}); |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
108
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
109
|
0
|
|
|
|
|
|
my $selector = $p->{'selector'}; |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my $uuid = $self->uuid->create_str; |
|
114
|
0
|
|
|
|
|
|
my $xml = $self->_get_xml($uuid, $object, $selector); |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
return $self->_get_response($uuid, $class); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub invoke { |
|
123
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
124
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
125
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
126
|
|
|
|
|
|
|
-action => { type => SCALAR }, |
|
127
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
128
|
|
|
|
|
|
|
-selector => { type => HASHREF }, |
|
129
|
|
|
|
|
|
|
}); |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
132
|
0
|
|
|
|
|
|
my $action = $p->{'action'}; |
|
133
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
134
|
0
|
|
|
|
|
|
my $selector = $p->{'selector'}; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
137
|
0
|
|
|
|
|
|
my $oaction = sprintf('%s/%s', $object, $action); |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $uuid = $self->uuid->create_str; |
|
140
|
0
|
|
|
|
|
|
my $xml = $self->_invoke_xml($uuid, $object, $oaction, $action, $selector); |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
143
|
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
return $self->_invoke_response($uuid, $class, $action); |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub pull { |
|
149
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
150
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
151
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
152
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
153
|
|
|
|
|
|
|
-context => { type => SCALAR }, |
|
154
|
|
|
|
|
|
|
-items => { type => ARRAYREF }, |
|
155
|
|
|
|
|
|
|
}); |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
my $items = $p->{'items'}; |
|
158
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
159
|
0
|
|
|
|
|
|
my $context = $p->{'context'}; |
|
160
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
161
|
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
my $xml; |
|
165
|
|
|
|
|
|
|
my $uuid; |
|
166
|
0
|
|
|
|
|
|
my $running; |
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
do { |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
$uuid = $self->uuid->create_str; |
|
171
|
0
|
|
|
|
|
|
$xml = $self->_pull_xml($uuid, $object, $context); |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
174
|
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
$context = $self->_pull_response($uuid, $class, $items); |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
} while ($context); |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub put { |
|
182
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
183
|
0
|
|
|
|
|
|
my $p = validate_params(\@_, { |
|
184
|
|
|
|
|
|
|
-resource => { optional => 1, default => 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' }, |
|
185
|
|
|
|
|
|
|
-class => { type => SCALAR }, |
|
186
|
|
|
|
|
|
|
-key => { type => SCALAR }, |
|
187
|
|
|
|
|
|
|
-value => { type => SCALAR }, |
|
188
|
|
|
|
|
|
|
-data => { type => HASHREF }, |
|
189
|
|
|
|
|
|
|
}); |
|
190
|
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
my $key = $p->{'key'}; |
|
192
|
0
|
|
|
|
|
|
my $data = $p->{'data'}; |
|
193
|
0
|
|
|
|
|
|
my $value = $p->{'value'}; |
|
194
|
0
|
|
|
|
|
|
my $class = $p->{'class'}; |
|
195
|
0
|
|
|
|
|
|
my $resource = $p->{'resource'}; |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
my $object = sprintf('%s/%s', $resource, $class); |
|
198
|
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
my $uuid = $self->uuid->create_str; |
|
200
|
0
|
|
|
|
|
|
my $xml = $self->_put_xml($uuid, $object, $class, $key, $value, $data); |
|
201
|
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
$self->_make_call($xml); |
|
203
|
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
return $self->_put_response($uuid, $class); |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
209
|
|
|
|
|
|
|
# Private Methods |
|
210
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub _create_response { |
|
213
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
214
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
215
|
|
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
my $stat = 0; |
|
217
|
0
|
|
|
|
|
|
my $xpath = '//t:ResourceCreated'; |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
$self->log->debug('entering - _create_response()'); |
|
220
|
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
222
|
0
|
|
|
|
|
|
$self->_check_action('CreateResponse'); |
|
223
|
|
|
|
|
|
|
|
|
224
|
0
|
0
|
|
|
|
|
$stat = 1 if ($self->xml->get_item($xpath)); |
|
225
|
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
|
return $stat; |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub _delete_response { |
|
231
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
232
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
233
|
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
|
$self->log->debug('entering - _delete_response()'); |
|
235
|
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
237
|
0
|
|
|
|
|
|
$self->_check_action('DeleteResponse'); |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
return 1; |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub _enumerate_response { |
|
244
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
245
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
246
|
0
|
|
|
|
|
|
my $resource = shift; |
|
247
|
0
|
|
|
|
|
|
my $class = shift; |
|
248
|
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
my @items; |
|
250
|
|
|
|
|
|
|
my $context; |
|
251
|
0
|
|
|
|
|
|
my $xpath = "//n:EnumerationContext"; |
|
252
|
|
|
|
|
|
|
|
|
253
|
0
|
|
|
|
|
|
$self->log->debug('entering - _enumerate_response()'); |
|
254
|
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
256
|
0
|
|
|
|
|
|
$self->_check_action('EnumerateResponse'); |
|
257
|
|
|
|
|
|
|
|
|
258
|
0
|
0
|
|
|
|
|
if (my $value = $self->xml->get_item($xpath)) { |
|
259
|
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
($context) = $value =~ /uuid:(.*)/; |
|
261
|
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
$self->pull( |
|
263
|
|
|
|
|
|
|
-resource => $resource, |
|
264
|
|
|
|
|
|
|
-class => $class, |
|
265
|
|
|
|
|
|
|
-context => $context, |
|
266
|
|
|
|
|
|
|
-items => \@items |
|
267
|
|
|
|
|
|
|
); |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
0
|
0
|
|
|
|
|
return wantarray ? @items : \@items; |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub _get_response { |
|
276
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
277
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
278
|
0
|
|
|
|
|
|
my $class = shift; |
|
279
|
|
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
|
my $hash; |
|
281
|
0
|
|
|
|
|
|
my $xpath = "//p:$class"; |
|
282
|
|
|
|
|
|
|
|
|
283
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
284
|
0
|
|
|
|
|
|
$self->_check_action('GetResponse'); |
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
0
|
|
|
|
|
if (my $elements = $self->xml->get_items($xpath)) { |
|
287
|
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
|
$hash = $self->_get_items($elements); |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
} else { |
|
291
|
|
|
|
|
|
|
|
|
292
|
0
|
|
|
|
|
|
$self->throw_msg( |
|
293
|
|
|
|
|
|
|
dotid($self->class) . '.get_response.noxpath', |
|
294
|
|
|
|
|
|
|
'ws_noxpath', |
|
295
|
|
|
|
|
|
|
$xpath |
|
296
|
|
|
|
|
|
|
); |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
} |
|
299
|
|
|
|
|
|
|
|
|
300
|
0
|
|
|
|
|
|
return $hash; |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub _invoke_response { |
|
305
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
306
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
307
|
0
|
|
|
|
|
|
my $class = shift; |
|
308
|
0
|
|
|
|
|
|
my $action = shift; |
|
309
|
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
my $rc = -1; |
|
311
|
0
|
|
|
|
|
|
my $response = sprintf('%sResponse', $action); |
|
312
|
0
|
|
|
|
|
|
my $xpath = sprintf('//p:%s_OUTPUT', $action); |
|
313
|
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
315
|
0
|
|
|
|
|
|
$self->_check_action($response); |
|
316
|
|
|
|
|
|
|
|
|
317
|
0
|
0
|
|
|
|
|
if (my $elements = $self->xml->get_items($xpath)) { |
|
318
|
|
|
|
|
|
|
|
|
319
|
0
|
|
|
|
|
|
foreach my $element (@$elements) { |
|
320
|
|
|
|
|
|
|
|
|
321
|
0
|
0
|
|
|
|
|
if ($element->localname =~ /ReturnValue/) { |
|
322
|
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
$rc = $element->textContent; |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
} |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
} |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
} else { |
|
330
|
|
|
|
|
|
|
|
|
331
|
0
|
|
|
|
|
|
$self->throw_msg( |
|
332
|
|
|
|
|
|
|
dotid($self->class) . '.get_response.noxpath', |
|
333
|
|
|
|
|
|
|
'ws_noxpath', |
|
334
|
|
|
|
|
|
|
$xpath |
|
335
|
|
|
|
|
|
|
); |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
} |
|
338
|
|
|
|
|
|
|
|
|
339
|
0
|
|
|
|
|
|
return $rc; |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
sub _pull_response { |
|
344
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
345
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
346
|
0
|
|
|
|
|
|
my $class = shift; |
|
347
|
0
|
|
|
|
|
|
my $items = shift; |
|
348
|
|
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
my $context = undef; |
|
350
|
|
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
352
|
0
|
|
|
|
|
|
$self->_check_action('PullResponse'); |
|
353
|
|
|
|
|
|
|
|
|
354
|
0
|
0
|
|
|
|
|
if (my $value = $self->xml->get_item('//n:EnumerationContext')) { |
|
355
|
|
|
|
|
|
|
|
|
356
|
0
|
|
|
|
|
|
($context) = $value =~ /uuid:(.*)/; |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
} |
|
359
|
|
|
|
|
|
|
|
|
360
|
0
|
|
|
|
|
|
$self->_get_enum_items($class, $items); |
|
361
|
|
|
|
|
|
|
|
|
362
|
0
|
|
|
|
|
|
return $context; |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
} |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub _put_response { |
|
367
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
368
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
369
|
0
|
|
|
|
|
|
my $class = shift; |
|
370
|
|
|
|
|
|
|
|
|
371
|
0
|
|
|
|
|
|
my $hash; |
|
372
|
0
|
|
|
|
|
|
my $xpath = "//p:$class"; |
|
373
|
|
|
|
|
|
|
|
|
374
|
0
|
|
|
|
|
|
$self->_check_relates_to($uuid); |
|
375
|
0
|
|
|
|
|
|
$self->_check_action('PutResponse'); |
|
376
|
|
|
|
|
|
|
|
|
377
|
0
|
0
|
|
|
|
|
if (my $elements = $self->xml->get_items($xpath)) { |
|
378
|
|
|
|
|
|
|
|
|
379
|
0
|
|
|
|
|
|
$hash = $self->_get_items($elements); |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
} else { |
|
382
|
|
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
$self->throw_msg( |
|
384
|
|
|
|
|
|
|
dotid($self->class) . '.put_response.noxpath', |
|
385
|
|
|
|
|
|
|
'ws_noxpath', |
|
386
|
|
|
|
|
|
|
$xpath |
|
387
|
|
|
|
|
|
|
); |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
} |
|
390
|
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
return $hash; |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub _get_enum_items { |
|
396
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
397
|
0
|
|
|
|
|
|
my $class = shift; |
|
398
|
0
|
|
|
|
|
|
my $items = shift; |
|
399
|
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
|
my $xpath = sprintf('//p:%s', $class); |
|
401
|
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
|
$self->log->debug('entering _get_enum_items()'); |
|
403
|
|
|
|
|
|
|
|
|
404
|
0
|
0
|
|
|
|
|
if (my $elements = $self->xml->get_items($xpath)) { |
|
405
|
|
|
|
|
|
|
|
|
406
|
0
|
|
|
|
|
|
my $hash = $self->_get_items($elements); |
|
407
|
|
|
|
|
|
|
|
|
408
|
0
|
|
|
|
|
|
push(@$items, $hash); |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
} else { |
|
411
|
|
|
|
|
|
|
|
|
412
|
0
|
|
|
|
|
|
$self->throw_msg( |
|
413
|
|
|
|
|
|
|
dotid($self->class) . '.get_enum_items.noxpath', |
|
414
|
|
|
|
|
|
|
'ws_noxpath', |
|
415
|
|
|
|
|
|
|
$xpath |
|
416
|
|
|
|
|
|
|
); |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
} |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
} |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub _get_items { |
|
423
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
424
|
0
|
|
|
|
|
|
my $elements = shift; |
|
425
|
|
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
my $hash = {}; |
|
427
|
|
|
|
|
|
|
|
|
428
|
0
|
|
|
|
|
|
foreach my $element (@$elements) { |
|
429
|
|
|
|
|
|
|
|
|
430
|
0
|
|
|
|
|
|
my $key = $element->localname; |
|
431
|
0
|
|
|
|
|
|
my $value = $element->textContent; |
|
432
|
|
|
|
|
|
|
|
|
433
|
0
|
|
|
|
|
|
$hash->{$key} = $value; |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
} |
|
436
|
|
|
|
|
|
|
|
|
437
|
0
|
|
|
|
|
|
return $hash; |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
} |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
442
|
|
|
|
|
|
|
# XML boilerplate - we're using heredoc for simplcity |
|
443
|
|
|
|
|
|
|
# |
|
444
|
|
|
|
|
|
|
# XML for ws-manage Manage was taken from |
|
445
|
|
|
|
|
|
|
# https://msdn.microsoft.com/en-us/library/cc251705.aspx |
|
446
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
sub _create_xml { |
|
449
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
450
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
451
|
0
|
|
|
|
|
|
my $resource = shift; |
|
452
|
0
|
|
|
|
|
|
my $params = shift; |
|
453
|
0
|
|
|
|
|
|
my $xml_data = shift; |
|
454
|
|
|
|
|
|
|
|
|
455
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
456
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
457
|
|
|
|
|
|
|
|
|
458
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
459
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
460
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
461
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
462
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" |
|
463
|
|
|
|
|
|
|
xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"> |
|
464
|
|
|
|
|
|
|
<s:Header> |
|
465
|
|
|
|
|
|
|
<a:To> |
|
466
|
|
|
|
|
|
|
$url |
|
467
|
|
|
|
|
|
|
</a:To> |
|
468
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
469
|
|
|
|
|
|
|
$resource |
|
470
|
|
|
|
|
|
|
</w:ResourceURI> |
|
471
|
|
|
|
|
|
|
<a:ReplyTo> |
|
472
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
473
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
474
|
|
|
|
|
|
|
</a:Address> |
|
475
|
|
|
|
|
|
|
</a:ReplyTo> |
|
476
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
477
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/transfer/Create |
|
478
|
|
|
|
|
|
|
</a:Action> |
|
479
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
480
|
|
|
|
|
|
|
512000 |
|
481
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
482
|
|
|
|
|
|
|
<a:MessageID> |
|
483
|
|
|
|
|
|
|
uuid:$uuid |
|
484
|
|
|
|
|
|
|
</a:MessageID> |
|
485
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
486
|
|
|
|
|
|
|
<p:DataLocale xml:lang="en-US" s:mustUnderstand="false"/> |
|
487
|
|
|
|
|
|
|
<w:SelectorSet> |
|
488
|
|
|
|
|
|
|
__SELECTOR__ |
|
489
|
|
|
|
|
|
|
</w:SelectorSet> |
|
490
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
491
|
|
|
|
|
|
|
</s:Header> |
|
492
|
|
|
|
|
|
|
<s:Body> |
|
493
|
|
|
|
|
|
|
$xml_data |
|
494
|
|
|
|
|
|
|
</s:Body> |
|
495
|
|
|
|
|
|
|
</s:Envelope> |
|
496
|
|
|
|
|
|
|
XML |
|
497
|
|
|
|
|
|
|
|
|
498
|
0
|
|
|
|
|
|
my $selector = ''; |
|
499
|
|
|
|
|
|
|
|
|
500
|
0
|
|
|
|
|
|
while (my ($key, $value) = each(%$params)) { |
|
501
|
|
|
|
|
|
|
|
|
502
|
0
|
|
|
|
|
|
$selector .= sprintf("<w:Selector Name=\"%s\">%s</w:Selector>\n", $key, $value); |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
} |
|
505
|
|
|
|
|
|
|
|
|
506
|
0
|
|
|
|
|
|
chomp $selector; |
|
507
|
|
|
|
|
|
|
|
|
508
|
0
|
|
|
|
|
|
$xml =~ s/__SELECTOR__/$selector/; |
|
509
|
|
|
|
|
|
|
|
|
510
|
0
|
|
|
|
|
|
return $xml; |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
} |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
sub _delete_xml { |
|
515
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
516
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
517
|
0
|
|
|
|
|
|
my $resource = shift; |
|
518
|
0
|
|
|
|
|
|
my $params = shift; |
|
519
|
|
|
|
|
|
|
|
|
520
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
521
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
522
|
|
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
524
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
525
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
526
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
527
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> |
|
528
|
|
|
|
|
|
|
<s:Header> |
|
529
|
|
|
|
|
|
|
<a:To> |
|
530
|
|
|
|
|
|
|
$url |
|
531
|
|
|
|
|
|
|
</a:To> |
|
532
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
533
|
|
|
|
|
|
|
$resource |
|
534
|
|
|
|
|
|
|
</w:ResourceURI> |
|
535
|
|
|
|
|
|
|
<a:ReplyTo> |
|
536
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
537
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
538
|
|
|
|
|
|
|
</a:Address> |
|
539
|
|
|
|
|
|
|
</a:ReplyTo> |
|
540
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
541
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete |
|
542
|
|
|
|
|
|
|
</a:Action> |
|
543
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
544
|
|
|
|
|
|
|
512000 |
|
545
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
546
|
|
|
|
|
|
|
<a:MessageID> |
|
547
|
|
|
|
|
|
|
uuid:$uuid |
|
548
|
|
|
|
|
|
|
</a:MessageID> |
|
549
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
550
|
|
|
|
|
|
|
<w:SelectorSet> |
|
551
|
|
|
|
|
|
|
__SELECTOR__ |
|
552
|
|
|
|
|
|
|
</w:SelectorSet> |
|
553
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
554
|
|
|
|
|
|
|
</s:Header> |
|
555
|
|
|
|
|
|
|
<s:Body/> |
|
556
|
|
|
|
|
|
|
</s:Envelope> |
|
557
|
|
|
|
|
|
|
XML |
|
558
|
|
|
|
|
|
|
|
|
559
|
0
|
|
|
|
|
|
my $selector = ''; |
|
560
|
|
|
|
|
|
|
|
|
561
|
0
|
|
|
|
|
|
while (my ($key, $value) = each(%$params)) { |
|
562
|
|
|
|
|
|
|
|
|
563
|
0
|
|
|
|
|
|
$selector .= sprintf("<w:Selector Name=\"%s\">%s</w:Selector>\n", $key, $value); |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
} |
|
566
|
|
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
|
chomp $selector; |
|
568
|
|
|
|
|
|
|
|
|
569
|
0
|
|
|
|
|
|
$xml =~ s/__SELECTOR__/$selector/; |
|
570
|
|
|
|
|
|
|
|
|
571
|
0
|
|
|
|
|
|
return $xml; |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
} |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
sub _enumerate_xml { |
|
576
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
577
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
578
|
0
|
|
|
|
|
|
my $resource = shift; |
|
579
|
|
|
|
|
|
|
|
|
580
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
581
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
582
|
|
|
|
|
|
|
|
|
583
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
584
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
585
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
586
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
587
|
|
|
|
|
|
|
xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" |
|
588
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" |
|
589
|
|
|
|
|
|
|
xmlns:b="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd"> |
|
590
|
|
|
|
|
|
|
<s:Header> |
|
591
|
|
|
|
|
|
|
<a:To> |
|
592
|
|
|
|
|
|
|
$url |
|
593
|
|
|
|
|
|
|
</a:To> |
|
594
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
595
|
|
|
|
|
|
|
$resource |
|
596
|
|
|
|
|
|
|
</w:ResourceURI> |
|
597
|
|
|
|
|
|
|
<a:ReplyTo> |
|
598
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
599
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
600
|
|
|
|
|
|
|
</a:Address> |
|
601
|
|
|
|
|
|
|
</a:ReplyTo> |
|
602
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
603
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate |
|
604
|
|
|
|
|
|
|
</a:Action> |
|
605
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
606
|
|
|
|
|
|
|
512000 |
|
607
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
608
|
|
|
|
|
|
|
<a:MessageID> |
|
609
|
|
|
|
|
|
|
uuid:$uuid |
|
610
|
|
|
|
|
|
|
</a:MessageID> |
|
611
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
612
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
613
|
|
|
|
|
|
|
</s:Header> |
|
614
|
|
|
|
|
|
|
<s:Body> |
|
615
|
|
|
|
|
|
|
<n:Enumerate/> |
|
616
|
|
|
|
|
|
|
</s:Body> |
|
617
|
|
|
|
|
|
|
</s:Envelope> |
|
618
|
|
|
|
|
|
|
XML |
|
619
|
|
|
|
|
|
|
|
|
620
|
0
|
|
|
|
|
|
return $xml; |
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
} |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
sub _enumerate_filter_xml { |
|
625
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
626
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
627
|
0
|
|
|
|
|
|
my $resource = shift; |
|
628
|
0
|
|
|
|
|
|
my $params = shift; |
|
629
|
|
|
|
|
|
|
|
|
630
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
631
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
632
|
|
|
|
|
|
|
|
|
633
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
634
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
635
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
636
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
637
|
|
|
|
|
|
|
xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" |
|
638
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" |
|
639
|
|
|
|
|
|
|
xmlns:b="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd"> |
|
640
|
|
|
|
|
|
|
<s:Header> |
|
641
|
|
|
|
|
|
|
<a:To> |
|
642
|
|
|
|
|
|
|
$url |
|
643
|
|
|
|
|
|
|
</a:To> |
|
644
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
645
|
|
|
|
|
|
|
$resource |
|
646
|
|
|
|
|
|
|
</w:ResourceURI> |
|
647
|
|
|
|
|
|
|
<a:ReplyTo> |
|
648
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
649
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
650
|
|
|
|
|
|
|
</a:Address> |
|
651
|
|
|
|
|
|
|
</a:ReplyTo> |
|
652
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
653
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate |
|
654
|
|
|
|
|
|
|
</a:Action> |
|
655
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
656
|
|
|
|
|
|
|
512000 |
|
657
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
658
|
|
|
|
|
|
|
<a:MessageID> |
|
659
|
|
|
|
|
|
|
uuid:$uuid |
|
660
|
|
|
|
|
|
|
</a:MessageID> |
|
661
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
662
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
663
|
|
|
|
|
|
|
</s:Header> |
|
664
|
|
|
|
|
|
|
<s:Body> |
|
665
|
|
|
|
|
|
|
<n:Enumerate> |
|
666
|
|
|
|
|
|
|
<w:Filter Dialect="http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter"> |
|
667
|
|
|
|
|
|
|
<w:SelectorSet> |
|
668
|
|
|
|
|
|
|
__SELECTOR__ |
|
669
|
|
|
|
|
|
|
</w:SelectorSet> |
|
670
|
|
|
|
|
|
|
</w:Filter> |
|
671
|
|
|
|
|
|
|
</n:Enumerate> |
|
672
|
|
|
|
|
|
|
</s:Body> |
|
673
|
|
|
|
|
|
|
</s:Envelope> |
|
674
|
|
|
|
|
|
|
XML |
|
675
|
|
|
|
|
|
|
|
|
676
|
0
|
|
|
|
|
|
my $selector = ''; |
|
677
|
|
|
|
|
|
|
|
|
678
|
0
|
|
|
|
|
|
while (my ($key, $value) = each(%$params)) { |
|
679
|
|
|
|
|
|
|
|
|
680
|
0
|
|
|
|
|
|
$selector .= sprintf("<w:Selector Name=\"%s\">%s</w:Selector>\n", $key, $value); |
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
} |
|
683
|
|
|
|
|
|
|
|
|
684
|
0
|
|
|
|
|
|
chomp $selector; |
|
685
|
|
|
|
|
|
|
|
|
686
|
0
|
|
|
|
|
|
$xml =~ s/__SELECTOR__/$selector/; |
|
687
|
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
|
return $xml; |
|
689
|
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
} |
|
691
|
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
sub _get_xml { |
|
693
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
694
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
695
|
0
|
|
|
|
|
|
my $resource = shift; |
|
696
|
0
|
|
|
|
|
|
my $params = shift; |
|
697
|
|
|
|
|
|
|
|
|
698
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
699
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
700
|
|
|
|
|
|
|
|
|
701
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
702
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
703
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
704
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
705
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> |
|
706
|
|
|
|
|
|
|
<s:Header> |
|
707
|
|
|
|
|
|
|
<a:To> |
|
708
|
|
|
|
|
|
|
$url |
|
709
|
|
|
|
|
|
|
</a:To> |
|
710
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
711
|
|
|
|
|
|
|
$resource |
|
712
|
|
|
|
|
|
|
</w:ResourceURI> |
|
713
|
|
|
|
|
|
|
<a:ReplyTo> |
|
714
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
715
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
716
|
|
|
|
|
|
|
</a:Address> |
|
717
|
|
|
|
|
|
|
</a:ReplyTo> |
|
718
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
719
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/transfer/Get |
|
720
|
|
|
|
|
|
|
</a:Action> |
|
721
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
722
|
|
|
|
|
|
|
512000 |
|
723
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
724
|
|
|
|
|
|
|
<a:MessageID> |
|
725
|
|
|
|
|
|
|
uuid:$uuid |
|
726
|
|
|
|
|
|
|
</a:MessageID> |
|
727
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
728
|
|
|
|
|
|
|
<w:SelectorSet> |
|
729
|
|
|
|
|
|
|
__SELECTOR__ |
|
730
|
|
|
|
|
|
|
</w:SelectorSet> |
|
731
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
732
|
|
|
|
|
|
|
</s:Header> |
|
733
|
|
|
|
|
|
|
<s:Body/> |
|
734
|
|
|
|
|
|
|
</s:Envelope> |
|
735
|
|
|
|
|
|
|
XML |
|
736
|
|
|
|
|
|
|
|
|
737
|
0
|
|
|
|
|
|
my $selector = ''; |
|
738
|
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
|
while (my ($key, $value) = each(%$params)) { |
|
740
|
|
|
|
|
|
|
|
|
741
|
0
|
|
|
|
|
|
$selector .= sprintf("<w:Selector Name=\"%s\">%s</w:Selector>\n", $key, $value); |
|
742
|
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
} |
|
744
|
|
|
|
|
|
|
|
|
745
|
0
|
|
|
|
|
|
chomp $selector; |
|
746
|
|
|
|
|
|
|
|
|
747
|
0
|
|
|
|
|
|
$xml =~ s/__SELECTOR__/$selector/; |
|
748
|
|
|
|
|
|
|
|
|
749
|
0
|
|
|
|
|
|
return $xml; |
|
750
|
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
} |
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
sub _invoke_xml { |
|
754
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
755
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
756
|
0
|
|
|
|
|
|
my $resource = shift; |
|
757
|
0
|
|
|
|
|
|
my $oaction = shift; |
|
758
|
0
|
|
|
|
|
|
my $action = shift; |
|
759
|
0
|
|
|
|
|
|
my $params = shift; |
|
760
|
|
|
|
|
|
|
|
|
761
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
762
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
763
|
0
|
|
|
|
|
|
my $input = sprintf('%s_INPUT', $action); |
|
764
|
|
|
|
|
|
|
|
|
765
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
766
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
767
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
768
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
769
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" |
|
770
|
|
|
|
|
|
|
xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"> |
|
771
|
|
|
|
|
|
|
<s:Header> |
|
772
|
|
|
|
|
|
|
<a:To> |
|
773
|
|
|
|
|
|
|
$url |
|
774
|
|
|
|
|
|
|
</a:To> |
|
775
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
776
|
|
|
|
|
|
|
$resource |
|
777
|
|
|
|
|
|
|
</w:ResourceURI> |
|
778
|
|
|
|
|
|
|
<a:ReplyTo> |
|
779
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
780
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
781
|
|
|
|
|
|
|
</a:Address> |
|
782
|
|
|
|
|
|
|
</a:ReplyTo> |
|
783
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
784
|
|
|
|
|
|
|
$oaction |
|
785
|
|
|
|
|
|
|
</a:Action> |
|
786
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
787
|
|
|
|
|
|
|
512000 |
|
788
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
789
|
|
|
|
|
|
|
<a:MessageID> |
|
790
|
|
|
|
|
|
|
uuid:$uuid |
|
791
|
|
|
|
|
|
|
</a:MessageID> |
|
792
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
793
|
|
|
|
|
|
|
<w:SelectorSet> |
|
794
|
|
|
|
|
|
|
__SELECTOR__ |
|
795
|
|
|
|
|
|
|
</w:SelectorSet> |
|
796
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
797
|
|
|
|
|
|
|
</s:Header> |
|
798
|
|
|
|
|
|
|
<s:Body> |
|
799
|
|
|
|
|
|
|
<p:__INPUT__ xmlns:p="$resource"/> |
|
800
|
|
|
|
|
|
|
</s:Body> |
|
801
|
|
|
|
|
|
|
</s:Envelope> |
|
802
|
|
|
|
|
|
|
XML |
|
803
|
|
|
|
|
|
|
|
|
804
|
0
|
|
|
|
|
|
my $selector = ''; |
|
805
|
|
|
|
|
|
|
|
|
806
|
0
|
|
|
|
|
|
while (my ($key, $value) = each(%$params)) { |
|
807
|
|
|
|
|
|
|
|
|
808
|
0
|
|
|
|
|
|
$selector .= sprintf("<w:Selector Name=\"%s\">%s</w:Selector>\n", $key, $value); |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
} |
|
811
|
|
|
|
|
|
|
|
|
812
|
0
|
|
|
|
|
|
chomp $selector; |
|
813
|
|
|
|
|
|
|
|
|
814
|
0
|
|
|
|
|
|
$xml =~ s/__INPUT__/$input/; |
|
815
|
0
|
|
|
|
|
|
$xml =~ s/__SELECTOR__/$selector/; |
|
816
|
|
|
|
|
|
|
|
|
817
|
0
|
|
|
|
|
|
return $xml; |
|
818
|
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
} |
|
820
|
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
sub _pull_xml { |
|
822
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
823
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
824
|
0
|
|
|
|
|
|
my $resource = shift; |
|
825
|
0
|
|
|
|
|
|
my $context = shift; |
|
826
|
|
|
|
|
|
|
|
|
827
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
828
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
829
|
|
|
|
|
|
|
|
|
830
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
831
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
832
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
833
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
834
|
|
|
|
|
|
|
xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" |
|
835
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" |
|
836
|
|
|
|
|
|
|
xmlns:b="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd"> |
|
837
|
|
|
|
|
|
|
<s:Header> |
|
838
|
|
|
|
|
|
|
<a:To> |
|
839
|
|
|
|
|
|
|
$url |
|
840
|
|
|
|
|
|
|
</a:To> |
|
841
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
842
|
|
|
|
|
|
|
$resource |
|
843
|
|
|
|
|
|
|
</w:ResourceURI> |
|
844
|
|
|
|
|
|
|
<a:ReplyTo> |
|
845
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
846
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
847
|
|
|
|
|
|
|
</a:Address> |
|
848
|
|
|
|
|
|
|
</a:ReplyTo> |
|
849
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
850
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull |
|
851
|
|
|
|
|
|
|
</a:Action> |
|
852
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
853
|
|
|
|
|
|
|
512000 |
|
854
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
855
|
|
|
|
|
|
|
<a:MessageID> |
|
856
|
|
|
|
|
|
|
uuid:$uuid |
|
857
|
|
|
|
|
|
|
</a:MessageID> |
|
858
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
859
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
860
|
|
|
|
|
|
|
</s:Header> |
|
861
|
|
|
|
|
|
|
<s:Body> |
|
862
|
|
|
|
|
|
|
<n:Pull> |
|
863
|
|
|
|
|
|
|
<n:EnumerationContext>uuid:$context</n:EnumerationContext> |
|
864
|
|
|
|
|
|
|
</n:Pull> |
|
865
|
|
|
|
|
|
|
<n:Enumerate/> |
|
866
|
|
|
|
|
|
|
</s:Body> |
|
867
|
|
|
|
|
|
|
</s:Envelope> |
|
868
|
|
|
|
|
|
|
XML |
|
869
|
|
|
|
|
|
|
|
|
870
|
0
|
|
|
|
|
|
return $xml; |
|
871
|
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
} |
|
873
|
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
sub _put_xml { |
|
875
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
876
|
0
|
|
|
|
|
|
my $uuid = shift; |
|
877
|
0
|
|
|
|
|
|
my $resource = shift; |
|
878
|
0
|
|
|
|
|
|
my $class = shift; |
|
879
|
0
|
|
|
|
|
|
my $key = shift; |
|
880
|
0
|
|
|
|
|
|
my $value = shift; |
|
881
|
0
|
|
|
|
|
|
my $params = shift; |
|
882
|
|
|
|
|
|
|
|
|
883
|
0
|
|
|
|
|
|
my $url = $self->url; |
|
884
|
0
|
|
|
|
|
|
my $timeout = $self->timeout; |
|
885
|
|
|
|
|
|
|
|
|
886
|
0
|
|
|
|
|
|
my $xml = <<"XML"; |
|
887
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
888
|
|
|
|
|
|
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" |
|
889
|
|
|
|
|
|
|
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" |
|
890
|
|
|
|
|
|
|
xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" |
|
891
|
|
|
|
|
|
|
xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"> |
|
892
|
|
|
|
|
|
|
<s:Header> |
|
893
|
|
|
|
|
|
|
<a:To> |
|
894
|
|
|
|
|
|
|
$url |
|
895
|
|
|
|
|
|
|
</a:To> |
|
896
|
|
|
|
|
|
|
<w:ResourceURI s:mustUnderstand="true"> |
|
897
|
|
|
|
|
|
|
$resource |
|
898
|
|
|
|
|
|
|
</w:ResourceURI> |
|
899
|
|
|
|
|
|
|
<a:ReplyTo> |
|
900
|
|
|
|
|
|
|
<a:Address s:mustUnderstand="true"> |
|
901
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous |
|
902
|
|
|
|
|
|
|
</a:Address> |
|
903
|
|
|
|
|
|
|
</a:ReplyTo> |
|
904
|
|
|
|
|
|
|
<a:Action s:mustUnderstand="true"> |
|
905
|
|
|
|
|
|
|
http://schemas.xmlsoap.org/ws/2004/09/transfer/Put |
|
906
|
|
|
|
|
|
|
</a:Action> |
|
907
|
|
|
|
|
|
|
<w:MaxEnvelopeSize s:mustUnderstand="true"> |
|
908
|
|
|
|
|
|
|
512000 |
|
909
|
|
|
|
|
|
|
</w:MaxEnvelopeSize> |
|
910
|
|
|
|
|
|
|
<a:MessageID> |
|
911
|
|
|
|
|
|
|
uuid:$uuid |
|
912
|
|
|
|
|
|
|
</a:MessageID> |
|
913
|
|
|
|
|
|
|
<w:Locale xml:lang="en-US" s:mustUnderstand="false"/> |
|
914
|
|
|
|
|
|
|
<w:SelectorSet> |
|
915
|
|
|
|
|
|
|
<w:Selector Name="$key">$value</w:Selector> |
|
916
|
|
|
|
|
|
|
</w:SelectorSet> |
|
917
|
|
|
|
|
|
|
<w:OperationTimeout>PT$timeout.000S</w:OperationTimeout> |
|
918
|
|
|
|
|
|
|
</s:Header> |
|
919
|
|
|
|
|
|
|
<s:Body> |
|
920
|
|
|
|
|
|
|
<p:$class $resource> |
|
921
|
|
|
|
|
|
|
__MODIFY__ |
|
922
|
|
|
|
|
|
|
</p:$class> |
|
923
|
|
|
|
|
|
|
</s:Body> |
|
924
|
|
|
|
|
|
|
</s:Envelope> |
|
925
|
|
|
|
|
|
|
XML |
|
926
|
|
|
|
|
|
|
|
|
927
|
0
|
|
|
|
|
|
my $modify = ''; |
|
928
|
|
|
|
|
|
|
|
|
929
|
0
|
|
|
|
|
|
while (my ($name, $data) = each(%$params)) { |
|
930
|
|
|
|
|
|
|
|
|
931
|
0
|
|
|
|
|
|
$modify .= sprintf("<p:%s>%s</p:%s>\n", $name, $data, $name); |
|
932
|
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
} |
|
934
|
|
|
|
|
|
|
|
|
935
|
0
|
|
|
|
|
|
chomp $modify; |
|
936
|
|
|
|
|
|
|
|
|
937
|
0
|
|
|
|
|
|
$xml =~ s/__MODIFY__/$modify/; |
|
938
|
|
|
|
|
|
|
|
|
939
|
0
|
|
|
|
|
|
return $xml; |
|
940
|
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
} |
|
942
|
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
1; |
|
944
|
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
__END__ |
|
946
|
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
=head1 NAME |
|
948
|
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
XAS::Lib::WS::Manage - A class to manage Servers over WS-Manage |
|
950
|
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
952
|
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
use Data::Dumper; |
|
954
|
|
|
|
|
|
|
use XAS::Lib::WS::Manage; |
|
955
|
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
my $results; |
|
957
|
|
|
|
|
|
|
my $wsman = XAS::Lib::WS::Manage->new( |
|
958
|
|
|
|
|
|
|
-username => 'Administrator', |
|
959
|
|
|
|
|
|
|
-password => 'secret', |
|
960
|
|
|
|
|
|
|
-url => 'http://windowserver:5985/wsman', |
|
961
|
|
|
|
|
|
|
-auth_method => 'basic', |
|
962
|
|
|
|
|
|
|
); |
|
963
|
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
$results = $wsman->invoke( |
|
965
|
|
|
|
|
|
|
-action => 'stopservice', |
|
966
|
|
|
|
|
|
|
-class => 'Win32_Service', |
|
967
|
|
|
|
|
|
|
-selector => {Name => 'spooler'} |
|
968
|
|
|
|
|
|
|
); |
|
969
|
|
|
|
|
|
|
warn Dumper($results); |
|
970
|
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
$results = $wsman->get( |
|
972
|
|
|
|
|
|
|
-class => 'Win32_Service', |
|
973
|
|
|
|
|
|
|
-selector => {Name => 'spooler'} |
|
974
|
|
|
|
|
|
|
); |
|
975
|
|
|
|
|
|
|
warn Dumper($results); |
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
$results = $wsman->invoke( |
|
978
|
|
|
|
|
|
|
-action => 'startservice', |
|
979
|
|
|
|
|
|
|
-class => 'Win32_Service', |
|
980
|
|
|
|
|
|
|
-selector => {Name => 'spooler'} |
|
981
|
|
|
|
|
|
|
); |
|
982
|
|
|
|
|
|
|
warn Dumper($results); |
|
983
|
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
$results = $wsman->get( |
|
985
|
|
|
|
|
|
|
-class => 'Win32_Service', |
|
986
|
|
|
|
|
|
|
-selector => {Name => 'spooler'} |
|
987
|
|
|
|
|
|
|
); |
|
988
|
|
|
|
|
|
|
warn Dumper($results); |
|
989
|
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
991
|
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
This package implements an interface to manage a server thru WS-Manage. |
|
993
|
|
|
|
|
|
|
This is primiarily geared toward Microsoft based servers. But other servers |
|
994
|
|
|
|
|
|
|
can be accommodated when using the proper resources and classes. |
|
995
|
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
=head1 METHODS |
|
997
|
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=head2 new |
|
999
|
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
This package inherits from L<XAS::Lib::WS::Base|XAS::Lib::WS::Base> and |
|
1001
|
|
|
|
|
|
|
takes the same parameters. |
|
1002
|
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
=head2 create(...) |
|
1004
|
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
This method will create an object within the resource class, depending on |
|
1006
|
|
|
|
|
|
|
the selector. It takes the following parameters: |
|
1007
|
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
=over 4 |
|
1009
|
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=item B<-resource> |
|
1011
|
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1013
|
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
=item B<-class> |
|
1015
|
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1017
|
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
=item B<-selector> |
|
1019
|
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
A hashref of name value pairs to select an object within the class. |
|
1021
|
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
=item B<-xml> |
|
1023
|
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
Raw XML to be used as the data source for the created object. |
|
1025
|
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=back |
|
1027
|
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
=head2 delete(...) |
|
1029
|
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
This method will delete an object within the resource class, depending on |
|
1031
|
|
|
|
|
|
|
the selector. It takes the following parameters: |
|
1032
|
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
=over 4 |
|
1034
|
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
=item B<-resource> |
|
1036
|
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1038
|
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
=item B<-class> |
|
1040
|
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1042
|
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
=item B<-selector> |
|
1044
|
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
A hashref of name value pairs to select an object within the class. |
|
1046
|
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
=back |
|
1048
|
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
=head2 enumerate(...) |
|
1050
|
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
This method will return all objects within the resource class, depending on |
|
1052
|
|
|
|
|
|
|
the selector. It takes the following parameters: |
|
1053
|
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
=over 4 |
|
1055
|
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
=item B<-resource> |
|
1057
|
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1059
|
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
=item B<-class> |
|
1061
|
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1063
|
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
=item B<-selector> |
|
1065
|
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
A hashref of name value pairs to select an object within the class. |
|
1067
|
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
=back |
|
1069
|
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
=head2 get(...) |
|
1071
|
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
This method will retrieve a single object from the resource class, depending |
|
1073
|
|
|
|
|
|
|
on the selector. It takes the following parameters: |
|
1074
|
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
=over 4 |
|
1076
|
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
=item B<-resource> |
|
1078
|
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1080
|
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
=item B<-class> |
|
1082
|
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1084
|
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
=item B<-selector> |
|
1086
|
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
A hashref of name value pairs used to select an object within the resource class. |
|
1088
|
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
=back |
|
1090
|
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
=head2 invoke(...) |
|
1092
|
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
This method will initiate an action on an object within the resource class, |
|
1094
|
|
|
|
|
|
|
depending on the selector. It takes the following parameters: |
|
1095
|
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=over 4 |
|
1097
|
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
=item B<-resource> |
|
1099
|
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1101
|
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
=item B<-class> |
|
1103
|
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1105
|
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
=item B<-selector> |
|
1107
|
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
A hashref of name value pairs to select an object within the class. |
|
1109
|
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
=item B<-action> |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
A object specific action to be performed. |
|
1113
|
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
=back |
|
1115
|
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
=head2 pull(...) |
|
1117
|
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
This method is used during an enumeration to collect all of the pending items. |
|
1119
|
|
|
|
|
|
|
This method is usually not called directly. It takes the following parameters: |
|
1120
|
|
|
|
|
|
|
|
|
1121
|
|
|
|
|
|
|
=over 4 |
|
1122
|
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
=item B<-resource> |
|
1124
|
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
=item B<-class> |
|
1128
|
|
|
|
|
|
|
|
|
1129
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1130
|
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
=item B<-context> |
|
1132
|
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
The context of the enumeration. |
|
1134
|
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
=item B<-items> |
|
1136
|
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
A arraryref of items collected during the enumeration. |
|
1138
|
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
=back |
|
1140
|
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
=head2 put(...) |
|
1142
|
|
|
|
|
|
|
|
|
1143
|
|
|
|
|
|
|
This method will update an object within the resource class, depending on |
|
1144
|
|
|
|
|
|
|
the name of the key. It takes the following parameters: |
|
1145
|
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
=over 4 |
|
1147
|
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
=item B<-resource> |
|
1149
|
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
The resource of the class. Defaults to 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2' |
|
1151
|
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
=item B<-class> |
|
1153
|
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
A class that exists within the resource. |
|
1155
|
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
=item B<-key> |
|
1157
|
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
The name of a key within the object. |
|
1159
|
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
=item B<-value> |
|
1161
|
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
The value of that key. |
|
1163
|
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
=item B<-data> |
|
1165
|
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
A hashref of name value pairs to be used for the update action. |
|
1167
|
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
=back |
|
1169
|
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
1171
|
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
=over 4 |
|
1173
|
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
=item L<XAS::Lib::WS::Base|XAS::Lib::WS::Base> |
|
1175
|
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
=item L<XAS|XAS> |
|
1177
|
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
=back |
|
1179
|
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=head1 AUTHOR |
|
1181
|
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt> |
|
1183
|
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
1185
|
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
Copyright (c) 2012-2016 Kevin L. Esteb |
|
1187
|
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
1189
|
|
|
|
|
|
|
the terms of the Artistic License 2.0. For details, see the full text |
|
1190
|
|
|
|
|
|
|
of the license at http://www.perlfoundation.org/artistic_license_2_0. |
|
1191
|
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
=cut |