gce-host 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +210 -0
- data/Rakefile +30 -0
- data/bin/gce-host +4 -0
- data/docs/GCE.html +132 -0
- data/docs/GCE/Host.html +901 -0
- data/docs/GCE/Host/CLI.html +610 -0
- data/docs/GCE/Host/Config.html +1195 -0
- data/docs/GCE/Host/GCEClient.html +215 -0
- data/docs/GCE/Host/GCEClient/Error.html +127 -0
- data/docs/GCE/Host/GCEClient/NotFound.html +131 -0
- data/docs/GCE/Host/HashUtil.html +178 -0
- data/docs/GCE/Host/HostData.html +1658 -0
- data/docs/GCE/Host/RoleData.html +932 -0
- data/docs/GCE/Host/StringUtil.html +359 -0
- data/docs/_index.html +231 -0
- data/docs/class_list.html +58 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +57 -0
- data/docs/css/style.css +339 -0
- data/docs/file.LICENSE.html +95 -0
- data/docs/file.README.html +312 -0
- data/docs/file_list.html +63 -0
- data/docs/frames.html +26 -0
- data/docs/index.html +312 -0
- data/docs/js/app.js +219 -0
- data/docs/js/full_list.js +181 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +477 -0
- data/docs/top-level-namespace.html +112 -0
- data/example/example.conf +8 -0
- data/example/example.rb +6 -0
- data/gce-host.gemspec +26 -0
- data/lib/gce-host.rb +7 -0
- data/lib/gce/host.rb +120 -0
- data/lib/gce/host/cli.rb +151 -0
- data/lib/gce/host/config.rb +109 -0
- data/lib/gce/host/gce_client.rb +69 -0
- data/lib/gce/host/hash_util.rb +11 -0
- data/lib/gce/host/host_data.rb +227 -0
- data/lib/gce/host/role_data.rb +64 -0
- data/lib/gce/host/string_util.rb +31 -0
- data/lib/gce/host/version.rb +5 -0
- data/spec/gce_client_spec.rb +29 -0
- data/spec/host_spec.rb +199 -0
- data/spec/spec_helper.rb +22 -0
- data/terraform.tf +52 -0
- metadata +226 -0
data/docs/GCE/Host.html
ADDED
@@ -0,0 +1,901 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: GCE::Host
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!GCE/Host.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (H)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../GCE.html" title="GCE (class)">GCE</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Host</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: GCE::Host
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">GCE::Host</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r2">Includes:</dt>
|
94
|
+
<dd class="r2">Enumerable</dd>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dt class="r1 last">Defined in:</dt>
|
101
|
+
<dd class="r1 last">lib/gce/host.rb<span class="defines">,<br />
|
102
|
+
lib/gce/host/cli.rb,<br /> lib/gce/host/config.rb,<br /> lib/gce/host/version.rb,<br /> lib/gce/host/host_data.rb,<br /> lib/gce/host/role_data.rb,<br /> lib/gce/host/hash_util.rb,<br /> lib/gce/host/gce_client.rb,<br /> lib/gce/host/string_util.rb</span>
|
103
|
+
</dd>
|
104
|
+
|
105
|
+
</dl>
|
106
|
+
<div class="clear"></div>
|
107
|
+
|
108
|
+
<h2>Overview</h2><div class="docstring">
|
109
|
+
<div class="discussion">
|
110
|
+
|
111
|
+
<p>Search GCE hosts from labels</p>
|
112
|
+
|
113
|
+
<pre class="code ruby"><code class="ruby">require 'gce-host'
|
114
|
+
# Search by hostname
|
115
|
+
GCE::Host.new(hostname: 'test').first # => test
|
116
|
+
|
117
|
+
# Search by `roles` label
|
118
|
+
GCE::Host.new(
|
119
|
+
role: 'admin:haikanko',
|
120
|
+
).each do |host|
|
121
|
+
# ...
|
122
|
+
end
|
123
|
+
|
124
|
+
or
|
125
|
+
|
126
|
+
GCE::Host.new(
|
127
|
+
role1: 'admin',
|
128
|
+
role2: 'haikanko',
|
129
|
+
).each do |host|
|
130
|
+
# ...
|
131
|
+
end
|
132
|
+
|
133
|
+
# Or search
|
134
|
+
GCE::Host.new(
|
135
|
+
{
|
136
|
+
role1: 'db',
|
137
|
+
role2: 'master',
|
138
|
+
},
|
139
|
+
{
|
140
|
+
role1: 'web',
|
141
|
+
}
|
142
|
+
).each do |host|
|
143
|
+
# ...
|
144
|
+
end
|
145
|
+
|
146
|
+
GCE::Host.me.hostname # => 'test'</code></pre>
|
147
|
+
|
148
|
+
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
<div class="tags">
|
152
|
+
|
153
|
+
|
154
|
+
</div><h2>Defined Under Namespace</h2>
|
155
|
+
<p class="children">
|
156
|
+
|
157
|
+
|
158
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Host/HashUtil.html" title="GCE::Host::HashUtil (module)">HashUtil</a></span>, <span class='object_link'><a href="Host/StringUtil.html" title="GCE::Host::StringUtil (module)">StringUtil</a></span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Host/CLI.html" title="GCE::Host::CLI (class)">CLI</a></span>, <span class='object_link'><a href="Host/Config.html" title="GCE::Host::Config (class)">Config</a></span>, <span class='object_link'><a href="Host/GCEClient.html" title="GCE::Host::GCEClient (class)">GCEClient</a></span>, <span class='object_link'><a href="Host/HostData.html" title="GCE::Host::HostData (class)">HostData</a></span>, <span class='object_link'><a href="Host/RoleData.html" title="GCE::Host::RoleData (class)">RoleData</a></span>
|
163
|
+
|
164
|
+
|
165
|
+
</p>
|
166
|
+
|
167
|
+
<h2>Constant Summary</h2>
|
168
|
+
|
169
|
+
<dl class="constants">
|
170
|
+
|
171
|
+
<dt id="VERSION-constant" class="">VERSION =
|
172
|
+
|
173
|
+
</dt>
|
174
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>'</span></span></pre></dd>
|
175
|
+
|
176
|
+
</dl>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
183
|
+
<ul class="summary">
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#conditions-instance_method" title="#conditions (instance method)">- (Object) <strong>conditions</strong> </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<span class="note title readonly">readonly</span>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<span class="summary_desc"><div class='inline'>
|
208
|
+
<p>Returns the value of attribute conditions.</p>
|
209
|
+
</div></span>
|
210
|
+
|
211
|
+
</li>
|
212
|
+
|
213
|
+
|
214
|
+
<li class="public ">
|
215
|
+
<span class="summary_signature">
|
216
|
+
|
217
|
+
<a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</span>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<span class="note title readonly">readonly</span>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
<span class="summary_desc"><div class='inline'>
|
237
|
+
<p>Returns the value of attribute options.</p>
|
238
|
+
</div></span>
|
239
|
+
|
240
|
+
</li>
|
241
|
+
|
242
|
+
|
243
|
+
</ul>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<h2>
|
250
|
+
Class Method Summary
|
251
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
252
|
+
</h2>
|
253
|
+
|
254
|
+
<ul class="summary">
|
255
|
+
|
256
|
+
<li class="public ">
|
257
|
+
<span class="summary_signature">
|
258
|
+
|
259
|
+
<a href="#configure-class_method" title="configure (class method)">+ (Object) <strong>configure</strong>(params = {}) </a>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</span>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<span class="summary_desc"><div class='inline'>
|
274
|
+
<p>Configure GCE::Host.</p>
|
275
|
+
</div></span>
|
276
|
+
|
277
|
+
</li>
|
278
|
+
|
279
|
+
|
280
|
+
<li class="public ">
|
281
|
+
<span class="summary_signature">
|
282
|
+
|
283
|
+
<a href="#gce_client-class_method" title="gce_client (class method)">+ (Object) <strong>gce_client</strong> </a>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
</span>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
298
|
+
|
299
|
+
</li>
|
300
|
+
|
301
|
+
|
302
|
+
<li class="public ">
|
303
|
+
<span class="summary_signature">
|
304
|
+
|
305
|
+
<a href="#me-class_method" title="me (class method)">+ (Host::Data) <strong>me</strong> </a>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
</span>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
<span class="summary_desc"><div class='inline'>
|
320
|
+
<p>Representing myself.</p>
|
321
|
+
</div></span>
|
322
|
+
|
323
|
+
</li>
|
324
|
+
|
325
|
+
|
326
|
+
</ul>
|
327
|
+
|
328
|
+
<h2>
|
329
|
+
Instance Method Summary
|
330
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
331
|
+
</h2>
|
332
|
+
|
333
|
+
<ul class="summary">
|
334
|
+
|
335
|
+
<li class="public ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#each-instance_method" title="#each (instance method)">- (Object) <strong>each</strong> {|data| ... }</a>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
353
|
+
|
354
|
+
</li>
|
355
|
+
|
356
|
+
|
357
|
+
<li class="public ">
|
358
|
+
<span class="summary_signature">
|
359
|
+
|
360
|
+
<a href="#gce_client-instance_method" title="#gce_client (instance method)">- (Object) <strong>gce_client</strong> </a>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</span>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
375
|
+
|
376
|
+
</li>
|
377
|
+
|
378
|
+
|
379
|
+
<li class="public ">
|
380
|
+
<span class="summary_signature">
|
381
|
+
|
382
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Host) <strong>initialize</strong>(*conditions) </a>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
</span>
|
387
|
+
|
388
|
+
|
389
|
+
<span class="note title constructor">constructor</span>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
<span class="summary_desc"><div class='inline'>
|
399
|
+
<p>A new instance of Host.</p>
|
400
|
+
</div></span>
|
401
|
+
|
402
|
+
</li>
|
403
|
+
|
404
|
+
|
405
|
+
</ul>
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
<div id="constructor_details" class="method_details_list">
|
410
|
+
<h2>Constructor Details</h2>
|
411
|
+
|
412
|
+
<div class="method_details first">
|
413
|
+
<h3 class="signature first" id="initialize-instance_method">
|
414
|
+
|
415
|
+
- (<tt><span class='object_link'><a href="" title="GCE::Host (class)">Host</a></span></tt>) <strong>initialize</strong>(*conditions)
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
</h3><div class="docstring">
|
422
|
+
<div class="discussion">
|
423
|
+
|
424
|
+
<p>Returns a new instance of Host</p>
|
425
|
+
|
426
|
+
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
<div class="tags">
|
430
|
+
<p class="tag_title">Parameters:</p>
|
431
|
+
<ul class="param">
|
432
|
+
|
433
|
+
<li>
|
434
|
+
|
435
|
+
<span class='name'>conditions</span>
|
436
|
+
|
437
|
+
|
438
|
+
<span class='type'>(<tt>Array of Hash</tt>, <tt>or Hash</tt>)</span>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
—
|
443
|
+
<div class='inline'>
|
444
|
+
<p>(and options)</p>
|
445
|
+
|
446
|
+
<p>GCE::Host.new(</p>
|
447
|
+
|
448
|
+
<pre class="code ruby"><code class="ruby">hostname: 'test',
|
449
|
+
options: {a: 'b'}</code></pre>
|
450
|
+
|
451
|
+
<p>)</p>
|
452
|
+
|
453
|
+
<p>GCE::Host.new(</p>
|
454
|
+
|
455
|
+
<pre class="code ruby"><code class="ruby">{
|
456
|
+
hostname: 'foo',
|
457
|
+
},
|
458
|
+
{
|
459
|
+
hostname: 'bar',
|
460
|
+
},
|
461
|
+
options: {a: 'b'}</code></pre>
|
462
|
+
|
463
|
+
<p>)</p>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
</li>
|
467
|
+
|
468
|
+
</ul>
|
469
|
+
|
470
|
+
<p class="tag_title">Raises:</p>
|
471
|
+
<ul class="raise">
|
472
|
+
|
473
|
+
<li>
|
474
|
+
|
475
|
+
|
476
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
</li>
|
481
|
+
|
482
|
+
</ul>
|
483
|
+
|
484
|
+
</div><table class="source_code">
|
485
|
+
<tr>
|
486
|
+
<td>
|
487
|
+
<pre class="lines">
|
488
|
+
|
489
|
+
|
490
|
+
84
|
491
|
+
85
|
492
|
+
86
|
493
|
+
87
|
494
|
+
88
|
495
|
+
89
|
496
|
+
90
|
497
|
+
91
|
498
|
+
92
|
499
|
+
93
|
500
|
+
94
|
501
|
+
95
|
502
|
+
96
|
503
|
+
97
|
504
|
+
98
|
505
|
+
99
|
506
|
+
100</pre>
|
507
|
+
</td>
|
508
|
+
<td>
|
509
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 84</span>
|
510
|
+
|
511
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_conditions'>conditions</span><span class='rparen'>)</span>
|
512
|
+
<span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
513
|
+
<span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_conditions'>conditions</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
514
|
+
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
515
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>1</span>
|
516
|
+
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:options</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
517
|
+
<span class='kw'>else</span>
|
518
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_condition'>condition</span><span class='op'>|</span> <span class='id identifier rubyid_condition'>condition</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:options</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
519
|
+
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:options</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_index'>index</span>
|
520
|
+
<span class='kw'>end</span>
|
521
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Hash expected (options)</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
522
|
+
<span class='ivar'>@conditions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
523
|
+
<span class='id identifier rubyid_conditions'>conditions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_condition'>condition</span><span class='op'>|</span>
|
524
|
+
<span class='ivar'>@conditions</span> <span class='op'><<</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_condition'>condition</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_s</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='rbracket'>]</span>
|
525
|
+
<span class='kw'>end</span>
|
526
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Array of Hash, or Hash expected (conditions)</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='ivar'>@conditions</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_h'>h</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
527
|
+
<span class='kw'>end</span></pre>
|
528
|
+
</td>
|
529
|
+
</tr>
|
530
|
+
</table>
|
531
|
+
</div>
|
532
|
+
|
533
|
+
</div>
|
534
|
+
|
535
|
+
<div id="instance_attr_details" class="attr_details">
|
536
|
+
<h2>Instance Attribute Details</h2>
|
537
|
+
|
538
|
+
|
539
|
+
<span id=""></span>
|
540
|
+
<div class="method_details first">
|
541
|
+
<h3 class="signature first" id="conditions-instance_method">
|
542
|
+
|
543
|
+
- (<tt>Object</tt>) <strong>conditions</strong> <span class="extras">(readonly)</span>
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
</h3><div class="docstring">
|
550
|
+
<div class="discussion">
|
551
|
+
|
552
|
+
<p>Returns the value of attribute conditions</p>
|
553
|
+
|
554
|
+
|
555
|
+
</div>
|
556
|
+
</div>
|
557
|
+
<div class="tags">
|
558
|
+
|
559
|
+
|
560
|
+
</div><table class="source_code">
|
561
|
+
<tr>
|
562
|
+
<td>
|
563
|
+
<pre class="lines">
|
564
|
+
|
565
|
+
|
566
|
+
66
|
567
|
+
67
|
568
|
+
68</pre>
|
569
|
+
</td>
|
570
|
+
<td>
|
571
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 66</span>
|
572
|
+
|
573
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_conditions'>conditions</span>
|
574
|
+
<span class='ivar'>@conditions</span>
|
575
|
+
<span class='kw'>end</span></pre>
|
576
|
+
</td>
|
577
|
+
</tr>
|
578
|
+
</table>
|
579
|
+
</div>
|
580
|
+
|
581
|
+
|
582
|
+
<span id=""></span>
|
583
|
+
<div class="method_details ">
|
584
|
+
<h3 class="signature " id="options-instance_method">
|
585
|
+
|
586
|
+
- (<tt>Object</tt>) <strong>options</strong> <span class="extras">(readonly)</span>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
</h3><div class="docstring">
|
593
|
+
<div class="discussion">
|
594
|
+
|
595
|
+
<p>Returns the value of attribute options</p>
|
596
|
+
|
597
|
+
|
598
|
+
</div>
|
599
|
+
</div>
|
600
|
+
<div class="tags">
|
601
|
+
|
602
|
+
|
603
|
+
</div><table class="source_code">
|
604
|
+
<tr>
|
605
|
+
<td>
|
606
|
+
<pre class="lines">
|
607
|
+
|
608
|
+
|
609
|
+
66
|
610
|
+
67
|
611
|
+
68</pre>
|
612
|
+
</td>
|
613
|
+
<td>
|
614
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 66</span>
|
615
|
+
|
616
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
617
|
+
<span class='ivar'>@options</span>
|
618
|
+
<span class='kw'>end</span></pre>
|
619
|
+
</td>
|
620
|
+
</tr>
|
621
|
+
</table>
|
622
|
+
</div>
|
623
|
+
|
624
|
+
</div>
|
625
|
+
|
626
|
+
|
627
|
+
<div id="class_method_details" class="method_details_list">
|
628
|
+
<h2>Class Method Details</h2>
|
629
|
+
|
630
|
+
|
631
|
+
<div class="method_details first">
|
632
|
+
<h3 class="signature first" id="configure-class_method">
|
633
|
+
|
634
|
+
+ (<tt>Object</tt>) <strong>configure</strong>(params = {})
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
</h3><div class="docstring">
|
641
|
+
<div class="discussion">
|
642
|
+
|
643
|
+
<p>Configure GCE::Host</p>
|
644
|
+
|
645
|
+
|
646
|
+
</div>
|
647
|
+
</div>
|
648
|
+
<div class="tags">
|
649
|
+
<p class="tag_title">Parameters:</p>
|
650
|
+
<ul class="param">
|
651
|
+
|
652
|
+
<li>
|
653
|
+
|
654
|
+
<span class='name'>params</span>
|
655
|
+
|
656
|
+
|
657
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
658
|
+
|
659
|
+
|
660
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
661
|
+
|
662
|
+
|
663
|
+
—
|
664
|
+
<div class='inline'>
|
665
|
+
<p>see GCE::Host::Config for configurable parameters</p>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
</li>
|
669
|
+
|
670
|
+
</ul>
|
671
|
+
|
672
|
+
|
673
|
+
</div><table class="source_code">
|
674
|
+
<tr>
|
675
|
+
<td>
|
676
|
+
<pre class="lines">
|
677
|
+
|
678
|
+
|
679
|
+
54
|
680
|
+
55
|
681
|
+
56</pre>
|
682
|
+
</td>
|
683
|
+
<td>
|
684
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 54</span>
|
685
|
+
|
686
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_configure'>configure</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
687
|
+
<span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_configure'>configure</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
688
|
+
<span class='kw'>end</span></pre>
|
689
|
+
</td>
|
690
|
+
</tr>
|
691
|
+
</table>
|
692
|
+
</div>
|
693
|
+
|
694
|
+
<div class="method_details ">
|
695
|
+
<h3 class="signature " id="gce_client-class_method">
|
696
|
+
|
697
|
+
+ (<tt>Object</tt>) <strong>gce_client</strong>
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
</h3><table class="source_code">
|
704
|
+
<tr>
|
705
|
+
<td>
|
706
|
+
<pre class="lines">
|
707
|
+
|
708
|
+
|
709
|
+
58
|
710
|
+
59
|
711
|
+
60</pre>
|
712
|
+
</td>
|
713
|
+
<td>
|
714
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 58</span>
|
715
|
+
|
716
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gce_client'>gce_client</span>
|
717
|
+
<span class='ivar'>@gce_client</span> <span class='op'>||=</span> <span class='const'>GCEClient</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
718
|
+
<span class='kw'>end</span></pre>
|
719
|
+
</td>
|
720
|
+
</tr>
|
721
|
+
</table>
|
722
|
+
</div>
|
723
|
+
|
724
|
+
<div class="method_details ">
|
725
|
+
<h3 class="signature " id="me-class_method">
|
726
|
+
|
727
|
+
+ (<tt>Host::Data</tt>) <strong>me</strong>
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
</h3><div class="docstring">
|
734
|
+
<div class="discussion">
|
735
|
+
|
736
|
+
<p>Returns representing myself</p>
|
737
|
+
|
738
|
+
|
739
|
+
</div>
|
740
|
+
</div>
|
741
|
+
<div class="tags">
|
742
|
+
|
743
|
+
<p class="tag_title">Returns:</p>
|
744
|
+
<ul class="return">
|
745
|
+
|
746
|
+
<li>
|
747
|
+
|
748
|
+
|
749
|
+
<span class='type'>(<tt>Host::Data</tt>)</span>
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
—
|
754
|
+
<div class='inline'>
|
755
|
+
<p>representing myself</p>
|
756
|
+
</div>
|
757
|
+
|
758
|
+
</li>
|
759
|
+
|
760
|
+
</ul>
|
761
|
+
|
762
|
+
</div><table class="source_code">
|
763
|
+
<tr>
|
764
|
+
<td>
|
765
|
+
<pre class="lines">
|
766
|
+
|
767
|
+
|
768
|
+
44
|
769
|
+
45
|
770
|
+
46
|
771
|
+
47
|
772
|
+
48
|
773
|
+
49</pre>
|
774
|
+
</td>
|
775
|
+
<td>
|
776
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 44</span>
|
777
|
+
|
778
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_me'>me</span>
|
779
|
+
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>hostname:</span> <span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_gethostname'>gethostname</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span>
|
780
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_d'>d</span>
|
781
|
+
<span class='kw'>end</span>
|
782
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Not Found</span><span class='tstring_end'>'</span></span>
|
783
|
+
<span class='kw'>end</span></pre>
|
784
|
+
</td>
|
785
|
+
</tr>
|
786
|
+
</table>
|
787
|
+
</div>
|
788
|
+
|
789
|
+
</div>
|
790
|
+
|
791
|
+
<div id="instance_method_details" class="method_details_list">
|
792
|
+
<h2>Instance Method Details</h2>
|
793
|
+
|
794
|
+
|
795
|
+
<div class="method_details first">
|
796
|
+
<h3 class="signature first" id="each-instance_method">
|
797
|
+
|
798
|
+
- (<tt>Object</tt>) <strong>each</strong> {|data| ... }
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
|
804
|
+
</h3><div class="docstring">
|
805
|
+
<div class="discussion">
|
806
|
+
|
807
|
+
|
808
|
+
</div>
|
809
|
+
</div>
|
810
|
+
<div class="tags">
|
811
|
+
|
812
|
+
<p class="tag_title">Yield Parameters:</p>
|
813
|
+
<ul class="yieldparam">
|
814
|
+
|
815
|
+
<li>
|
816
|
+
|
817
|
+
<span class='name'>data</span>
|
818
|
+
|
819
|
+
|
820
|
+
<span class='type'>(<tt>Host::Data</tt>)</span>
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
—
|
825
|
+
<div class='inline'>
|
826
|
+
<p>entry</p>
|
827
|
+
</div>
|
828
|
+
|
829
|
+
</li>
|
830
|
+
|
831
|
+
</ul>
|
832
|
+
|
833
|
+
</div><table class="source_code">
|
834
|
+
<tr>
|
835
|
+
<td>
|
836
|
+
<pre class="lines">
|
837
|
+
|
838
|
+
|
839
|
+
103
|
840
|
+
104
|
841
|
+
105
|
842
|
+
106
|
843
|
+
107
|
844
|
+
108</pre>
|
845
|
+
</td>
|
846
|
+
<td>
|
847
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 103</span>
|
848
|
+
|
849
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
850
|
+
<span class='ivar'>@conditions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_condition'>condition</span><span class='op'>|</span>
|
851
|
+
<span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='id identifier rubyid_gce_client'>gce_client</span><span class='period'>.</span><span class='id identifier rubyid_instances'>instances</span><span class='lparen'>(</span><span class='id identifier rubyid_condition'>condition</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_condition'>condition</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
852
|
+
<span class='kw'>end</span>
|
853
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
854
|
+
<span class='kw'>end</span></pre>
|
855
|
+
</td>
|
856
|
+
</tr>
|
857
|
+
</table>
|
858
|
+
</div>
|
859
|
+
|
860
|
+
<div class="method_details ">
|
861
|
+
<h3 class="signature " id="gce_client-instance_method">
|
862
|
+
|
863
|
+
- (<tt>Object</tt>) <strong>gce_client</strong>
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
|
868
|
+
|
869
|
+
</h3><table class="source_code">
|
870
|
+
<tr>
|
871
|
+
<td>
|
872
|
+
<pre class="lines">
|
873
|
+
|
874
|
+
|
875
|
+
62
|
876
|
+
63
|
877
|
+
64</pre>
|
878
|
+
</td>
|
879
|
+
<td>
|
880
|
+
<pre class="code"><span class="info file"># File 'lib/gce/host.rb', line 62</span>
|
881
|
+
|
882
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_gce_client'>gce_client</span>
|
883
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_gce_client'>gce_client</span>
|
884
|
+
<span class='kw'>end</span></pre>
|
885
|
+
</td>
|
886
|
+
</tr>
|
887
|
+
</table>
|
888
|
+
</div>
|
889
|
+
|
890
|
+
</div>
|
891
|
+
|
892
|
+
</div>
|
893
|
+
|
894
|
+
<div id="footer">
|
895
|
+
Generated on Wed Nov 23 20:08:31 2016 by
|
896
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
897
|
+
0.8.7.6 (ruby-2.3.2).
|
898
|
+
</div>
|
899
|
+
|
900
|
+
</body>
|
901
|
+
</html>
|