gce-host 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6adaffbd131f50324146d78b6f788eee72ebd50b
4
- data.tar.gz: e6deec48ed9f516c0b508a5f92a07bd12789b4f4
3
+ metadata.gz: 19193e270212331af7d6ed88a67a2477cc918ffd
4
+ data.tar.gz: 6938284bed1b7ae803773b673ee47b2507e4993a
5
5
  SHA512:
6
- metadata.gz: ed8220ea665e6c22b3e5c1f9f4836aa967b4b022c3cbcd75b5bfb0694b7bfd9250afd167212f5e53b9f9d3d596847b8f9903bd71108bf3c14f7af19f6a8ef142
7
- data.tar.gz: 7cd76ed6cfc793a3eb56297983b501f6eb20d4c05ed06eb9fe88b7ee99f5b2642175c11456ad2f6b96aa0efd5376d76dd9045a176ec9152bcf9f3d252f437315
6
+ metadata.gz: 2489ae5fd002f8e517592d9ca0c88b932d08c49aab5193bacfc8dfa2164b7fff3889541178b69c63f238a1c338075ea0c1d3c82e0c1869ff010f326d7b29941d
7
+ data.tar.gz: 852d0b3b2c8dbba2229ccfbf4e69821da5ac7484b94388ab12df563c60ec77d950ef2ea7121391b652e87d152cc59d85f838ef522c9bbb8b918b773eb9e4f602
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.3.0 (2016/11/25)
2
+
3
+ Changes
4
+
5
+ * Change AUTH_METHOD 'json_key' to 'service_account'
6
+
7
+ Enhancements
8
+
9
+ * Support AUTH_METHOD 'authorized_user'
10
+
1
11
  # 0.2.1 (2016/11/25)
2
12
 
3
13
  Changes
data/README.md CHANGED
@@ -21,8 +21,8 @@ You can write a configuration file located at `/etc/sysconfig/gce-host` (You can
21
21
 
22
22
  GOOGLE API parameters:
23
23
 
24
- * **AUTH_METHOD**: Authentication method. Currently, `compute_engine`, `json_key` and `application_default` is available. The default is `applilcation_default`.
25
- * **GOOGLE_APPLICATION_CREDENTIALS (optional)**: Path of credential file. Specify your service account json file for `json_key` authentication method. Try reading from `~/.config/gcloud/legacy_credentials/#{service_account}/adc.json` as default, where the `service_account` is being read from `~/.config/gcloud/configurations/config_default`.
24
+ * **AUTH_METHOD (optional)**: Authentication method. Currently, `compute_engine`, `service_account`, `authorized_user`, and `application_default` is available. The default reads from `GOOGLE_APPLICATION_CREDENTIALS`.
25
+ * **GOOGLE_APPLICATION_CREDENTIALS (optional)**: Specify path of json credential file. The default is `~/.config/gcloud/application_default_credentials.json`.
26
26
 
27
27
  gce-host parameters:
28
28
 
data/docs/GCE.html CHANGED
@@ -123,7 +123,7 @@
123
123
  </div>
124
124
 
125
125
  <div id="footer">
126
- Generated on Fri Nov 25 20:32:55 2016 by
126
+ Generated on Fri Nov 25 21:03:57 2016 by
127
127
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
128
128
  0.8.7.6 (ruby-2.3.2).
129
129
  </div>
data/docs/GCE/Host.html CHANGED
@@ -171,7 +171,7 @@ GCE::Host.me.hostname # =&gt; &#39;test&#39;</code></pre>
171
171
  <dt id="VERSION-constant" class="">VERSION =
172
172
 
173
173
  </dt>
174
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.2.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
174
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.3.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
175
175
 
176
176
  </dl>
177
177
 
@@ -892,7 +892,7 @@ options: {a: &#39;b&#39;}</code></pre>
892
892
  </div>
893
893
 
894
894
  <div id="footer">
895
- Generated on Fri Nov 25 20:32:55 2016 by
895
+ Generated on Fri Nov 25 21:03:57 2016 by
896
896
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
897
897
  0.8.7.6 (ruby-2.3.2).
898
898
  </div>
@@ -601,7 +601,7 @@
601
601
  </div>
602
602
 
603
603
  <div id="footer">
604
- Generated on Fri Nov 25 20:32:55 2016 by
604
+ Generated on Fri Nov 25 21:03:57 2016 by
605
605
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
606
606
  0.8.7.6 (ruby-2.3.2).
607
607
  </div>
@@ -117,7 +117,7 @@
117
117
  <li class="public ">
118
118
  <span class="summary_signature">
119
119
 
120
- <a href="#array_value_delimiter-class_method" title="array_value_delimiter (class method)">+ (Object) <strong>array_value_delimiter</strong> </a>
120
+ <a href="#account-class_method" title="account (class method)">+ (Object) <strong>account</strong> </a>
121
121
 
122
122
 
123
123
 
@@ -139,7 +139,7 @@
139
139
  <li class="public ">
140
140
  <span class="summary_signature">
141
141
 
142
- <a href="#auth_method-class_method" title="auth_method (class method)">+ (Object) <strong>auth_method</strong> </a>
142
+ <a href="#account_default-class_method" title="account_default (class method)">+ (Object) <strong>account_default</strong> </a>
143
143
 
144
144
 
145
145
 
@@ -161,7 +161,7 @@
161
161
  <li class="public ">
162
162
  <span class="summary_signature">
163
163
 
164
- <a href="#config-class_method" title="config (class method)">+ (Object) <strong>config</strong> </a>
164
+ <a href="#array_value_delimiter-class_method" title="array_value_delimiter (class method)">+ (Object) <strong>array_value_delimiter</strong> </a>
165
165
 
166
166
 
167
167
 
@@ -183,7 +183,7 @@
183
183
  <li class="public ">
184
184
  <span class="summary_signature">
185
185
 
186
- <a href="#config_default-class_method" title="config_default (class method)">+ (Object) <strong>config_default</strong> </a>
186
+ <a href="#auth_method-class_method" title="auth_method (class method)">+ (Object) <strong>auth_method</strong> </a>
187
187
 
188
188
 
189
189
 
@@ -205,7 +205,7 @@
205
205
  <li class="public ">
206
206
  <span class="summary_signature">
207
207
 
208
- <a href="#config_default_file-class_method" title="config_default_file (class method)">+ (Object) <strong>config_default_file</strong> </a>
208
+ <a href="#config-class_method" title="config (class method)">+ (Object) <strong>config</strong> </a>
209
209
 
210
210
 
211
211
 
@@ -227,7 +227,7 @@
227
227
  <li class="public ">
228
228
  <span class="summary_signature">
229
229
 
230
- <a href="#config_file-class_method" title="config_file (class method)">+ (Object) <strong>config_file</strong> </a>
230
+ <a href="#config_default-class_method" title="config_default (class method)">+ (Object) <strong>config_default</strong> </a>
231
231
 
232
232
 
233
233
 
@@ -249,7 +249,7 @@
249
249
  <li class="public ">
250
250
  <span class="summary_signature">
251
251
 
252
- <a href="#configure-class_method" title="configure (class method)">+ (Object) <strong>configure</strong>(params) </a>
252
+ <a href="#config_default_file-class_method" title="config_default_file (class method)">+ (Object) <strong>config_default_file</strong> </a>
253
253
 
254
254
 
255
255
 
@@ -271,7 +271,7 @@
271
271
  <li class="public ">
272
272
  <span class="summary_signature">
273
273
 
274
- <a href="#credential-class_method" title="credential (class method)">+ (Object) <strong>credential</strong> </a>
274
+ <a href="#config_file-class_method" title="config_file (class method)">+ (Object) <strong>config_file</strong> </a>
275
275
 
276
276
 
277
277
 
@@ -293,7 +293,7 @@
293
293
  <li class="public ">
294
294
  <span class="summary_signature">
295
295
 
296
- <a href="#credential_file-class_method" title="credential_file (class method)">+ (Object) <strong>credential_file</strong> </a>
296
+ <a href="#configure-class_method" title="configure (class method)">+ (Object) <strong>configure</strong>(params) </a>
297
297
 
298
298
 
299
299
 
@@ -315,7 +315,7 @@
315
315
  <li class="public ">
316
316
  <span class="summary_signature">
317
317
 
318
- <a href="#credential_file_default-class_method" title="credential_file_default (class method)">+ (Object) <strong>credential_file_default</strong> </a>
318
+ <a href="#credentials-class_method" title="credentials (class method)">+ (Object) <strong>credentials</strong> </a>
319
319
 
320
320
 
321
321
 
@@ -337,7 +337,7 @@
337
337
  <li class="public ">
338
338
  <span class="summary_signature">
339
339
 
340
- <a href="#log_level-class_method" title="log_level (class method)">+ (Object) <strong>log_level</strong> </a>
340
+ <a href="#credentials_file-class_method" title="credentials_file (class method)">+ (Object) <strong>credentials_file</strong> </a>
341
341
 
342
342
 
343
343
 
@@ -359,7 +359,7 @@
359
359
  <li class="public ">
360
360
  <span class="summary_signature">
361
361
 
362
- <a href="#open_timeout_sec-class_method" title="open_timeout_sec (class method)">+ (Object) <strong>open_timeout_sec</strong> </a>
362
+ <a href="#credentials_file_default-class_method" title="credentials_file_default (class method)">+ (Object) <strong>credentials_file_default</strong> </a>
363
363
 
364
364
 
365
365
 
@@ -381,7 +381,7 @@
381
381
  <li class="public ">
382
382
  <span class="summary_signature">
383
383
 
384
- <a href="#optional_array_keys-class_method" title="optional_array_keys (class method)">+ (Object) <strong>optional_array_keys</strong> </a>
384
+ <a href="#log_level-class_method" title="log_level (class method)">+ (Object) <strong>log_level</strong> </a>
385
385
 
386
386
 
387
387
 
@@ -403,7 +403,7 @@
403
403
  <li class="public ">
404
404
  <span class="summary_signature">
405
405
 
406
- <a href="#optional_array_options-class_method" title="optional_array_options (class method)">+ (Object) <strong>optional_array_options</strong> </a>
406
+ <a href="#open_timeout_sec-class_method" title="open_timeout_sec (class method)">+ (Object) <strong>open_timeout_sec</strong> </a>
407
407
 
408
408
 
409
409
 
@@ -417,9 +417,7 @@
417
417
 
418
418
 
419
419
 
420
- <span class="summary_desc"><div class='inline'>
421
- <p>private.</p>
422
- </div></span>
420
+ <span class="summary_desc"><div class='inline'></div></span>
423
421
 
424
422
  </li>
425
423
 
@@ -427,7 +425,7 @@
427
425
  <li class="public ">
428
426
  <span class="summary_signature">
429
427
 
430
- <a href="#optional_options-class_method" title="optional_options (class method)">+ (Object) <strong>optional_options</strong> </a>
428
+ <a href="#optional_array_keys-class_method" title="optional_array_keys (class method)">+ (Object) <strong>optional_array_keys</strong> </a>
431
429
 
432
430
 
433
431
 
@@ -449,7 +447,7 @@
449
447
  <li class="public ">
450
448
  <span class="summary_signature">
451
449
 
452
- <a href="#optional_string_keys-class_method" title="optional_string_keys (class method)">+ (Object) <strong>optional_string_keys</strong> </a>
450
+ <a href="#optional_array_options-class_method" title="optional_array_options (class method)">+ (Object) <strong>optional_array_options</strong> </a>
453
451
 
454
452
 
455
453
 
@@ -463,7 +461,9 @@
463
461
 
464
462
 
465
463
 
466
- <span class="summary_desc"><div class='inline'></div></span>
464
+ <span class="summary_desc"><div class='inline'>
465
+ <p>private.</p>
466
+ </div></span>
467
467
 
468
468
  </li>
469
469
 
@@ -471,7 +471,7 @@
471
471
  <li class="public ">
472
472
  <span class="summary_signature">
473
473
 
474
- <a href="#optional_string_options-class_method" title="optional_string_options (class method)">+ (Object) <strong>optional_string_options</strong> </a>
474
+ <a href="#optional_options-class_method" title="optional_options (class method)">+ (Object) <strong>optional_options</strong> </a>
475
475
 
476
476
 
477
477
 
@@ -493,7 +493,7 @@
493
493
  <li class="public ">
494
494
  <span class="summary_signature">
495
495
 
496
- <a href="#project-class_method" title="project (class method)">+ (Object) <strong>project</strong> </a>
496
+ <a href="#optional_string_keys-class_method" title="optional_string_keys (class method)">+ (Object) <strong>optional_string_keys</strong> </a>
497
497
 
498
498
 
499
499
 
@@ -515,7 +515,7 @@
515
515
  <li class="public ">
516
516
  <span class="summary_signature">
517
517
 
518
- <a href="#project_default-class_method" title="project_default (class method)">+ (Object) <strong>project_default</strong> </a>
518
+ <a href="#optional_string_options-class_method" title="optional_string_options (class method)">+ (Object) <strong>optional_string_options</strong> </a>
519
519
 
520
520
 
521
521
 
@@ -537,7 +537,7 @@
537
537
  <li class="public ">
538
538
  <span class="summary_signature">
539
539
 
540
- <a href="#retries-class_method" title="retries (class method)">+ (Object) <strong>retries</strong> </a>
540
+ <a href="#project-class_method" title="project (class method)">+ (Object) <strong>project</strong> </a>
541
541
 
542
542
 
543
543
 
@@ -559,7 +559,7 @@
559
559
  <li class="public ">
560
560
  <span class="summary_signature">
561
561
 
562
- <a href="#role_value_delimiter-class_method" title="role_value_delimiter (class method)">+ (Object) <strong>role_value_delimiter</strong> </a>
562
+ <a href="#project_default-class_method" title="project_default (class method)">+ (Object) <strong>project_default</strong> </a>
563
563
 
564
564
 
565
565
 
@@ -581,7 +581,7 @@
581
581
  <li class="public ">
582
582
  <span class="summary_signature">
583
583
 
584
- <a href="#roles_key-class_method" title="roles_key (class method)">+ (Object) <strong>roles_key</strong> </a>
584
+ <a href="#retries-class_method" title="retries (class method)">+ (Object) <strong>retries</strong> </a>
585
585
 
586
586
 
587
587
 
@@ -603,7 +603,7 @@
603
603
  <li class="public ">
604
604
  <span class="summary_signature">
605
605
 
606
- <a href="#service_account-class_method" title="service_account (class method)">+ (Object) <strong>service_account</strong> </a>
606
+ <a href="#role_value_delimiter-class_method" title="role_value_delimiter (class method)">+ (Object) <strong>role_value_delimiter</strong> </a>
607
607
 
608
608
 
609
609
 
@@ -625,7 +625,7 @@
625
625
  <li class="public ">
626
626
  <span class="summary_signature">
627
627
 
628
- <a href="#service_account_default-class_method" title="service_account_default (class method)">+ (Object) <strong>service_account_default</strong> </a>
628
+ <a href="#roles_key-class_method" title="roles_key (class method)">+ (Object) <strong>roles_key</strong> </a>
629
629
 
630
630
 
631
631
 
@@ -723,7 +723,67 @@ AWS usually, users do not need to care of this.</p>
723
723
 
724
724
 
725
725
  <div class="method_details first">
726
- <h3 class="signature first" id="array_value_delimiter-class_method">
726
+ <h3 class="signature first" id="account-class_method">
727
+
728
+ + (<tt>Object</tt>) <strong>account</strong>
729
+
730
+
731
+
732
+
733
+
734
+ </h3><table class="source_code">
735
+ <tr>
736
+ <td>
737
+ <pre class="lines">
738
+
739
+
740
+ 55
741
+ 56
742
+ 57</pre>
743
+ </td>
744
+ <td>
745
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 55</span>
746
+
747
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_account'>account</span>
748
+ <span class='ivar'>@account</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_ACCOUNT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_ACCOUNT</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_account_default'>account_default</span>
749
+ <span class='kw'>end</span></pre>
750
+ </td>
751
+ </tr>
752
+ </table>
753
+ </div>
754
+
755
+ <div class="method_details ">
756
+ <h3 class="signature " id="account_default-class_method">
757
+
758
+ + (<tt>Object</tt>) <strong>account_default</strong>
759
+
760
+
761
+
762
+
763
+
764
+ </h3><table class="source_code">
765
+ <tr>
766
+ <td>
767
+ <pre class="lines">
768
+
769
+
770
+ 43
771
+ 44
772
+ 45</pre>
773
+ </td>
774
+ <td>
775
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 43</span>
776
+
777
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_account_default'>account_default</span>
778
+ <span class='lparen'>(</span><span class='id identifier rubyid_config_default'>config_default</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>core</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>account</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
779
+ <span class='kw'>end</span></pre>
780
+ </td>
781
+ </tr>
782
+ </table>
783
+ </div>
784
+
785
+ <div class="method_details ">
786
+ <h3 class="signature " id="array_value_delimiter-class_method">
727
787
 
728
788
  + (<tt>Object</tt>) <strong>array_value_delimiter</strong>
729
789
 
@@ -775,7 +835,7 @@ AWS usually, users do not need to care of this.</p>
775
835
  <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 18</span>
776
836
 
777
837
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_auth_method'>auth_method</span>
778
- <span class='ivar'>@auth_method</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>AUTH_METHOD</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>AUTH_METHOD</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application_default</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
838
+ <span class='ivar'>@auth_method</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>AUTH_METHOD</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>AUTH_METHOD</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_credentials'>credentials</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>type</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application_default</span><span class='tstring_end'>&#39;</span></span>
779
839
  <span class='kw'>end</span></pre>
780
840
  </td>
781
841
  </tr>
@@ -845,12 +905,12 @@ AWS usually, users do not need to care of this.</p>
845
905
  <pre class="lines">
846
906
 
847
907
 
848
- 35
849
- 36
850
- 37</pre>
908
+ 39
909
+ 40
910
+ 41</pre>
851
911
  </td>
852
912
  <td>
853
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 35</span>
913
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 39</span>
854
914
 
855
915
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config_default'>config_default</span>
856
916
  <span class='ivar'>@config_default</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span><span class='lparen'>(</span><span class='id identifier rubyid_config_default_file'>config_default_file</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>IniFile</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_config_default_file'>config_default_file</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -875,12 +935,12 @@ AWS usually, users do not need to care of this.</p>
875
935
  <pre class="lines">
876
936
 
877
937
 
878
- 31
879
- 32
880
- 33</pre>
938
+ 35
939
+ 36
940
+ 37</pre>
881
941
  </td>
882
942
  <td>
883
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 31</span>
943
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 35</span>
884
944
 
885
945
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config_default_file'>config_default_file</span>
886
946
  <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>~/.config/gcloud/configurations/config_default</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
@@ -955,9 +1015,9 @@ AWS usually, users do not need to care of this.</p>
955
1015
  </div>
956
1016
 
957
1017
  <div class="method_details ">
958
- <h3 class="signature " id="credential-class_method">
1018
+ <h3 class="signature " id="credentials-class_method">
959
1019
 
960
- + (<tt>Object</tt>) <strong>credential</strong>
1020
+ + (<tt>Object</tt>) <strong>credentials</strong>
961
1021
 
962
1022
 
963
1023
 
@@ -969,15 +1029,15 @@ AWS usually, users do not need to care of this.</p>
969
1029
  <pre class="lines">
970
1030
 
971
1031
 
972
- 27
973
- 28
974
- 29</pre>
1032
+ 31
1033
+ 32
1034
+ 33</pre>
975
1035
  </td>
976
1036
  <td>
977
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 27</span>
1037
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 31</span>
978
1038
 
979
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_credential'>credential</span>
980
- <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span><span class='lparen'>(</span><span class='id identifier rubyid_credential_file'>credential_file</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_credential_file'>credential_file</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1039
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_credentials'>credentials</span>
1040
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span><span class='lparen'>(</span><span class='id identifier rubyid_credentials_file'>credentials_file</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_credentials_file'>credentials_file</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
981
1041
  <span class='kw'>end</span></pre>
982
1042
  </td>
983
1043
  </tr>
@@ -985,9 +1045,9 @@ AWS usually, users do not need to care of this.</p>
985
1045
  </div>
986
1046
 
987
1047
  <div class="method_details ">
988
- <h3 class="signature " id="credential_file-class_method">
1048
+ <h3 class="signature " id="credentials_file-class_method">
989
1049
 
990
- + (<tt>Object</tt>) <strong>credential_file</strong>
1050
+ + (<tt>Object</tt>) <strong>credentials_file</strong>
991
1051
 
992
1052
 
993
1053
 
@@ -1007,9 +1067,9 @@ AWS usually, users do not need to care of this.</p>
1007
1067
  <td>
1008
1068
  <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 22</span>
1009
1069
 
1010
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_credential_file'>credential_file</span>
1070
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_credentials_file'>credentials_file</span>
1011
1071
  <span class='comment'># ref. https://developers.google.com/identity/protocols/application-default-credentials
1012
- </span> <span class='ivar'>@credential_file</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_APPLICATION_CREDENTIALS</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_APPLICATION_CREDENTIALS</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_credential_file_default'>credential_file_default</span><span class='rparen'>)</span>
1072
+ </span> <span class='ivar'>@credential_file</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_APPLICATION_CREDENTIALS</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_APPLICATION_CREDENTIALS</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_credentials_file_default'>credentials_file_default</span><span class='rparen'>)</span>
1013
1073
  <span class='kw'>end</span></pre>
1014
1074
  </td>
1015
1075
  </tr>
@@ -1017,9 +1077,9 @@ AWS usually, users do not need to care of this.</p>
1017
1077
  </div>
1018
1078
 
1019
1079
  <div class="method_details ">
1020
- <h3 class="signature " id="credential_file_default-class_method">
1080
+ <h3 class="signature " id="credentials_file_default-class_method">
1021
1081
 
1022
- + (<tt>Object</tt>) <strong>credential_file_default</strong>
1082
+ + (<tt>Object</tt>) <strong>credentials_file_default</strong>
1023
1083
 
1024
1084
 
1025
1085
 
@@ -1031,15 +1091,15 @@ AWS usually, users do not need to care of this.</p>
1031
1091
  <pre class="lines">
1032
1092
 
1033
1093
 
1034
- 51
1035
- 52
1036
- 53</pre>
1094
+ 27
1095
+ 28
1096
+ 29</pre>
1037
1097
  </td>
1038
1098
  <td>
1039
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 51</span>
1099
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 27</span>
1040
1100
 
1041
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_credential_file_default'>credential_file_default</span>
1042
- <span class='ivar'>@credential_file_default</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>~/.config/gcloud/legacy_credentials/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service_account'>service_account</span><span class='embexpr_end'>}</span><span class='tstring_content'>/adc.json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1101
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_credentials_file_default'>credentials_file_default</span>
1102
+ <span class='ivar'>@credentials_file_default</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>~/.config/gcloud/application_default_credentials.json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1043
1103
  <span class='kw'>end</span></pre>
1044
1104
  </td>
1045
1105
  </tr>
@@ -1298,7 +1358,7 @@ AWS usually, users do not need to care of this.</p>
1298
1358
  <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 59</span>
1299
1359
 
1300
1360
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_project'>project</span>
1301
- <span class='ivar'>@project</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_PROJECT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_PROJECT</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_credential'>credential</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>project_id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_project_default'>project_default</span>
1361
+ <span class='ivar'>@project</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_PROJECT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_PROJECT</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_credentials'>credentials</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>project_id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_project_default'>project_default</span>
1302
1362
  <span class='kw'>end</span></pre>
1303
1363
  </td>
1304
1364
  </tr>
@@ -1320,12 +1380,12 @@ AWS usually, users do not need to care of this.</p>
1320
1380
  <pre class="lines">
1321
1381
 
1322
1382
 
1323
- 43
1324
- 44
1325
- 45</pre>
1383
+ 47
1384
+ 48
1385
+ 49</pre>
1326
1386
  </td>
1327
1387
  <td>
1328
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 43</span>
1388
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 47</span>
1329
1389
 
1330
1390
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_project_default'>project_default</span>
1331
1391
  <span class='lparen'>(</span><span class='id identifier rubyid_config_default'>config_default</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>core</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>project</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
@@ -1423,66 +1483,6 @@ AWS usually, users do not need to care of this.</p>
1423
1483
  </td>
1424
1484
  </tr>
1425
1485
  </table>
1426
- </div>
1427
-
1428
- <div class="method_details ">
1429
- <h3 class="signature " id="service_account-class_method">
1430
-
1431
- + (<tt>Object</tt>) <strong>service_account</strong>
1432
-
1433
-
1434
-
1435
-
1436
-
1437
- </h3><table class="source_code">
1438
- <tr>
1439
- <td>
1440
- <pre class="lines">
1441
-
1442
-
1443
- 55
1444
- 56
1445
- 57</pre>
1446
- </td>
1447
- <td>
1448
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 55</span>
1449
-
1450
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_service_account'>service_account</span>
1451
- <span class='ivar'>@service_account</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_SERVICE_ACCOUNT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOOGLE_SERVICE_ACCOUNT</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_service_account_default'>service_account_default</span>
1452
- <span class='kw'>end</span></pre>
1453
- </td>
1454
- </tr>
1455
- </table>
1456
- </div>
1457
-
1458
- <div class="method_details ">
1459
- <h3 class="signature " id="service_account_default-class_method">
1460
-
1461
- + (<tt>Object</tt>) <strong>service_account_default</strong>
1462
-
1463
-
1464
-
1465
-
1466
-
1467
- </h3><table class="source_code">
1468
- <tr>
1469
- <td>
1470
- <pre class="lines">
1471
-
1472
-
1473
- 39
1474
- 40
1475
- 41</pre>
1476
- </td>
1477
- <td>
1478
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 39</span>
1479
-
1480
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_service_account_default'>service_account_default</span>
1481
- <span class='lparen'>(</span><span class='id identifier rubyid_config_default'>config_default</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>core</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>account</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
1482
- <span class='kw'>end</span></pre>
1483
- </td>
1484
- </tr>
1485
- </table>
1486
1486
  </div>
1487
1487
 
1488
1488
  <div class="method_details ">
@@ -1572,12 +1572,12 @@ AWS usually, users do not need to care of this</p>
1572
1572
  <pre class="lines">
1573
1573
 
1574
1574
 
1575
- 47
1576
- 48
1577
- 49</pre>
1575
+ 51
1576
+ 52
1577
+ 53</pre>
1578
1578
  </td>
1579
1579
  <td>
1580
- <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 47</span>
1580
+ <pre class="code"><span class="info file"># File 'lib/gce/host/config.rb', line 51</span>
1581
1581
 
1582
1582
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_zone_default'>zone_default</span>
1583
1583
  <span class='lparen'>(</span><span class='id identifier rubyid_config_default'>config_default</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>compute</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>zone</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
@@ -1592,7 +1592,7 @@ AWS usually, users do not need to care of this</p>
1592
1592
  </div>
1593
1593
 
1594
1594
  <div id="footer">
1595
- Generated on Fri Nov 25 20:32:55 2016 by
1595
+ Generated on Fri Nov 25 21:03:58 2016 by
1596
1596
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1597
1597
  0.8.7.6 (ruby-2.3.2).
1598
1598
  </div>
@@ -206,7 +206,7 @@
206
206
  </div>
207
207
 
208
208
  <div id="footer">
209
- Generated on Fri Nov 25 20:32:55 2016 by
209
+ Generated on Fri Nov 25 21:03:58 2016 by
210
210
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
211
211
  0.8.7.6 (ruby-2.3.2).
212
212
  </div>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Fri Nov 25 20:32:55 2016 by
121
+ Generated on Fri Nov 25 21:03:58 2016 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.8.7.6 (ruby-2.3.2).
124
124
  </div>
@@ -122,7 +122,7 @@
122
122
  </div>
123
123
 
124
124
  <div id="footer">
125
- Generated on Fri Nov 25 20:32:55 2016 by
125
+ Generated on Fri Nov 25 21:03:58 2016 by
126
126
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
127
127
  0.8.7.6 (ruby-2.3.2).
128
128
  </div>
@@ -169,7 +169,7 @@
169
169
  </div>
170
170
 
171
171
  <div id="footer">
172
- Generated on Fri Nov 25 20:32:55 2016 by
172
+ Generated on Fri Nov 25 21:03:57 2016 by
173
173
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
174
174
  0.8.7.6 (ruby-2.3.2).
175
175
  </div>
@@ -1701,7 +1701,7 @@ web:app1,db:app1 :instance, # Aws::GCE::Types::Instance itself</p>
1701
1701
  </div>
1702
1702
 
1703
1703
  <div id="footer">
1704
- Generated on Fri Nov 25 20:32:55 2016 by
1704
+ Generated on Fri Nov 25 21:03:58 2016 by
1705
1705
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1706
1706
  0.8.7.6 (ruby-2.3.2).
1707
1707
  </div>
@@ -923,7 +923,7 @@
923
923
  </div>
924
924
 
925
925
  <div id="footer">
926
- Generated on Fri Nov 25 20:32:55 2016 by
926
+ Generated on Fri Nov 25 21:03:58 2016 by
927
927
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
928
928
  0.8.7.6 (ruby-2.3.2).
929
929
  </div>
@@ -350,7 +350,7 @@
350
350
  </div>
351
351
 
352
352
  <div id="footer">
353
- Generated on Fri Nov 25 20:32:55 2016 by
353
+ Generated on Fri Nov 25 21:03:57 2016 by
354
354
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
355
355
  0.8.7.6 (ruby-2.3.2).
356
356
  </div>
data/docs/_index.html CHANGED
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Fri Nov 25 20:32:54 2016 by
225
+ Generated on Fri Nov 25 21:03:56 2016 by
226
226
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.8.7.6 (ruby-2.3.2).
228
228
  </div>
@@ -86,7 +86,7 @@ DEALINGS IN THE SOFTWARE.</p>
86
86
  </div></div>
87
87
 
88
88
  <div id="footer">
89
- Generated on Fri Nov 25 20:32:55 2016 by
89
+ Generated on Fri Nov 25 21:03:57 2016 by
90
90
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
91
91
  0.8.7.6 (ruby-2.3.2).
92
92
  </div>
@@ -90,17 +90,15 @@ variables:</p>
90
90
 
91
91
  <p>GOOGLE API parameters:</p>
92
92
  <ul><li>
93
- <p><strong>AUTH_METHOD</strong>: Authentication method. Currently,
94
- <code>compute_engine</code>, <code>json_key</code> and
95
- <code>application_default</code> is available. The default is
96
- <code>applilcation_default</code>.</p>
93
+ <p><strong>AUTH_METHOD (optional)</strong>: Authentication method. Currently,
94
+ <code>compute_engine</code>, <code>service_account</code>,
95
+ <code>authorized_user</code>, and <code>application_default</code> is
96
+ available. The default reads from
97
+ <code>GOOGLE_APPLICATION_CREDENTIALS</code>.</p>
97
98
  </li><li>
98
- <p><strong>GOOGLE_APPLICATION_CREDENTIALS (optional)</strong>: Path of
99
- credential file. Specify your service account json file for
100
- <code>json_key</code> authentication method. Try reading from
101
- <code>~/.config/gcloud/legacy_credentials/#{service_account}/adc.json</code>
102
- as default, where the <code>service_account</code> is being read from
103
- <code>~/.config/gcloud/configurations/config_default</code>.</p>
99
+ <p><strong>GOOGLE_APPLICATION_CREDENTIALS (optional)</strong>: Specify path of
100
+ json credential file. The default is
101
+ <code>~/.config/gcloud/application_default_credentials.json</code>.</p>
104
102
  </li></ul>
105
103
 
106
104
  <p>gce-host parameters:</p>
@@ -306,7 +304,7 @@ $ env ($cat .env) terraform apply</code></pre>
306
304
  </div></div>
307
305
 
308
306
  <div id="footer">
309
- Generated on Fri Nov 25 20:32:55 2016 by
307
+ Generated on Fri Nov 25 21:03:57 2016 by
310
308
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
311
309
  0.8.7.6 (ruby-2.3.2).
312
310
  </div>
data/docs/index.html CHANGED
@@ -90,17 +90,15 @@ variables:</p>
90
90
 
91
91
  <p>GOOGLE API parameters:</p>
92
92
  <ul><li>
93
- <p><strong>AUTH_METHOD</strong>: Authentication method. Currently,
94
- <code>compute_engine</code>, <code>json_key</code> and
95
- <code>application_default</code> is available. The default is
96
- <code>applilcation_default</code>.</p>
93
+ <p><strong>AUTH_METHOD (optional)</strong>: Authentication method. Currently,
94
+ <code>compute_engine</code>, <code>service_account</code>,
95
+ <code>authorized_user</code>, and <code>application_default</code> is
96
+ available. The default reads from
97
+ <code>GOOGLE_APPLICATION_CREDENTIALS</code>.</p>
97
98
  </li><li>
98
- <p><strong>GOOGLE_APPLICATION_CREDENTIALS (optional)</strong>: Path of
99
- credential file. Specify your service account json file for
100
- <code>json_key</code> authentication method. Try reading from
101
- <code>~/.config/gcloud/legacy_credentials/#{service_account}/adc.json</code>
102
- as default, where the <code>service_account</code> is being read from
103
- <code>~/.config/gcloud/configurations/config_default</code>.</p>
99
+ <p><strong>GOOGLE_APPLICATION_CREDENTIALS (optional)</strong>: Specify path of
100
+ json credential file. The default is
101
+ <code>~/.config/gcloud/application_default_credentials.json</code>.</p>
104
102
  </li></ul>
105
103
 
106
104
  <p>gce-host parameters:</p>
@@ -306,7 +304,7 @@ $ env ($cat .env) terraform apply</code></pre>
306
304
  </div></div>
307
305
 
308
306
  <div id="footer">
309
- Generated on Fri Nov 25 20:32:54 2016 by
307
+ Generated on Fri Nov 25 21:03:57 2016 by
310
308
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
311
309
  0.8.7.6 (ruby-2.3.2).
312
310
  </div>
@@ -57,6 +57,18 @@
57
57
  </li>
58
58
 
59
59
 
60
+ <li class="r2 ">
61
+ <span class='object_link'><a href="GCE/Host/Config.html#account-class_method" title="GCE::Host::Config.account (method)">account</a></span>
62
+ <small>GCE::Host::Config</small>
63
+ </li>
64
+
65
+
66
+ <li class="r1 ">
67
+ <span class='object_link'><a href="GCE/Host/Config.html#account_default-class_method" title="GCE::Host::Config.account_default (method)">account_default</a></span>
68
+ <small>GCE::Host::Config</small>
69
+ </li>
70
+
71
+
60
72
  <li class="r2 ">
61
73
  <span class='object_link'><a href="GCE/Host/Config.html#array_value_delimiter-class_method" title="GCE::Host::Config.array_value_delimiter (method)">array_value_delimiter</a></span>
62
74
  <small>GCE::Host::Config</small>
@@ -130,19 +142,19 @@
130
142
 
131
143
 
132
144
  <li class="r2 ">
133
- <span class='object_link'><a href="GCE/Host/Config.html#credential-class_method" title="GCE::Host::Config.credential (method)">credential</a></span>
145
+ <span class='object_link'><a href="GCE/Host/Config.html#credentials-class_method" title="GCE::Host::Config.credentials (method)">credentials</a></span>
134
146
  <small>GCE::Host::Config</small>
135
147
  </li>
136
148
 
137
149
 
138
150
  <li class="r1 ">
139
- <span class='object_link'><a href="GCE/Host/Config.html#credential_file-class_method" title="GCE::Host::Config.credential_file (method)">credential_file</a></span>
151
+ <span class='object_link'><a href="GCE/Host/Config.html#credentials_file-class_method" title="GCE::Host::Config.credentials_file (method)">credentials_file</a></span>
140
152
  <small>GCE::Host::Config</small>
141
153
  </li>
142
154
 
143
155
 
144
156
  <li class="r2 ">
145
- <span class='object_link'><a href="GCE/Host/Config.html#credential_file_default-class_method" title="GCE::Host::Config.credential_file_default (method)">credential_file_default</a></span>
157
+ <span class='object_link'><a href="GCE/Host/Config.html#credentials_file_default-class_method" title="GCE::Host::Config.credentials_file_default (method)">credentials_file_default</a></span>
146
158
  <small>GCE::Host::Config</small>
147
159
  </li>
148
160
 
@@ -184,38 +196,38 @@
184
196
 
185
197
 
186
198
  <li class="r1 ">
187
- <span class='object_link'><a href="GCE/Host/CLI.html#initialize-instance_method" title="GCE::Host::CLI#initialize (method)">#initialize</a></span>
188
- <small>GCE::Host::CLI</small>
199
+ <span class='object_link'><a href="GCE/Host/HostData.html#initialize-instance_method" title="GCE::Host::HostData#initialize (method)">#initialize</a></span>
200
+ <small>GCE::Host::HostData</small>
189
201
  </li>
190
202
 
191
203
 
192
204
  <li class="r2 ">
193
- <span class='object_link'><a href="GCE/Host/RoleData.html#initialize-instance_method" title="GCE::Host::RoleData#initialize (method)">#initialize</a></span>
194
- <small>GCE::Host::RoleData</small>
205
+ <span class='object_link'><a href="GCE/Host.html#initialize-instance_method" title="GCE::Host#initialize (method)">#initialize</a></span>
206
+ <small>GCE::Host</small>
195
207
  </li>
196
208
 
197
209
 
198
210
  <li class="r1 ">
199
- <span class='object_link'><a href="GCE/Host.html#initialize-instance_method" title="GCE::Host#initialize (method)">#initialize</a></span>
200
- <small>GCE::Host</small>
211
+ <span class='object_link'><a href="GCE/Host/CLI.html#initialize-instance_method" title="GCE::Host::CLI#initialize (method)">#initialize</a></span>
212
+ <small>GCE::Host::CLI</small>
201
213
  </li>
202
214
 
203
215
 
204
216
  <li class="r2 ">
205
- <span class='object_link'><a href="GCE/Host/HostData.html#initialize-instance_method" title="GCE::Host::HostData#initialize (method)">#initialize</a></span>
206
- <small>GCE::Host::HostData</small>
217
+ <span class='object_link'><a href="GCE/Host/RoleData.html#initialize-instance_method" title="GCE::Host::RoleData#initialize (method)">#initialize</a></span>
218
+ <small>GCE::Host::RoleData</small>
207
219
  </li>
208
220
 
209
221
 
210
222
  <li class="r1 ">
211
- <span class='object_link'><a href="GCE/Host/HostData.html#inspect-instance_method" title="GCE::Host::HostData#inspect (method)">#inspect</a></span>
212
- <small>GCE::Host::HostData</small>
223
+ <span class='object_link'><a href="GCE/Host/RoleData.html#inspect-instance_method" title="GCE::Host::RoleData#inspect (method)">#inspect</a></span>
224
+ <small>GCE::Host::RoleData</small>
213
225
  </li>
214
226
 
215
227
 
216
228
  <li class="r2 ">
217
- <span class='object_link'><a href="GCE/Host/RoleData.html#inspect-instance_method" title="GCE::Host::RoleData#inspect (method)">#inspect</a></span>
218
- <small>GCE::Host::RoleData</small>
229
+ <span class='object_link'><a href="GCE/Host/HostData.html#inspect-instance_method" title="GCE::Host::HostData#inspect (method)">#inspect</a></span>
230
+ <small>GCE::Host::HostData</small>
219
231
  </li>
220
232
 
221
233
 
@@ -256,14 +268,14 @@
256
268
 
257
269
 
258
270
  <li class="r1 ">
259
- <span class='object_link'><a href="GCE/Host/HostData.html#match%3F-instance_method" title="GCE::Host::HostData#match? (method)">#match?</a></span>
260
- <small>GCE::Host::HostData</small>
271
+ <span class='object_link'><a href="GCE/Host/RoleData.html#match%3F-instance_method" title="GCE::Host::RoleData#match? (method)">#match?</a></span>
272
+ <small>GCE::Host::RoleData</small>
261
273
  </li>
262
274
 
263
275
 
264
276
  <li class="r2 ">
265
- <span class='object_link'><a href="GCE/Host/RoleData.html#match%3F-instance_method" title="GCE::Host::RoleData#match? (method)">#match?</a></span>
266
- <small>GCE::Host::RoleData</small>
277
+ <span class='object_link'><a href="GCE/Host/HostData.html#match%3F-instance_method" title="GCE::Host::HostData#match? (method)">#match?</a></span>
278
+ <small>GCE::Host::HostData</small>
267
279
  </li>
268
280
 
269
281
 
@@ -435,18 +447,6 @@
435
447
  </li>
436
448
 
437
449
 
438
- <li class="r1 ">
439
- <span class='object_link'><a href="GCE/Host/Config.html#service_account-class_method" title="GCE::Host::Config.service_account (method)">service_account</a></span>
440
- <small>GCE::Host::Config</small>
441
- </li>
442
-
443
-
444
- <li class="r2 ">
445
- <span class='object_link'><a href="GCE/Host/Config.html#service_account_default-class_method" title="GCE::Host::Config.service_account_default (method)">service_account_default</a></span>
446
- <small>GCE::Host::Config</small>
447
- </li>
448
-
449
-
450
450
  <li class="r1 ">
451
451
  <span class='object_link'><a href="GCE/Host/StringUtil.html#singularize-class_method" title="GCE::Host::StringUtil.singularize (method)">singularize</a></span>
452
452
  <small>GCE::Host::StringUtil</small>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Fri Nov 25 20:32:55 2016 by
106
+ Generated on Fri Nov 25 21:03:57 2016 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.7.6 (ruby-2.3.2).
109
109
  </div>
@@ -16,16 +16,20 @@ class GCE
16
16
  end
17
17
 
18
18
  def self.auth_method
19
- @auth_method ||= ENV['AUTH_METHOD'] || config.fetch('AUTH_METHOD', 'application_default')
19
+ @auth_method ||= ENV['AUTH_METHOD'] || config.fetch('AUTH_METHOD', nil) || credentials['type'] || 'application_default'
20
20
  end
21
21
 
22
- def self.credential_file
22
+ def self.credentials_file
23
23
  # ref. https://developers.google.com/identity/protocols/application-default-credentials
24
- @credential_file ||= File.expand_path(ENV['GOOGLE_APPLICATION_CREDENTIALS'] || config.fetch('GOOGLE_APPLICATION_CREDENTIALS', nil) || credential_file_default)
24
+ @credential_file ||= File.expand_path(ENV['GOOGLE_APPLICATION_CREDENTIALS'] || config.fetch('GOOGLE_APPLICATION_CREDENTIALS', nil) || credentials_file_default)
25
25
  end
26
26
 
27
- def self.credential
28
- File.readable?(credential_file) ? JSON.parse(File.read(credential_file)) : {}
27
+ def self.credentials_file_default
28
+ @credentials_file_default ||= File.expand_path("~/.config/gcloud/application_default_credentials.json")
29
+ end
30
+
31
+ def self.credentials
32
+ File.readable?(credentials_file) ? JSON.parse(File.read(credentials_file)) : {}
29
33
  end
30
34
 
31
35
  def self.config_default_file
@@ -36,7 +40,7 @@ class GCE
36
40
  @config_default ||= File.readable?(config_default_file) ? IniFile.load(config_default_file).to_h : {}
37
41
  end
38
42
 
39
- def self.service_account_default
43
+ def self.account_default
40
44
  (config_default['core'] || {})['account']
41
45
  end
42
46
 
@@ -48,16 +52,12 @@ class GCE
48
52
  (config_default['compute'] || {})['zone']
49
53
  end
50
54
 
51
- def self.credential_file_default
52
- @credential_file_default ||= File.expand_path("~/.config/gcloud/legacy_credentials/#{service_account}/adc.json")
53
- end
54
-
55
- def self.service_account
56
- @service_account ||= ENV['GOOGLE_SERVICE_ACCOUNT'] || config.fetch('GOOGLE_SERVICE_ACCOUNT', nil) || service_account_default
55
+ def self.account
56
+ @account ||= ENV['GOOGLE_ACCOUNT'] || config.fetch('GOOGLE_ACCOUNT', nil) || account_default
57
57
  end
58
58
 
59
59
  def self.project
60
- @project ||= ENV['GOOGLE_PROJECT'] || config.fetch('GOOGLE_PROJECT', nil) || credential['project_id'] || project_default
60
+ @project ||= ENV['GOOGLE_PROJECT'] || config.fetch('GOOGLE_PROJECT', nil) || credentials['project_id'] || project_default
61
61
  end
62
62
 
63
63
  def self.log_level
@@ -36,12 +36,16 @@ class GCE
36
36
  when 'compute_engine'
37
37
  auth = Google::Auth::GCECredentials.new
38
38
 
39
- when 'json_key'
40
- credential_file = Config.credential_file
41
- auth = File.open(credential_file) do |f|
39
+ when 'service_account'
40
+ auth = File.open(Config.credentials_file) do |f|
42
41
  Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: f, scope: scope)
43
42
  end
44
43
 
44
+ when 'authorized_user'
45
+ auth = File.open(Config.credentials_file) do |f|
46
+ Google::Auth::UserRefreshCredentials.make_creds(json_key_io: f, scope: scope)
47
+ end
48
+
45
49
  when 'application_default'
46
50
  auth = Google::Auth.get_application_default([scope])
47
51
 
@@ -1,5 +1,5 @@
1
1
  class GCE
2
2
  class Host
3
- VERSION = '0.2.1'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gce-host
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo