gcloud 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (998) hide show
  1. checksums.yaml +7 -0
  2. data/{packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/ext/__init__.py → .gemtest} +0 -0
  3. data/.rubocop.yml +17 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CONTRIBUTING.md +93 -0
  6. data/LICENSE +201 -674
  7. data/Manifest.txt +66 -0
  8. data/README.md +110 -12
  9. data/Rakefile +34 -3
  10. data/gcloud.gemspec +48 -17
  11. data/lib/gcloud.rb +8 -0
  12. data/lib/gcloud/backoff.rb +115 -0
  13. data/lib/gcloud/credentials.rb +124 -0
  14. data/lib/gcloud/datastore.rb +66 -0
  15. data/lib/gcloud/datastore/connection.rb +177 -0
  16. data/lib/gcloud/datastore/credentials.rb +41 -0
  17. data/lib/gcloud/datastore/dataset.rb +259 -0
  18. data/lib/gcloud/datastore/dataset/lookup_results.rb +60 -0
  19. data/lib/gcloud/datastore/dataset/query_results.rb +87 -0
  20. data/lib/gcloud/datastore/entity.rb +257 -0
  21. data/lib/gcloud/datastore/errors.rb +65 -0
  22. data/lib/gcloud/datastore/key.rb +151 -0
  23. data/lib/gcloud/datastore/properties.rb +102 -0
  24. data/lib/gcloud/datastore/proto.rb +253 -0
  25. data/lib/gcloud/datastore/query.rb +189 -0
  26. data/lib/gcloud/datastore/transaction.rb +116 -0
  27. data/lib/gcloud/proto/datastore_v1.pb.rb +377 -0
  28. data/lib/gcloud/storage.rb +78 -0
  29. data/lib/gcloud/storage/bucket.rb +254 -0
  30. data/lib/gcloud/storage/bucket/acl.rb +311 -0
  31. data/lib/gcloud/storage/bucket/list.rb +45 -0
  32. data/lib/gcloud/storage/connection.rb +358 -0
  33. data/{packages/gsutil/gslib/commands/__init__.py → lib/gcloud/storage/credentials.rb} +13 -2
  34. data/lib/gcloud/storage/errors.rb +78 -0
  35. data/lib/gcloud/storage/file.rb +287 -0
  36. data/lib/gcloud/storage/file/acl.rb +172 -0
  37. data/lib/gcloud/storage/file/list.rb +52 -0
  38. data/lib/gcloud/storage/file/verifier.rb +65 -0
  39. data/lib/gcloud/storage/project.rb +119 -0
  40. data/lib/gcloud/version.rb +5 -0
  41. data/{packages/gsutil/gslib/tests/testcase/__init__.py → rakelib/console.rake} +14 -4
  42. data/{packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version.py → rakelib/manifest.rake} +11 -4
  43. data/{packages/gsutil/gslib/addlhelp/__init__.py → rakelib/proto.rake} +4 -2
  44. data/{packages/gsutil/gslib/tests/__init__.py → rakelib/rubocop.rake} +4 -2
  45. data/rakelib/test.rake +144 -0
  46. data/test/gcloud/datastore/proto/test_cursor.rb +36 -0
  47. data/test/gcloud/datastore/proto/test_direction.rb +60 -0
  48. data/test/gcloud/datastore/proto/test_operator.rb +76 -0
  49. data/test/gcloud/datastore/proto/test_value.rb +231 -0
  50. data/test/gcloud/datastore/test_connection.rb +93 -0
  51. data/test/gcloud/datastore/test_credentials.rb +38 -0
  52. data/test/gcloud/datastore/test_dataset.rb +413 -0
  53. data/test/gcloud/datastore/test_entity.rb +161 -0
  54. data/test/gcloud/datastore/test_entity_exclude.rb +225 -0
  55. data/test/gcloud/datastore/test_key.rb +189 -0
  56. data/test/gcloud/datastore/test_query.rb +271 -0
  57. data/test/gcloud/datastore/test_transaction.rb +121 -0
  58. data/test/gcloud/storage/test_backoff.rb +127 -0
  59. data/test/gcloud/storage/test_bucket.rb +270 -0
  60. data/test/gcloud/storage/test_bucket_acl.rb +253 -0
  61. data/test/gcloud/storage/test_default_acl.rb +256 -0
  62. data/test/gcloud/storage/test_file.rb +221 -0
  63. data/test/gcloud/storage/test_file_acl.rb +367 -0
  64. data/test/gcloud/storage/test_project.rb +180 -0
  65. data/{packages/gsutil/gslib/no_op_auth_plugin.py → test/gcloud/storage/test_storage.rb} +14 -15
  66. data/test/gcloud/storage/test_verifier.rb +62 -0
  67. data/test/gcloud/test_version.rb +8 -0
  68. data/test/helper.rb +91 -0
  69. metadata +259 -1020
  70. data.tar.gz.sig +0 -2
  71. data/CHANGELOG +0 -14
  72. data/Makefile +0 -13
  73. data/Manifest +0 -937
  74. data/TODO +0 -2
  75. data/bin/gcloud +0 -7
  76. data/bin/gcutil-symlink +0 -53
  77. data/bin/gsutil-symlink +0 -377
  78. data/init.rb +0 -3
  79. data/packages/README +0 -6
  80. data/packages/gcutil-1.7.1.tar.gz +0 -0
  81. data/packages/gcutil-1.7.1/CHANGELOG +0 -197
  82. data/packages/gcutil-1.7.1/LICENSE +0 -202
  83. data/packages/gcutil-1.7.1/VERSION +0 -1
  84. data/packages/gcutil-1.7.1/gcutil +0 -53
  85. data/packages/gcutil-1.7.1/lib/google_api_python_client/LICENSE +0 -23
  86. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/__init__.py +0 -1
  87. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/__init__.pyc +0 -0
  88. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/discovery.py +0 -743
  89. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/discovery.pyc +0 -0
  90. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/errors.py +0 -123
  91. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/errors.pyc +0 -0
  92. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/http.py +0 -1443
  93. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/http.pyc +0 -0
  94. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/mimeparse.py +0 -172
  95. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/mimeparse.pyc +0 -0
  96. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/model.py +0 -385
  97. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/model.pyc +0 -0
  98. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/schema.py +0 -303
  99. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/schema.pyc +0 -0
  100. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/__init__.py +0 -1
  101. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/__init__.pyc +0 -0
  102. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/anyjson.py +0 -32
  103. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/anyjson.pyc +0 -0
  104. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/appengine.py +0 -528
  105. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/client.py +0 -1139
  106. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/client.pyc +0 -0
  107. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/clientsecrets.py +0 -105
  108. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/clientsecrets.pyc +0 -0
  109. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/crypt.py +0 -244
  110. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/crypt.pyc +0 -0
  111. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/django_orm.py +0 -124
  112. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/file.py +0 -107
  113. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/locked_file.py +0 -343
  114. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/locked_file.pyc +0 -0
  115. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/multistore_file.py +0 -379
  116. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/multistore_file.pyc +0 -0
  117. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/tools.py +0 -174
  118. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/tools.pyc +0 -0
  119. data/packages/gcutil-1.7.1/lib/google_api_python_client/uritemplate/__init__.py +0 -147
  120. data/packages/gcutil-1.7.1/lib/google_api_python_client/uritemplate/__init__.pyc +0 -0
  121. data/packages/gcutil-1.7.1/lib/google_apputils/LICENSE +0 -202
  122. data/packages/gcutil-1.7.1/lib/google_apputils/google/__init__.py +0 -3
  123. data/packages/gcutil-1.7.1/lib/google_apputils/google/__init__.pyc +0 -0
  124. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/__init__.py +0 -3
  125. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/__init__.pyc +0 -0
  126. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/app.py +0 -356
  127. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/app.pyc +0 -0
  128. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/appcommands.py +0 -783
  129. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/appcommands.pyc +0 -0
  130. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/basetest.py +0 -1260
  131. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/datelib.py +0 -421
  132. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/debug.py +0 -60
  133. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/file_util.py +0 -181
  134. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/resources.py +0 -67
  135. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/run_script_module.py +0 -217
  136. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/setup_command.py +0 -159
  137. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/shellutil.py +0 -49
  138. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/stopwatch.py +0 -204
  139. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/__init__.py +0 -0
  140. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/__init__.pyc +0 -0
  141. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auth_helper.py +0 -140
  142. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auth_helper.pyc +0 -0
  143. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auth_helper_test.py +0 -149
  144. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auto_auth.py +0 -130
  145. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auto_auth.pyc +0 -0
  146. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auto_auth_test.py +0 -75
  147. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/basic_cmds.py +0 -128
  148. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/basic_cmds.pyc +0 -0
  149. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/basic_cmds_test.py +0 -111
  150. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/command_base.py +0 -1808
  151. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/command_base.pyc +0 -0
  152. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/command_base_test.py +0 -1651
  153. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/compute/v1beta13.json +0 -2851
  154. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/compute/v1beta14.json +0 -3361
  155. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/disk_cmds.py +0 -342
  156. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/disk_cmds.pyc +0 -0
  157. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/disk_cmds_test.py +0 -474
  158. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/firewall_cmds.py +0 -344
  159. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/firewall_cmds.pyc +0 -0
  160. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/firewall_cmds_test.py +0 -231
  161. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/flags_cache.py +0 -274
  162. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/flags_cache.pyc +0 -0
  163. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/gcutil +0 -89
  164. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/gcutil_logging.py +0 -69
  165. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/gcutil_logging.pyc +0 -0
  166. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/image_cmds.py +0 -262
  167. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/image_cmds.pyc +0 -0
  168. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/image_cmds_test.py +0 -172
  169. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.py +0 -1506
  170. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyc +0 -0
  171. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds_test.py +0 -1904
  172. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/kernel_cmds.py +0 -91
  173. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/kernel_cmds.pyc +0 -0
  174. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/kernel_cmds_test.py +0 -56
  175. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/machine_type_cmds.py +0 -106
  176. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/machine_type_cmds.pyc +0 -0
  177. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/machine_type_cmds_test.py +0 -59
  178. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata.py +0 -96
  179. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata.pyc +0 -0
  180. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata_lib.py +0 -357
  181. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata_lib.pyc +0 -0
  182. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata_test.py +0 -84
  183. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/mock_api.py +0 -420
  184. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/mock_metadata.py +0 -58
  185. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/move_cmds.py +0 -824
  186. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/move_cmds.pyc +0 -0
  187. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/move_cmds_test.py +0 -307
  188. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/network_cmds.py +0 -178
  189. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/network_cmds.pyc +0 -0
  190. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/network_cmds_test.py +0 -133
  191. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/operation_cmds.py +0 -181
  192. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/operation_cmds.pyc +0 -0
  193. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/operation_cmds_test.py +0 -196
  194. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/path_initializer.py +0 -38
  195. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/path_initializer.pyc +0 -0
  196. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/project_cmds.py +0 -173
  197. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/project_cmds.pyc +0 -0
  198. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/project_cmds_test.py +0 -111
  199. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/scopes.py +0 -61
  200. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/scopes.pyc +0 -0
  201. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/scopes_test.py +0 -50
  202. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/snapshot_cmds.py +0 -276
  203. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/snapshot_cmds.pyc +0 -0
  204. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/snapshot_cmds_test.py +0 -260
  205. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/ssh_keys.py +0 -266
  206. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/ssh_keys.pyc +0 -0
  207. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/ssh_keys_test.py +0 -128
  208. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/table_formatter.py +0 -563
  209. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/table_formatter.pyc +0 -0
  210. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/thread_pool.py +0 -188
  211. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/thread_pool.pyc +0 -0
  212. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/thread_pool_test.py +0 -88
  213. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/utils.py +0 -208
  214. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/utils.pyc +0 -0
  215. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/utils_test.py +0 -193
  216. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version.pyc +0 -0
  217. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version_checker.py +0 -246
  218. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version_checker.pyc +0 -0
  219. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version_checker_test.py +0 -271
  220. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds.py +0 -151
  221. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds.pyc +0 -0
  222. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py +0 -60
  223. data/packages/gcutil-1.7.1/lib/httplib2/LICENSE +0 -21
  224. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/__init__.py +0 -1630
  225. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/__init__.pyc +0 -0
  226. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/cacerts.txt +0 -714
  227. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/iri2uri.py +0 -110
  228. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/iri2uri.pyc +0 -0
  229. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/socks.py +0 -438
  230. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/socks.pyc +0 -0
  231. data/packages/gcutil-1.7.1/lib/iso8601/LICENSE +0 -20
  232. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/__init__.py +0 -1
  233. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/__init__.pyc +0 -0
  234. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/iso8601.py +0 -102
  235. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/iso8601.pyc +0 -0
  236. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/test_iso8601.py +0 -111
  237. data/packages/gcutil-1.7.1/lib/python_gflags/AUTHORS +0 -2
  238. data/packages/gcutil-1.7.1/lib/python_gflags/LICENSE +0 -28
  239. data/packages/gcutil-1.7.1/lib/python_gflags/gflags.py +0 -2862
  240. data/packages/gcutil-1.7.1/lib/python_gflags/gflags.pyc +0 -0
  241. data/packages/gcutil-1.7.1/lib/python_gflags/gflags2man.py +0 -544
  242. data/packages/gcutil-1.7.1/lib/python_gflags/gflags_validators.py +0 -187
  243. data/packages/gcutil-1.7.1/lib/python_gflags/gflags_validators.pyc +0 -0
  244. data/packages/gsutil.tar.gz +0 -0
  245. data/packages/gsutil/CHECKSUM +0 -1
  246. data/packages/gsutil/COPYING +0 -202
  247. data/packages/gsutil/LICENSE.third_party +0 -295
  248. data/packages/gsutil/MANIFEST.in +0 -5
  249. data/packages/gsutil/README +0 -38
  250. data/packages/gsutil/README.pkg +0 -49
  251. data/packages/gsutil/ReleaseNotes.txt +0 -780
  252. data/packages/gsutil/VERSION +0 -1
  253. data/packages/gsutil/boto/Changelog.rst +0 -35
  254. data/packages/gsutil/boto/LICENSE +0 -18
  255. data/packages/gsutil/boto/MANIFEST.in +0 -12
  256. data/packages/gsutil/boto/README.rst +0 -163
  257. data/packages/gsutil/boto/bin/asadmin +0 -290
  258. data/packages/gsutil/boto/bin/bundle_image +0 -27
  259. data/packages/gsutil/boto/bin/cfadmin +0 -108
  260. data/packages/gsutil/boto/bin/cq +0 -89
  261. data/packages/gsutil/boto/bin/cwutil +0 -140
  262. data/packages/gsutil/boto/bin/elbadmin +0 -284
  263. data/packages/gsutil/boto/bin/fetch_file +0 -43
  264. data/packages/gsutil/boto/bin/glacier +0 -154
  265. data/packages/gsutil/boto/bin/instance_events +0 -145
  266. data/packages/gsutil/boto/bin/kill_instance +0 -35
  267. data/packages/gsutil/boto/bin/launch_instance +0 -252
  268. data/packages/gsutil/boto/bin/list_instances +0 -90
  269. data/packages/gsutil/boto/bin/lss3 +0 -77
  270. data/packages/gsutil/boto/bin/mturk +0 -465
  271. data/packages/gsutil/boto/bin/pyami_sendmail +0 -52
  272. data/packages/gsutil/boto/bin/route53 +0 -205
  273. data/packages/gsutil/boto/bin/s3put +0 -374
  274. data/packages/gsutil/boto/bin/sdbadmin +0 -194
  275. data/packages/gsutil/boto/bin/taskadmin +0 -116
  276. data/packages/gsutil/boto/boto/__init__.py +0 -793
  277. data/packages/gsutil/boto/boto/__init__.pyc +0 -0
  278. data/packages/gsutil/boto/boto/auth.py +0 -682
  279. data/packages/gsutil/boto/boto/auth.pyc +0 -0
  280. data/packages/gsutil/boto/boto/auth_handler.py +0 -58
  281. data/packages/gsutil/boto/boto/auth_handler.pyc +0 -0
  282. data/packages/gsutil/boto/boto/beanstalk/__init__.py +0 -65
  283. data/packages/gsutil/boto/boto/beanstalk/exception.py +0 -64
  284. data/packages/gsutil/boto/boto/beanstalk/layer1.py +0 -1153
  285. data/packages/gsutil/boto/boto/beanstalk/response.py +0 -703
  286. data/packages/gsutil/boto/boto/beanstalk/wrapper.py +0 -29
  287. data/packages/gsutil/boto/boto/cacerts/__init__.py +0 -22
  288. data/packages/gsutil/boto/boto/cacerts/__init__.pyc +0 -0
  289. data/packages/gsutil/boto/boto/cacerts/cacerts.txt +0 -633
  290. data/packages/gsutil/boto/boto/cloudformation/__init__.py +0 -68
  291. data/packages/gsutil/boto/boto/cloudformation/connection.py +0 -364
  292. data/packages/gsutil/boto/boto/cloudformation/stack.py +0 -360
  293. data/packages/gsutil/boto/boto/cloudformation/template.py +0 -43
  294. data/packages/gsutil/boto/boto/cloudfront/__init__.py +0 -324
  295. data/packages/gsutil/boto/boto/cloudfront/distribution.py +0 -745
  296. data/packages/gsutil/boto/boto/cloudfront/exception.py +0 -26
  297. data/packages/gsutil/boto/boto/cloudfront/identity.py +0 -122
  298. data/packages/gsutil/boto/boto/cloudfront/invalidation.py +0 -216
  299. data/packages/gsutil/boto/boto/cloudfront/logging.py +0 -38
  300. data/packages/gsutil/boto/boto/cloudfront/object.py +0 -48
  301. data/packages/gsutil/boto/boto/cloudfront/origin.py +0 -150
  302. data/packages/gsutil/boto/boto/cloudfront/signers.py +0 -60
  303. data/packages/gsutil/boto/boto/cloudsearch/__init__.py +0 -45
  304. data/packages/gsutil/boto/boto/cloudsearch/document.py +0 -265
  305. data/packages/gsutil/boto/boto/cloudsearch/domain.py +0 -394
  306. data/packages/gsutil/boto/boto/cloudsearch/layer1.py +0 -738
  307. data/packages/gsutil/boto/boto/cloudsearch/layer2.py +0 -67
  308. data/packages/gsutil/boto/boto/cloudsearch/optionstatus.py +0 -248
  309. data/packages/gsutil/boto/boto/cloudsearch/search.py +0 -365
  310. data/packages/gsutil/boto/boto/cloudsearch/sourceattribute.py +0 -75
  311. data/packages/gsutil/boto/boto/compat.py +0 -28
  312. data/packages/gsutil/boto/boto/compat.pyc +0 -0
  313. data/packages/gsutil/boto/boto/connection.py +0 -1081
  314. data/packages/gsutil/boto/boto/connection.pyc +0 -0
  315. data/packages/gsutil/boto/boto/contrib/__init__.py +0 -22
  316. data/packages/gsutil/boto/boto/contrib/ymlmessage.py +0 -52
  317. data/packages/gsutil/boto/boto/core/README +0 -58
  318. data/packages/gsutil/boto/boto/core/__init__.py +0 -23
  319. data/packages/gsutil/boto/boto/core/auth.py +0 -78
  320. data/packages/gsutil/boto/boto/core/credentials.py +0 -154
  321. data/packages/gsutil/boto/boto/core/dictresponse.py +0 -178
  322. data/packages/gsutil/boto/boto/core/service.py +0 -67
  323. data/packages/gsutil/boto/boto/datapipeline/__init__.py +0 -0
  324. data/packages/gsutil/boto/boto/datapipeline/exceptions.py +0 -42
  325. data/packages/gsutil/boto/boto/datapipeline/layer1.py +0 -546
  326. data/packages/gsutil/boto/boto/dynamodb/__init__.py +0 -66
  327. data/packages/gsutil/boto/boto/dynamodb/batch.py +0 -262
  328. data/packages/gsutil/boto/boto/dynamodb/condition.py +0 -170
  329. data/packages/gsutil/boto/boto/dynamodb/exceptions.py +0 -64
  330. data/packages/gsutil/boto/boto/dynamodb/item.py +0 -196
  331. data/packages/gsutil/boto/boto/dynamodb/layer1.py +0 -575
  332. data/packages/gsutil/boto/boto/dynamodb/layer2.py +0 -798
  333. data/packages/gsutil/boto/boto/dynamodb/schema.py +0 -112
  334. data/packages/gsutil/boto/boto/dynamodb/table.py +0 -540
  335. data/packages/gsutil/boto/boto/dynamodb/types.py +0 -326
  336. data/packages/gsutil/boto/boto/ec2/__init__.py +0 -96
  337. data/packages/gsutil/boto/boto/ec2/address.py +0 -103
  338. data/packages/gsutil/boto/boto/ec2/autoscale/__init__.py +0 -781
  339. data/packages/gsutil/boto/boto/ec2/autoscale/activity.py +0 -74
  340. data/packages/gsutil/boto/boto/ec2/autoscale/group.py +0 -337
  341. data/packages/gsutil/boto/boto/ec2/autoscale/instance.py +0 -60
  342. data/packages/gsutil/boto/boto/ec2/autoscale/launchconfig.py +0 -209
  343. data/packages/gsutil/boto/boto/ec2/autoscale/policy.py +0 -166
  344. data/packages/gsutil/boto/boto/ec2/autoscale/request.py +0 -38
  345. data/packages/gsutil/boto/boto/ec2/autoscale/scheduled.py +0 -60
  346. data/packages/gsutil/boto/boto/ec2/autoscale/tag.py +0 -84
  347. data/packages/gsutil/boto/boto/ec2/blockdevicemapping.py +0 -141
  348. data/packages/gsutil/boto/boto/ec2/bundleinstance.py +0 -78
  349. data/packages/gsutil/boto/boto/ec2/buyreservation.py +0 -84
  350. data/packages/gsutil/boto/boto/ec2/cloudwatch/__init__.py +0 -603
  351. data/packages/gsutil/boto/boto/ec2/cloudwatch/alarm.py +0 -316
  352. data/packages/gsutil/boto/boto/ec2/cloudwatch/datapoint.py +0 -40
  353. data/packages/gsutil/boto/boto/ec2/cloudwatch/dimension.py +0 -38
  354. data/packages/gsutil/boto/boto/ec2/cloudwatch/listelement.py +0 -31
  355. data/packages/gsutil/boto/boto/ec2/cloudwatch/metric.py +0 -175
  356. data/packages/gsutil/boto/boto/ec2/connection.py +0 -3409
  357. data/packages/gsutil/boto/boto/ec2/ec2object.py +0 -107
  358. data/packages/gsutil/boto/boto/ec2/elb/__init__.py +0 -553
  359. data/packages/gsutil/boto/boto/ec2/elb/healthcheck.py +0 -89
  360. data/packages/gsutil/boto/boto/ec2/elb/instancestate.py +0 -62
  361. data/packages/gsutil/boto/boto/ec2/elb/listelement.py +0 -36
  362. data/packages/gsutil/boto/boto/ec2/elb/listener.py +0 -75
  363. data/packages/gsutil/boto/boto/ec2/elb/loadbalancer.py +0 -324
  364. data/packages/gsutil/boto/boto/ec2/elb/policies.py +0 -89
  365. data/packages/gsutil/boto/boto/ec2/elb/securitygroup.py +0 -38
  366. data/packages/gsutil/boto/boto/ec2/group.py +0 -39
  367. data/packages/gsutil/boto/boto/ec2/image.py +0 -350
  368. data/packages/gsutil/boto/boto/ec2/instance.py +0 -661
  369. data/packages/gsutil/boto/boto/ec2/instanceinfo.py +0 -51
  370. data/packages/gsutil/boto/boto/ec2/instancestatus.py +0 -207
  371. data/packages/gsutil/boto/boto/ec2/keypair.py +0 -113
  372. data/packages/gsutil/boto/boto/ec2/launchspecification.py +0 -105
  373. data/packages/gsutil/boto/boto/ec2/networkinterface.py +0 -247
  374. data/packages/gsutil/boto/boto/ec2/placementgroup.py +0 -51
  375. data/packages/gsutil/boto/boto/ec2/regioninfo.py +0 -34
  376. data/packages/gsutil/boto/boto/ec2/reservedinstance.py +0 -227
  377. data/packages/gsutil/boto/boto/ec2/securitygroup.py +0 -357
  378. data/packages/gsutil/boto/boto/ec2/snapshot.py +0 -170
  379. data/packages/gsutil/boto/boto/ec2/spotdatafeedsubscription.py +0 -63
  380. data/packages/gsutil/boto/boto/ec2/spotinstancerequest.py +0 -188
  381. data/packages/gsutil/boto/boto/ec2/spotpricehistory.py +0 -55
  382. data/packages/gsutil/boto/boto/ec2/tag.py +0 -87
  383. data/packages/gsutil/boto/boto/ec2/vmtype.py +0 -58
  384. data/packages/gsutil/boto/boto/ec2/volume.py +0 -293
  385. data/packages/gsutil/boto/boto/ec2/volumestatus.py +0 -200
  386. data/packages/gsutil/boto/boto/ec2/zone.py +0 -80
  387. data/packages/gsutil/boto/boto/ecs/__init__.py +0 -90
  388. data/packages/gsutil/boto/boto/ecs/item.py +0 -153
  389. data/packages/gsutil/boto/boto/elasticache/__init__.py +0 -62
  390. data/packages/gsutil/boto/boto/elasticache/layer1.py +0 -1252
  391. data/packages/gsutil/boto/boto/elastictranscoder/__init__.py +0 -62
  392. data/packages/gsutil/boto/boto/elastictranscoder/exceptions.py +0 -46
  393. data/packages/gsutil/boto/boto/elastictranscoder/layer1.py +0 -509
  394. data/packages/gsutil/boto/boto/emr/__init__.py +0 -73
  395. data/packages/gsutil/boto/boto/emr/bootstrap_action.py +0 -44
  396. data/packages/gsutil/boto/boto/emr/connection.py +0 -531
  397. data/packages/gsutil/boto/boto/emr/emrobject.py +0 -176
  398. data/packages/gsutil/boto/boto/emr/instance_group.py +0 -43
  399. data/packages/gsutil/boto/boto/emr/step.py +0 -281
  400. data/packages/gsutil/boto/boto/exception.py +0 -476
  401. data/packages/gsutil/boto/boto/exception.pyc +0 -0
  402. data/packages/gsutil/boto/boto/file/README +0 -49
  403. data/packages/gsutil/boto/boto/file/__init__.py +0 -28
  404. data/packages/gsutil/boto/boto/file/bucket.py +0 -112
  405. data/packages/gsutil/boto/boto/file/connection.py +0 -33
  406. data/packages/gsutil/boto/boto/file/key.py +0 -199
  407. data/packages/gsutil/boto/boto/file/simpleresultset.py +0 -30
  408. data/packages/gsutil/boto/boto/fps/__init__.py +0 -21
  409. data/packages/gsutil/boto/boto/fps/connection.py +0 -369
  410. data/packages/gsutil/boto/boto/fps/exception.py +0 -344
  411. data/packages/gsutil/boto/boto/fps/response.py +0 -175
  412. data/packages/gsutil/boto/boto/glacier/__init__.py +0 -57
  413. data/packages/gsutil/boto/boto/glacier/concurrent.py +0 -409
  414. data/packages/gsutil/boto/boto/glacier/exceptions.py +0 -58
  415. data/packages/gsutil/boto/boto/glacier/job.py +0 -152
  416. data/packages/gsutil/boto/boto/glacier/layer1.py +0 -637
  417. data/packages/gsutil/boto/boto/glacier/layer2.py +0 -93
  418. data/packages/gsutil/boto/boto/glacier/response.py +0 -48
  419. data/packages/gsutil/boto/boto/glacier/utils.py +0 -163
  420. data/packages/gsutil/boto/boto/glacier/vault.py +0 -387
  421. data/packages/gsutil/boto/boto/glacier/writer.py +0 -242
  422. data/packages/gsutil/boto/boto/gs/__init__.py +0 -22
  423. data/packages/gsutil/boto/boto/gs/__init__.pyc +0 -0
  424. data/packages/gsutil/boto/boto/gs/acl.py +0 -304
  425. data/packages/gsutil/boto/boto/gs/acl.pyc +0 -0
  426. data/packages/gsutil/boto/boto/gs/bucket.py +0 -870
  427. data/packages/gsutil/boto/boto/gs/bucket.pyc +0 -0
  428. data/packages/gsutil/boto/boto/gs/bucketlistresultset.py +0 -64
  429. data/packages/gsutil/boto/boto/gs/bucketlistresultset.pyc +0 -0
  430. data/packages/gsutil/boto/boto/gs/connection.py +0 -103
  431. data/packages/gsutil/boto/boto/gs/connection.pyc +0 -0
  432. data/packages/gsutil/boto/boto/gs/cors.py +0 -169
  433. data/packages/gsutil/boto/boto/gs/cors.pyc +0 -0
  434. data/packages/gsutil/boto/boto/gs/key.py +0 -704
  435. data/packages/gsutil/boto/boto/gs/key.pyc +0 -0
  436. data/packages/gsutil/boto/boto/gs/resumable_upload_handler.py +0 -659
  437. data/packages/gsutil/boto/boto/gs/resumable_upload_handler.pyc +0 -0
  438. data/packages/gsutil/boto/boto/gs/user.py +0 -54
  439. data/packages/gsutil/boto/boto/gs/user.pyc +0 -0
  440. data/packages/gsutil/boto/boto/handler.py +0 -44
  441. data/packages/gsutil/boto/boto/handler.pyc +0 -0
  442. data/packages/gsutil/boto/boto/https_connection.py +0 -124
  443. data/packages/gsutil/boto/boto/https_connection.pyc +0 -0
  444. data/packages/gsutil/boto/boto/iam/__init__.py +0 -74
  445. data/packages/gsutil/boto/boto/iam/connection.py +0 -1317
  446. data/packages/gsutil/boto/boto/iam/summarymap.py +0 -42
  447. data/packages/gsutil/boto/boto/jsonresponse.py +0 -163
  448. data/packages/gsutil/boto/boto/jsonresponse.pyc +0 -0
  449. data/packages/gsutil/boto/boto/manage/__init__.py +0 -23
  450. data/packages/gsutil/boto/boto/manage/cmdshell.py +0 -241
  451. data/packages/gsutil/boto/boto/manage/propget.py +0 -64
  452. data/packages/gsutil/boto/boto/manage/server.py +0 -556
  453. data/packages/gsutil/boto/boto/manage/task.py +0 -175
  454. data/packages/gsutil/boto/boto/manage/test_manage.py +0 -34
  455. data/packages/gsutil/boto/boto/manage/volume.py +0 -420
  456. data/packages/gsutil/boto/boto/mashups/__init__.py +0 -23
  457. data/packages/gsutil/boto/boto/mashups/interactive.py +0 -97
  458. data/packages/gsutil/boto/boto/mashups/iobject.py +0 -115
  459. data/packages/gsutil/boto/boto/mashups/order.py +0 -211
  460. data/packages/gsutil/boto/boto/mashups/server.py +0 -395
  461. data/packages/gsutil/boto/boto/mturk/__init__.py +0 -23
  462. data/packages/gsutil/boto/boto/mturk/connection.py +0 -1027
  463. data/packages/gsutil/boto/boto/mturk/layoutparam.py +0 -55
  464. data/packages/gsutil/boto/boto/mturk/notification.py +0 -103
  465. data/packages/gsutil/boto/boto/mturk/price.py +0 -48
  466. data/packages/gsutil/boto/boto/mturk/qualification.py +0 -137
  467. data/packages/gsutil/boto/boto/mturk/question.py +0 -455
  468. data/packages/gsutil/boto/boto/mws/__init__.py +0 -21
  469. data/packages/gsutil/boto/boto/mws/connection.py +0 -813
  470. data/packages/gsutil/boto/boto/mws/exception.py +0 -75
  471. data/packages/gsutil/boto/boto/mws/response.py +0 -655
  472. data/packages/gsutil/boto/boto/plugin.py +0 -90
  473. data/packages/gsutil/boto/boto/plugin.pyc +0 -0
  474. data/packages/gsutil/boto/boto/provider.py +0 -337
  475. data/packages/gsutil/boto/boto/provider.pyc +0 -0
  476. data/packages/gsutil/boto/boto/pyami/__init__.py +0 -22
  477. data/packages/gsutil/boto/boto/pyami/__init__.pyc +0 -0
  478. data/packages/gsutil/boto/boto/pyami/bootstrap.py +0 -134
  479. data/packages/gsutil/boto/boto/pyami/config.py +0 -229
  480. data/packages/gsutil/boto/boto/pyami/config.pyc +0 -0
  481. data/packages/gsutil/boto/boto/pyami/copybot.cfg +0 -60
  482. data/packages/gsutil/boto/boto/pyami/copybot.py +0 -97
  483. data/packages/gsutil/boto/boto/pyami/helloworld.py +0 -28
  484. data/packages/gsutil/boto/boto/pyami/installers/__init__.py +0 -64
  485. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/__init__.py +0 -22
  486. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/apache.py +0 -43
  487. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/ebs.py +0 -238
  488. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/installer.py +0 -96
  489. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/mysql.py +0 -109
  490. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/trac.py +0 -139
  491. data/packages/gsutil/boto/boto/pyami/launch_ami.py +0 -178
  492. data/packages/gsutil/boto/boto/pyami/scriptbase.py +0 -44
  493. data/packages/gsutil/boto/boto/pyami/startup.py +0 -60
  494. data/packages/gsutil/boto/boto/rds/__init__.py +0 -1194
  495. data/packages/gsutil/boto/boto/rds/dbinstance.py +0 -357
  496. data/packages/gsutil/boto/boto/rds/dbsecuritygroup.py +0 -177
  497. data/packages/gsutil/boto/boto/rds/dbsnapshot.py +0 -108
  498. data/packages/gsutil/boto/boto/rds/event.py +0 -49
  499. data/packages/gsutil/boto/boto/rds/parametergroup.py +0 -201
  500. data/packages/gsutil/boto/boto/rds/regioninfo.py +0 -32
  501. data/packages/gsutil/boto/boto/regioninfo.py +0 -63
  502. data/packages/gsutil/boto/boto/regioninfo.pyc +0 -0
  503. data/packages/gsutil/boto/boto/resultset.py +0 -169
  504. data/packages/gsutil/boto/boto/resultset.pyc +0 -0
  505. data/packages/gsutil/boto/boto/roboto/__init__.py +0 -1
  506. data/packages/gsutil/boto/boto/roboto/awsqueryrequest.py +0 -504
  507. data/packages/gsutil/boto/boto/roboto/awsqueryservice.py +0 -121
  508. data/packages/gsutil/boto/boto/roboto/param.py +0 -147
  509. data/packages/gsutil/boto/boto/route53/__init__.py +0 -75
  510. data/packages/gsutil/boto/boto/route53/connection.py +0 -403
  511. data/packages/gsutil/boto/boto/route53/exception.py +0 -27
  512. data/packages/gsutil/boto/boto/route53/hostedzone.py +0 -56
  513. data/packages/gsutil/boto/boto/route53/record.py +0 -306
  514. data/packages/gsutil/boto/boto/route53/status.py +0 -42
  515. data/packages/gsutil/boto/boto/route53/zone.py +0 -412
  516. data/packages/gsutil/boto/boto/s3/__init__.py +0 -84
  517. data/packages/gsutil/boto/boto/s3/__init__.pyc +0 -0
  518. data/packages/gsutil/boto/boto/s3/acl.py +0 -164
  519. data/packages/gsutil/boto/boto/s3/acl.pyc +0 -0
  520. data/packages/gsutil/boto/boto/s3/bucket.py +0 -1634
  521. data/packages/gsutil/boto/boto/s3/bucket.pyc +0 -0
  522. data/packages/gsutil/boto/boto/s3/bucketlistresultset.py +0 -139
  523. data/packages/gsutil/boto/boto/s3/bucketlistresultset.pyc +0 -0
  524. data/packages/gsutil/boto/boto/s3/bucketlogging.py +0 -83
  525. data/packages/gsutil/boto/boto/s3/bucketlogging.pyc +0 -0
  526. data/packages/gsutil/boto/boto/s3/connection.py +0 -540
  527. data/packages/gsutil/boto/boto/s3/connection.pyc +0 -0
  528. data/packages/gsutil/boto/boto/s3/cors.py +0 -210
  529. data/packages/gsutil/boto/boto/s3/cors.pyc +0 -0
  530. data/packages/gsutil/boto/boto/s3/deletemarker.py +0 -55
  531. data/packages/gsutil/boto/boto/s3/deletemarker.pyc +0 -0
  532. data/packages/gsutil/boto/boto/s3/key.py +0 -1712
  533. data/packages/gsutil/boto/boto/s3/key.pyc +0 -0
  534. data/packages/gsutil/boto/boto/s3/keyfile.py +0 -134
  535. data/packages/gsutil/boto/boto/s3/keyfile.pyc +0 -0
  536. data/packages/gsutil/boto/boto/s3/lifecycle.py +0 -231
  537. data/packages/gsutil/boto/boto/s3/lifecycle.pyc +0 -0
  538. data/packages/gsutil/boto/boto/s3/multidelete.py +0 -138
  539. data/packages/gsutil/boto/boto/s3/multidelete.pyc +0 -0
  540. data/packages/gsutil/boto/boto/s3/multipart.py +0 -315
  541. data/packages/gsutil/boto/boto/s3/multipart.pyc +0 -0
  542. data/packages/gsutil/boto/boto/s3/prefix.py +0 -42
  543. data/packages/gsutil/boto/boto/s3/prefix.pyc +0 -0
  544. data/packages/gsutil/boto/boto/s3/resumable_download_handler.py +0 -339
  545. data/packages/gsutil/boto/boto/s3/resumable_download_handler.pyc +0 -0
  546. data/packages/gsutil/boto/boto/s3/tagging.py +0 -71
  547. data/packages/gsutil/boto/boto/s3/tagging.pyc +0 -0
  548. data/packages/gsutil/boto/boto/s3/user.py +0 -49
  549. data/packages/gsutil/boto/boto/s3/user.pyc +0 -0
  550. data/packages/gsutil/boto/boto/s3/website.py +0 -237
  551. data/packages/gsutil/boto/boto/s3/website.pyc +0 -0
  552. data/packages/gsutil/boto/boto/sdb/__init__.py +0 -67
  553. data/packages/gsutil/boto/boto/sdb/connection.py +0 -617
  554. data/packages/gsutil/boto/boto/sdb/db/__init__.py +0 -20
  555. data/packages/gsutil/boto/boto/sdb/db/blob.py +0 -75
  556. data/packages/gsutil/boto/boto/sdb/db/key.py +0 -59
  557. data/packages/gsutil/boto/boto/sdb/db/manager/__init__.py +0 -85
  558. data/packages/gsutil/boto/boto/sdb/db/manager/sdbmanager.py +0 -732
  559. data/packages/gsutil/boto/boto/sdb/db/manager/xmlmanager.py +0 -517
  560. data/packages/gsutil/boto/boto/sdb/db/model.py +0 -294
  561. data/packages/gsutil/boto/boto/sdb/db/property.py +0 -703
  562. data/packages/gsutil/boto/boto/sdb/db/query.py +0 -85
  563. data/packages/gsutil/boto/boto/sdb/db/sequence.py +0 -226
  564. data/packages/gsutil/boto/boto/sdb/db/test_db.py +0 -231
  565. data/packages/gsutil/boto/boto/sdb/domain.py +0 -377
  566. data/packages/gsutil/boto/boto/sdb/item.py +0 -181
  567. data/packages/gsutil/boto/boto/sdb/queryresultset.py +0 -92
  568. data/packages/gsutil/boto/boto/sdb/regioninfo.py +0 -32
  569. data/packages/gsutil/boto/boto/services/__init__.py +0 -23
  570. data/packages/gsutil/boto/boto/services/bs.py +0 -179
  571. data/packages/gsutil/boto/boto/services/message.py +0 -58
  572. data/packages/gsutil/boto/boto/services/result.py +0 -136
  573. data/packages/gsutil/boto/boto/services/service.py +0 -161
  574. data/packages/gsutil/boto/boto/services/servicedef.py +0 -91
  575. data/packages/gsutil/boto/boto/services/sonofmmm.cfg +0 -43
  576. data/packages/gsutil/boto/boto/services/sonofmmm.py +0 -81
  577. data/packages/gsutil/boto/boto/services/submit.py +0 -88
  578. data/packages/gsutil/boto/boto/ses/__init__.py +0 -54
  579. data/packages/gsutil/boto/boto/ses/connection.py +0 -521
  580. data/packages/gsutil/boto/boto/ses/exceptions.py +0 -77
  581. data/packages/gsutil/boto/boto/sns/__init__.py +0 -78
  582. data/packages/gsutil/boto/boto/sns/connection.py +0 -431
  583. data/packages/gsutil/boto/boto/sqs/__init__.py +0 -56
  584. data/packages/gsutil/boto/boto/sqs/attributes.py +0 -46
  585. data/packages/gsutil/boto/boto/sqs/batchresults.py +0 -95
  586. data/packages/gsutil/boto/boto/sqs/connection.py +0 -417
  587. data/packages/gsutil/boto/boto/sqs/jsonmessage.py +0 -43
  588. data/packages/gsutil/boto/boto/sqs/message.py +0 -253
  589. data/packages/gsutil/boto/boto/sqs/queue.py +0 -478
  590. data/packages/gsutil/boto/boto/sqs/regioninfo.py +0 -32
  591. data/packages/gsutil/boto/boto/storage_uri.py +0 -835
  592. data/packages/gsutil/boto/boto/storage_uri.pyc +0 -0
  593. data/packages/gsutil/boto/boto/sts/__init__.py +0 -55
  594. data/packages/gsutil/boto/boto/sts/connection.py +0 -207
  595. data/packages/gsutil/boto/boto/sts/credentials.py +0 -215
  596. data/packages/gsutil/boto/boto/swf/__init__.py +0 -60
  597. data/packages/gsutil/boto/boto/swf/exceptions.py +0 -44
  598. data/packages/gsutil/boto/boto/swf/layer1.py +0 -1512
  599. data/packages/gsutil/boto/boto/swf/layer1_decisions.py +0 -287
  600. data/packages/gsutil/boto/boto/swf/layer2.py +0 -342
  601. data/packages/gsutil/boto/boto/utils.py +0 -927
  602. data/packages/gsutil/boto/boto/utils.pyc +0 -0
  603. data/packages/gsutil/boto/boto/vpc/__init__.py +0 -910
  604. data/packages/gsutil/boto/boto/vpc/customergateway.py +0 -54
  605. data/packages/gsutil/boto/boto/vpc/dhcpoptions.py +0 -72
  606. data/packages/gsutil/boto/boto/vpc/internetgateway.py +0 -72
  607. data/packages/gsutil/boto/boto/vpc/routetable.py +0 -109
  608. data/packages/gsutil/boto/boto/vpc/subnet.py +0 -57
  609. data/packages/gsutil/boto/boto/vpc/vpc.py +0 -54
  610. data/packages/gsutil/boto/boto/vpc/vpnconnection.py +0 -60
  611. data/packages/gsutil/boto/boto/vpc/vpngateway.py +0 -83
  612. data/packages/gsutil/boto/docs/BotoCheatSheet.pdf +0 -0
  613. data/packages/gsutil/boto/docs/Makefile +0 -89
  614. data/packages/gsutil/boto/docs/make.bat +0 -113
  615. data/packages/gsutil/boto/docs/source/_templates/layout.html +0 -3
  616. data/packages/gsutil/boto/docs/source/autoscale_tut.rst +0 -220
  617. data/packages/gsutil/boto/docs/source/boto_config_tut.rst +0 -125
  618. data/packages/gsutil/boto/docs/source/boto_theme/static/boto.css_t +0 -239
  619. data/packages/gsutil/boto/docs/source/boto_theme/static/pygments.css +0 -61
  620. data/packages/gsutil/boto/docs/source/boto_theme/theme.conf +0 -3
  621. data/packages/gsutil/boto/docs/source/cloudfront_tut.rst +0 -196
  622. data/packages/gsutil/boto/docs/source/cloudsearch_tut.rst +0 -411
  623. data/packages/gsutil/boto/docs/source/cloudwatch_tut.rst +0 -116
  624. data/packages/gsutil/boto/docs/source/conf.py +0 -32
  625. data/packages/gsutil/boto/docs/source/contributing.rst +0 -204
  626. data/packages/gsutil/boto/docs/source/documentation.rst +0 -59
  627. data/packages/gsutil/boto/docs/source/dynamodb_tut.rst +0 -339
  628. data/packages/gsutil/boto/docs/source/ec2_tut.rst +0 -86
  629. data/packages/gsutil/boto/docs/source/elb_tut.rst +0 -257
  630. data/packages/gsutil/boto/docs/source/emr_tut.rst +0 -108
  631. data/packages/gsutil/boto/docs/source/index.rst +0 -146
  632. data/packages/gsutil/boto/docs/source/rds_tut.rst +0 -108
  633. data/packages/gsutil/boto/docs/source/ref/autoscale.rst +0 -62
  634. data/packages/gsutil/boto/docs/source/ref/beanstalk.rst +0 -26
  635. data/packages/gsutil/boto/docs/source/ref/boto.rst +0 -47
  636. data/packages/gsutil/boto/docs/source/ref/cloudformation.rst +0 -34
  637. data/packages/gsutil/boto/docs/source/ref/cloudfront.rst +0 -68
  638. data/packages/gsutil/boto/docs/source/ref/cloudsearch.rst +0 -59
  639. data/packages/gsutil/boto/docs/source/ref/cloudwatch.rst +0 -27
  640. data/packages/gsutil/boto/docs/source/ref/contrib.rst +0 -32
  641. data/packages/gsutil/boto/docs/source/ref/datapipeline.rst +0 -26
  642. data/packages/gsutil/boto/docs/source/ref/dynamodb.rst +0 -61
  643. data/packages/gsutil/boto/docs/source/ref/ec2.rst +0 -140
  644. data/packages/gsutil/boto/docs/source/ref/ecs.rst +0 -19
  645. data/packages/gsutil/boto/docs/source/ref/elasticache.rst +0 -19
  646. data/packages/gsutil/boto/docs/source/ref/elastictranscoder.rst +0 -26
  647. data/packages/gsutil/boto/docs/source/ref/elb.rst +0 -47
  648. data/packages/gsutil/boto/docs/source/ref/emr.rst +0 -34
  649. data/packages/gsutil/boto/docs/source/ref/file.rst +0 -34
  650. data/packages/gsutil/boto/docs/source/ref/fps.rst +0 -19
  651. data/packages/gsutil/boto/docs/source/ref/glacier.rst +0 -63
  652. data/packages/gsutil/boto/docs/source/ref/gs.rst +0 -72
  653. data/packages/gsutil/boto/docs/source/ref/iam.rst +0 -27
  654. data/packages/gsutil/boto/docs/source/ref/index.rst +0 -40
  655. data/packages/gsutil/boto/docs/source/ref/manage.rst +0 -47
  656. data/packages/gsutil/boto/docs/source/ref/mturk.rst +0 -54
  657. data/packages/gsutil/boto/docs/source/ref/mws.rst +0 -33
  658. data/packages/gsutil/boto/docs/source/ref/pyami.rst +0 -103
  659. data/packages/gsutil/boto/docs/source/ref/rds.rst +0 -47
  660. data/packages/gsutil/boto/docs/source/ref/route53.rst +0 -34
  661. data/packages/gsutil/boto/docs/source/ref/s3.rst +0 -111
  662. data/packages/gsutil/boto/docs/source/ref/sdb.rst +0 -45
  663. data/packages/gsutil/boto/docs/source/ref/sdb_db.rst +0 -83
  664. data/packages/gsutil/boto/docs/source/ref/services.rst +0 -61
  665. data/packages/gsutil/boto/docs/source/ref/ses.rst +0 -21
  666. data/packages/gsutil/boto/docs/source/ref/sns.rst +0 -17
  667. data/packages/gsutil/boto/docs/source/ref/sqs.rst +0 -61
  668. data/packages/gsutil/boto/docs/source/ref/sts.rst +0 -25
  669. data/packages/gsutil/boto/docs/source/ref/swf.rst +0 -22
  670. data/packages/gsutil/boto/docs/source/ref/vpc.rst +0 -54
  671. data/packages/gsutil/boto/docs/source/s3_tut.rst +0 -450
  672. data/packages/gsutil/boto/docs/source/security_groups.rst +0 -82
  673. data/packages/gsutil/boto/docs/source/ses_tut.rst +0 -171
  674. data/packages/gsutil/boto/docs/source/simpledb_tut.rst +0 -188
  675. data/packages/gsutil/boto/docs/source/sqs_tut.rst +0 -246
  676. data/packages/gsutil/boto/docs/source/vpc_tut.rst +0 -100
  677. data/packages/gsutil/boto/pylintrc +0 -305
  678. data/packages/gsutil/boto/requirements.txt +0 -10
  679. data/packages/gsutil/boto/setup.py +0 -89
  680. data/packages/gsutil/boto/tests/__init__.py +0 -20
  681. data/packages/gsutil/boto/tests/db/test_lists.py +0 -96
  682. data/packages/gsutil/boto/tests/db/test_password.py +0 -128
  683. data/packages/gsutil/boto/tests/db/test_query.py +0 -152
  684. data/packages/gsutil/boto/tests/db/test_sequence.py +0 -109
  685. data/packages/gsutil/boto/tests/devpay/__init__.py +0 -0
  686. data/packages/gsutil/boto/tests/devpay/test_s3.py +0 -181
  687. data/packages/gsutil/boto/tests/fps/__init__.py +0 -0
  688. data/packages/gsutil/boto/tests/fps/test.py +0 -100
  689. data/packages/gsutil/boto/tests/fps/test_verify_signature.py +0 -12
  690. data/packages/gsutil/boto/tests/integration/__init__.py +0 -0
  691. data/packages/gsutil/boto/tests/integration/beanstalk/test_wrapper.py +0 -209
  692. data/packages/gsutil/boto/tests/integration/cloudformation/__init__.py +0 -21
  693. data/packages/gsutil/boto/tests/integration/cloudformation/test_cert_verification.py +0 -40
  694. data/packages/gsutil/boto/tests/integration/cloudformation/test_connection.py +0 -110
  695. data/packages/gsutil/boto/tests/integration/cloudsearch/__init__.py +0 -21
  696. data/packages/gsutil/boto/tests/integration/cloudsearch/test_cert_verification.py +0 -40
  697. data/packages/gsutil/boto/tests/integration/datapipeline/test_layer1.py +0 -122
  698. data/packages/gsutil/boto/tests/integration/dynamodb/__init__.py +0 -20
  699. data/packages/gsutil/boto/tests/integration/dynamodb/test_cert_verification.py +0 -40
  700. data/packages/gsutil/boto/tests/integration/dynamodb/test_layer1.py +0 -266
  701. data/packages/gsutil/boto/tests/integration/dynamodb/test_layer2.py +0 -484
  702. data/packages/gsutil/boto/tests/integration/dynamodb/test_table.py +0 -84
  703. data/packages/gsutil/boto/tests/integration/ec2/__init__.py +0 -20
  704. data/packages/gsutil/boto/tests/integration/ec2/autoscale/__init__.py +0 -21
  705. data/packages/gsutil/boto/tests/integration/ec2/autoscale/test_cert_verification.py +0 -40
  706. data/packages/gsutil/boto/tests/integration/ec2/autoscale/test_connection.py +0 -167
  707. data/packages/gsutil/boto/tests/integration/ec2/cloudwatch/__init__.py +0 -20
  708. data/packages/gsutil/boto/tests/integration/ec2/cloudwatch/test_cert_verification.py +0 -40
  709. data/packages/gsutil/boto/tests/integration/ec2/cloudwatch/test_connection.py +0 -277
  710. data/packages/gsutil/boto/tests/integration/ec2/elb/__init__.py +0 -20
  711. data/packages/gsutil/boto/tests/integration/ec2/elb/test_cert_verification.py +0 -40
  712. data/packages/gsutil/boto/tests/integration/ec2/elb/test_connection.py +0 -130
  713. data/packages/gsutil/boto/tests/integration/ec2/test_cert_verification.py +0 -40
  714. data/packages/gsutil/boto/tests/integration/ec2/test_connection.py +0 -192
  715. data/packages/gsutil/boto/tests/integration/ec2/vpc/__init__.py +0 -0
  716. data/packages/gsutil/boto/tests/integration/ec2/vpc/test_connection.py +0 -95
  717. data/packages/gsutil/boto/tests/integration/elasticache/__init__.py +0 -0
  718. data/packages/gsutil/boto/tests/integration/elasticache/test_layer1.py +0 -67
  719. data/packages/gsutil/boto/tests/integration/elastictranscoder/__init__.py +0 -0
  720. data/packages/gsutil/boto/tests/integration/elastictranscoder/test_cert_verification.py +0 -35
  721. data/packages/gsutil/boto/tests/integration/elastictranscoder/test_layer1.py +0 -115
  722. data/packages/gsutil/boto/tests/integration/emr/__init__.py +0 -20
  723. data/packages/gsutil/boto/tests/integration/emr/test_cert_verification.py +0 -40
  724. data/packages/gsutil/boto/tests/integration/glacier/__init__.py +0 -22
  725. data/packages/gsutil/boto/tests/integration/glacier/test_cert_verification.py +0 -40
  726. data/packages/gsutil/boto/tests/integration/glacier/test_layer1.py +0 -44
  727. data/packages/gsutil/boto/tests/integration/glacier/test_layer2.py +0 -45
  728. data/packages/gsutil/boto/tests/integration/gs/__init__.py +0 -0
  729. data/packages/gsutil/boto/tests/integration/gs/cb_test_harness.py +0 -71
  730. data/packages/gsutil/boto/tests/integration/gs/test_basic.py +0 -379
  731. data/packages/gsutil/boto/tests/integration/gs/test_generation_conditionals.py +0 -399
  732. data/packages/gsutil/boto/tests/integration/gs/test_resumable_downloads.py +0 -358
  733. data/packages/gsutil/boto/tests/integration/gs/test_resumable_uploads.py +0 -525
  734. data/packages/gsutil/boto/tests/integration/gs/test_storage_uri.py +0 -125
  735. data/packages/gsutil/boto/tests/integration/gs/test_versioning.py +0 -268
  736. data/packages/gsutil/boto/tests/integration/gs/testcase.py +0 -116
  737. data/packages/gsutil/boto/tests/integration/gs/util.py +0 -63
  738. data/packages/gsutil/boto/tests/integration/iam/__init__.py +0 -20
  739. data/packages/gsutil/boto/tests/integration/iam/test_cert_verification.py +0 -40
  740. data/packages/gsutil/boto/tests/integration/mws/__init__.py +0 -0
  741. data/packages/gsutil/boto/tests/integration/mws/test.py +0 -100
  742. data/packages/gsutil/boto/tests/integration/rds/__init__.py +0 -21
  743. data/packages/gsutil/boto/tests/integration/rds/test_cert_verification.py +0 -40
  744. data/packages/gsutil/boto/tests/integration/route53/__init__.py +0 -20
  745. data/packages/gsutil/boto/tests/integration/route53/test_cert_verification.py +0 -40
  746. data/packages/gsutil/boto/tests/integration/route53/test_zone.py +0 -132
  747. data/packages/gsutil/boto/tests/integration/s3/__init__.py +0 -20
  748. data/packages/gsutil/boto/tests/integration/s3/mock_storage_service.py +0 -589
  749. data/packages/gsutil/boto/tests/integration/s3/other_cacerts.txt +0 -70
  750. data/packages/gsutil/boto/tests/integration/s3/test_bucket.py +0 -263
  751. data/packages/gsutil/boto/tests/integration/s3/test_cert_verification.py +0 -40
  752. data/packages/gsutil/boto/tests/integration/s3/test_connection.py +0 -245
  753. data/packages/gsutil/boto/tests/integration/s3/test_cors.py +0 -78
  754. data/packages/gsutil/boto/tests/integration/s3/test_encryption.py +0 -115
  755. data/packages/gsutil/boto/tests/integration/s3/test_https_cert_validation.py +0 -141
  756. data/packages/gsutil/boto/tests/integration/s3/test_key.py +0 -375
  757. data/packages/gsutil/boto/tests/integration/s3/test_mfa.py +0 -95
  758. data/packages/gsutil/boto/tests/integration/s3/test_multidelete.py +0 -181
  759. data/packages/gsutil/boto/tests/integration/s3/test_multipart.py +0 -139
  760. data/packages/gsutil/boto/tests/integration/s3/test_pool.py +0 -246
  761. data/packages/gsutil/boto/tests/integration/s3/test_versioning.py +0 -158
  762. data/packages/gsutil/boto/tests/integration/sdb/__init__.py +0 -20
  763. data/packages/gsutil/boto/tests/integration/sdb/test_cert_verification.py +0 -40
  764. data/packages/gsutil/boto/tests/integration/sdb/test_connection.py +0 -119
  765. data/packages/gsutil/boto/tests/integration/ses/__init__.py +0 -0
  766. data/packages/gsutil/boto/tests/integration/ses/test_cert_verification.py +0 -40
  767. data/packages/gsutil/boto/tests/integration/ses/test_connection.py +0 -38
  768. data/packages/gsutil/boto/tests/integration/sns/__init__.py +0 -20
  769. data/packages/gsutil/boto/tests/integration/sns/test_cert_verification.py +0 -40
  770. data/packages/gsutil/boto/tests/integration/sqs/__init__.py +0 -20
  771. data/packages/gsutil/boto/tests/integration/sqs/test_cert_verification.py +0 -40
  772. data/packages/gsutil/boto/tests/integration/sqs/test_connection.py +0 -217
  773. data/packages/gsutil/boto/tests/integration/sts/__init__.py +0 -20
  774. data/packages/gsutil/boto/tests/integration/sts/test_cert_verification.py +0 -40
  775. data/packages/gsutil/boto/tests/integration/sts/test_session_token.py +0 -65
  776. data/packages/gsutil/boto/tests/integration/swf/__init__.py +0 -0
  777. data/packages/gsutil/boto/tests/integration/swf/test_cert_verification.py +0 -40
  778. data/packages/gsutil/boto/tests/integration/swf/test_layer1.py +0 -246
  779. data/packages/gsutil/boto/tests/integration/swf/test_layer1_workflow_execution.py +0 -173
  780. data/packages/gsutil/boto/tests/mturk/__init__.py +0 -0
  781. data/packages/gsutil/boto/tests/mturk/_init_environment.py +0 -28
  782. data/packages/gsutil/boto/tests/mturk/all_tests.py +0 -24
  783. data/packages/gsutil/boto/tests/mturk/cleanup_tests.py +0 -47
  784. data/packages/gsutil/boto/tests/mturk/common.py +0 -45
  785. data/packages/gsutil/boto/tests/mturk/create_free_text_question_regex.doctest +0 -100
  786. data/packages/gsutil/boto/tests/mturk/create_hit.doctest +0 -92
  787. data/packages/gsutil/boto/tests/mturk/create_hit_binary.doctest +0 -94
  788. data/packages/gsutil/boto/tests/mturk/create_hit_external.py +0 -21
  789. data/packages/gsutil/boto/tests/mturk/create_hit_from_hit_type.doctest +0 -103
  790. data/packages/gsutil/boto/tests/mturk/create_hit_test.py +0 -21
  791. data/packages/gsutil/boto/tests/mturk/create_hit_with_qualifications.py +0 -16
  792. data/packages/gsutil/boto/tests/mturk/hit_persistence.py +0 -27
  793. data/packages/gsutil/boto/tests/mturk/mocks.py +0 -11
  794. data/packages/gsutil/boto/tests/mturk/reviewable_hits.doctest +0 -129
  795. data/packages/gsutil/boto/tests/mturk/run-doctest.py +0 -13
  796. data/packages/gsutil/boto/tests/mturk/search_hits.doctest +0 -16
  797. data/packages/gsutil/boto/tests/mturk/selenium_support.py +0 -61
  798. data/packages/gsutil/boto/tests/mturk/support.py +0 -7
  799. data/packages/gsutil/boto/tests/mturk/test_disable_hit.py +0 -11
  800. data/packages/gsutil/boto/tests/test.py +0 -59
  801. data/packages/gsutil/boto/tests/unit/__init__.py +0 -79
  802. data/packages/gsutil/boto/tests/unit/auth/__init__.py +0 -0
  803. data/packages/gsutil/boto/tests/unit/auth/test_sigv4.py +0 -73
  804. data/packages/gsutil/boto/tests/unit/beanstalk/__init__.py +0 -0
  805. data/packages/gsutil/boto/tests/unit/beanstalk/test_layer1.py +0 -128
  806. data/packages/gsutil/boto/tests/unit/cloudformation/__init__.py +0 -0
  807. data/packages/gsutil/boto/tests/unit/cloudformation/test_connection.py +0 -605
  808. data/packages/gsutil/boto/tests/unit/cloudformation/test_stack.py +0 -63
  809. data/packages/gsutil/boto/tests/unit/cloudfront/__init__.py +0 -0
  810. data/packages/gsutil/boto/tests/unit/cloudfront/test_invalidation_list.py +0 -113
  811. data/packages/gsutil/boto/tests/unit/cloudfront/test_signed_urls.py +0 -354
  812. data/packages/gsutil/boto/tests/unit/cloudsearch/__init__.py +0 -1
  813. data/packages/gsutil/boto/tests/unit/cloudsearch/test_connection.py +0 -241
  814. data/packages/gsutil/boto/tests/unit/cloudsearch/test_document.py +0 -324
  815. data/packages/gsutil/boto/tests/unit/cloudsearch/test_search.py +0 -325
  816. data/packages/gsutil/boto/tests/unit/dynamodb/__init__.py +0 -0
  817. data/packages/gsutil/boto/tests/unit/dynamodb/test_batch.py +0 -103
  818. data/packages/gsutil/boto/tests/unit/dynamodb/test_layer2.py +0 -119
  819. data/packages/gsutil/boto/tests/unit/dynamodb/test_types.py +0 -82
  820. data/packages/gsutil/boto/tests/unit/ec2/__init__.py +0 -0
  821. data/packages/gsutil/boto/tests/unit/ec2/autoscale/__init__.py +0 -0
  822. data/packages/gsutil/boto/tests/unit/ec2/autoscale/test_group.py +0 -162
  823. data/packages/gsutil/boto/tests/unit/ec2/test_address.py +0 -39
  824. data/packages/gsutil/boto/tests/unit/ec2/test_blockdevicemapping.py +0 -79
  825. data/packages/gsutil/boto/tests/unit/ec2/test_connection.py +0 -480
  826. data/packages/gsutil/boto/tests/unit/ec2/test_instance.py +0 -243
  827. data/packages/gsutil/boto/tests/unit/ec2/test_networkinterface.py +0 -140
  828. data/packages/gsutil/boto/tests/unit/ec2/test_volume.py +0 -248
  829. data/packages/gsutil/boto/tests/unit/emr/test_emr_responses.py +0 -373
  830. data/packages/gsutil/boto/tests/unit/glacier/__init__.py +0 -0
  831. data/packages/gsutil/boto/tests/unit/glacier/test_concurrent.py +0 -120
  832. data/packages/gsutil/boto/tests/unit/glacier/test_job.py +0 -60
  833. data/packages/gsutil/boto/tests/unit/glacier/test_layer1.py +0 -98
  834. data/packages/gsutil/boto/tests/unit/glacier/test_layer2.py +0 -266
  835. data/packages/gsutil/boto/tests/unit/glacier/test_utils.py +0 -116
  836. data/packages/gsutil/boto/tests/unit/glacier/test_vault.py +0 -100
  837. data/packages/gsutil/boto/tests/unit/glacier/test_writer.py +0 -185
  838. data/packages/gsutil/boto/tests/unit/provider/__init__.py +0 -0
  839. data/packages/gsutil/boto/tests/unit/provider/test_provider.py +0 -176
  840. data/packages/gsutil/boto/tests/unit/rds/__init__.py +0 -0
  841. data/packages/gsutil/boto/tests/unit/rds/test_connection.py +0 -131
  842. data/packages/gsutil/boto/tests/unit/s3/__init__.py +0 -0
  843. data/packages/gsutil/boto/tests/unit/s3/test_cors_configuration.py +0 -77
  844. data/packages/gsutil/boto/tests/unit/s3/test_key.py +0 -75
  845. data/packages/gsutil/boto/tests/unit/s3/test_keyfile.py +0 -101
  846. data/packages/gsutil/boto/tests/unit/s3/test_lifecycle.py +0 -97
  847. data/packages/gsutil/boto/tests/unit/s3/test_tagging.py +0 -47
  848. data/packages/gsutil/boto/tests/unit/s3/test_uri.py +0 -257
  849. data/packages/gsutil/boto/tests/unit/s3/test_website.py +0 -188
  850. data/packages/gsutil/boto/tests/unit/sns/__init__.py +0 -0
  851. data/packages/gsutil/boto/tests/unit/sns/test_connection.py +0 -99
  852. data/packages/gsutil/boto/tests/unit/sqs/__init__.py +0 -0
  853. data/packages/gsutil/boto/tests/unit/sqs/test_connection.py +0 -98
  854. data/packages/gsutil/boto/tests/unit/sqs/test_queue.py +0 -40
  855. data/packages/gsutil/boto/tests/unit/sts/test_connection.py +0 -74
  856. data/packages/gsutil/boto/tests/unit/test_connection.py +0 -60
  857. data/packages/gsutil/boto/tests/unit/utils/test_utils.py +0 -109
  858. data/packages/gsutil/boto/tox.ini +0 -8
  859. data/packages/gsutil/gslib/README +0 -5
  860. data/packages/gsutil/gslib/__init__.py +0 -22
  861. data/packages/gsutil/gslib/__init__.pyc +0 -0
  862. data/packages/gsutil/gslib/addlhelp/acls.py +0 -234
  863. data/packages/gsutil/gslib/addlhelp/anon.py +0 -57
  864. data/packages/gsutil/gslib/addlhelp/command_opts.py +0 -116
  865. data/packages/gsutil/gslib/addlhelp/dev.py +0 -139
  866. data/packages/gsutil/gslib/addlhelp/metadata.py +0 -186
  867. data/packages/gsutil/gslib/addlhelp/naming.py +0 -173
  868. data/packages/gsutil/gslib/addlhelp/prod.py +0 -160
  869. data/packages/gsutil/gslib/addlhelp/projects.py +0 -130
  870. data/packages/gsutil/gslib/addlhelp/subdirs.py +0 -110
  871. data/packages/gsutil/gslib/addlhelp/support.py +0 -86
  872. data/packages/gsutil/gslib/addlhelp/versioning.py +0 -242
  873. data/packages/gsutil/gslib/addlhelp/wildcards.py +0 -170
  874. data/packages/gsutil/gslib/bucket_listing_ref.py +0 -175
  875. data/packages/gsutil/gslib/bucket_listing_ref.pyc +0 -0
  876. data/packages/gsutil/gslib/command.py +0 -722
  877. data/packages/gsutil/gslib/command.pyc +0 -0
  878. data/packages/gsutil/gslib/command_runner.py +0 -101
  879. data/packages/gsutil/gslib/command_runner.pyc +0 -0
  880. data/packages/gsutil/gslib/commands/__init__.pyc +0 -0
  881. data/packages/gsutil/gslib/commands/cat.py +0 -131
  882. data/packages/gsutil/gslib/commands/cat.pyc +0 -0
  883. data/packages/gsutil/gslib/commands/chacl.py +0 -532
  884. data/packages/gsutil/gslib/commands/chacl.pyc +0 -0
  885. data/packages/gsutil/gslib/commands/config.py +0 -694
  886. data/packages/gsutil/gslib/commands/config.pyc +0 -0
  887. data/packages/gsutil/gslib/commands/cp.py +0 -1818
  888. data/packages/gsutil/gslib/commands/cp.pyc +0 -0
  889. data/packages/gsutil/gslib/commands/disablelogging.py +0 -101
  890. data/packages/gsutil/gslib/commands/disablelogging.pyc +0 -0
  891. data/packages/gsutil/gslib/commands/enablelogging.py +0 -149
  892. data/packages/gsutil/gslib/commands/enablelogging.pyc +0 -0
  893. data/packages/gsutil/gslib/commands/getacl.py +0 -82
  894. data/packages/gsutil/gslib/commands/getacl.pyc +0 -0
  895. data/packages/gsutil/gslib/commands/getcors.py +0 -121
  896. data/packages/gsutil/gslib/commands/getcors.pyc +0 -0
  897. data/packages/gsutil/gslib/commands/getdefacl.py +0 -86
  898. data/packages/gsutil/gslib/commands/getdefacl.pyc +0 -0
  899. data/packages/gsutil/gslib/commands/getlogging.py +0 -137
  900. data/packages/gsutil/gslib/commands/getlogging.pyc +0 -0
  901. data/packages/gsutil/gslib/commands/getversioning.py +0 -116
  902. data/packages/gsutil/gslib/commands/getversioning.pyc +0 -0
  903. data/packages/gsutil/gslib/commands/getwebcfg.py +0 -122
  904. data/packages/gsutil/gslib/commands/getwebcfg.pyc +0 -0
  905. data/packages/gsutil/gslib/commands/help.py +0 -218
  906. data/packages/gsutil/gslib/commands/help.pyc +0 -0
  907. data/packages/gsutil/gslib/commands/ls.py +0 -578
  908. data/packages/gsutil/gslib/commands/ls.pyc +0 -0
  909. data/packages/gsutil/gslib/commands/mb.py +0 -172
  910. data/packages/gsutil/gslib/commands/mb.pyc +0 -0
  911. data/packages/gsutil/gslib/commands/mv.py +0 -159
  912. data/packages/gsutil/gslib/commands/mv.pyc +0 -0
  913. data/packages/gsutil/gslib/commands/perfdiag.py +0 -903
  914. data/packages/gsutil/gslib/commands/perfdiag.pyc +0 -0
  915. data/packages/gsutil/gslib/commands/rb.py +0 -113
  916. data/packages/gsutil/gslib/commands/rb.pyc +0 -0
  917. data/packages/gsutil/gslib/commands/rm.py +0 -239
  918. data/packages/gsutil/gslib/commands/rm.pyc +0 -0
  919. data/packages/gsutil/gslib/commands/setacl.py +0 -138
  920. data/packages/gsutil/gslib/commands/setacl.pyc +0 -0
  921. data/packages/gsutil/gslib/commands/setcors.py +0 -145
  922. data/packages/gsutil/gslib/commands/setcors.pyc +0 -0
  923. data/packages/gsutil/gslib/commands/setdefacl.py +0 -105
  924. data/packages/gsutil/gslib/commands/setdefacl.pyc +0 -0
  925. data/packages/gsutil/gslib/commands/setmeta.py +0 -428
  926. data/packages/gsutil/gslib/commands/setmeta.pyc +0 -0
  927. data/packages/gsutil/gslib/commands/setversioning.py +0 -114
  928. data/packages/gsutil/gslib/commands/setversioning.pyc +0 -0
  929. data/packages/gsutil/gslib/commands/setwebcfg.py +0 -190
  930. data/packages/gsutil/gslib/commands/setwebcfg.pyc +0 -0
  931. data/packages/gsutil/gslib/commands/test.py +0 -228
  932. data/packages/gsutil/gslib/commands/test.pyc +0 -0
  933. data/packages/gsutil/gslib/commands/update.py +0 -305
  934. data/packages/gsutil/gslib/commands/update.pyc +0 -0
  935. data/packages/gsutil/gslib/commands/version.py +0 -150
  936. data/packages/gsutil/gslib/commands/version.pyc +0 -0
  937. data/packages/gsutil/gslib/exception.py +0 -76
  938. data/packages/gsutil/gslib/exception.pyc +0 -0
  939. data/packages/gsutil/gslib/help_provider.py +0 -81
  940. data/packages/gsutil/gslib/help_provider.pyc +0 -0
  941. data/packages/gsutil/gslib/name_expansion.py +0 -550
  942. data/packages/gsutil/gslib/name_expansion.pyc +0 -0
  943. data/packages/gsutil/gslib/plurality_checkable_iterator.py +0 -56
  944. data/packages/gsutil/gslib/plurality_checkable_iterator.pyc +0 -0
  945. data/packages/gsutil/gslib/project_id.py +0 -67
  946. data/packages/gsutil/gslib/project_id.pyc +0 -0
  947. data/packages/gsutil/gslib/storage_uri_builder.py +0 -56
  948. data/packages/gsutil/gslib/storage_uri_builder.pyc +0 -0
  949. data/packages/gsutil/gslib/tests/__init__.pyc +0 -0
  950. data/packages/gsutil/gslib/tests/test_chacl.py +0 -236
  951. data/packages/gsutil/gslib/tests/test_cp.py +0 -267
  952. data/packages/gsutil/gslib/tests/test_data/test.gif +0 -0
  953. data/packages/gsutil/gslib/tests/test_data/test.mp3 +0 -0
  954. data/packages/gsutil/gslib/tests/test_ls.py +0 -66
  955. data/packages/gsutil/gslib/tests/test_mv.py +0 -69
  956. data/packages/gsutil/gslib/tests/test_naming.py +0 -989
  957. data/packages/gsutil/gslib/tests/test_perfdiag.py +0 -41
  958. data/packages/gsutil/gslib/tests/test_plurality_checkable_iterator.py +0 -67
  959. data/packages/gsutil/gslib/tests/test_rm.py +0 -143
  960. data/packages/gsutil/gslib/tests/test_setacl.py +0 -152
  961. data/packages/gsutil/gslib/tests/test_setcors.py +0 -168
  962. data/packages/gsutil/gslib/tests/test_setmeta.py +0 -91
  963. data/packages/gsutil/gslib/tests/test_setversioning.py +0 -44
  964. data/packages/gsutil/gslib/tests/test_setwebcfg.py +0 -63
  965. data/packages/gsutil/gslib/tests/test_thread_pool.py +0 -92
  966. data/packages/gsutil/gslib/tests/test_wildcard_iterator.py +0 -364
  967. data/packages/gsutil/gslib/tests/testcase/base.py +0 -89
  968. data/packages/gsutil/gslib/tests/testcase/integration_testcase.py +0 -197
  969. data/packages/gsutil/gslib/tests/testcase/unit_testcase.py +0 -230
  970. data/packages/gsutil/gslib/tests/util.py +0 -125
  971. data/packages/gsutil/gslib/tests/util.pyc +0 -0
  972. data/packages/gsutil/gslib/thread_pool.py +0 -79
  973. data/packages/gsutil/gslib/thread_pool.pyc +0 -0
  974. data/packages/gsutil/gslib/util.py +0 -151
  975. data/packages/gsutil/gslib/util.pyc +0 -0
  976. data/packages/gsutil/gslib/wildcard_iterator.py +0 -492
  977. data/packages/gsutil/gslib/wildcard_iterator.pyc +0 -0
  978. data/packages/gsutil/gsutil +0 -377
  979. data/packages/gsutil/gsutil.spec.in +0 -75
  980. data/packages/gsutil/oauth2_plugin/__init__.py +0 -22
  981. data/packages/gsutil/oauth2_plugin/__init__.pyc +0 -0
  982. data/packages/gsutil/oauth2_plugin/oauth2_client.py +0 -642
  983. data/packages/gsutil/oauth2_plugin/oauth2_client.pyc +0 -0
  984. data/packages/gsutil/oauth2_plugin/oauth2_client_test.py +0 -374
  985. data/packages/gsutil/oauth2_plugin/oauth2_helper.py +0 -110
  986. data/packages/gsutil/oauth2_plugin/oauth2_helper.pyc +0 -0
  987. data/packages/gsutil/oauth2_plugin/oauth2_plugin.py +0 -24
  988. data/packages/gsutil/oauth2_plugin/oauth2_plugin.pyc +0 -0
  989. data/packages/gsutil/pkg_gen.sh +0 -54
  990. data/packages/gsutil/pkg_util.py +0 -60
  991. data/packages/gsutil/setup.py +0 -141
  992. data/packages/gsutil/third_party/__init__.py +0 -0
  993. data/packages/gsutil/third_party/__init__.pyc +0 -0
  994. data/packages/gsutil/third_party/fancy_urllib/README +0 -21
  995. data/packages/gsutil/third_party/fancy_urllib/__init__.py +0 -398
  996. data/packages/gsutil/third_party/fancy_urllib/__init__.pyc +0 -0
  997. data/tasks/rubygem.rake +0 -31
  998. metadata.gz.sig +0 -0
@@ -1,111 +0,0 @@
1
- #!/usr/bin/python
2
- #
3
- # Copyright 2012 Google Inc. All Rights Reserved.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- """Unit tests for the compute commands."""
18
-
19
-
20
-
21
- import path_initializer
22
- path_initializer.InitializeSysPath()
23
-
24
- import copy
25
- import re
26
- import tempfile
27
-
28
-
29
- import gflags as flags
30
- import unittest
31
-
32
- from gcutil import auth_helper
33
- from gcutil import basic_cmds
34
- from gcutil import command_base
35
- from gcutil import flags_cache
36
- from gcutil import mock_api
37
-
38
- FLAGS = flags.FLAGS
39
-
40
-
41
- class ComputeCmdsTest(unittest.TestCase):
42
- def testAuthDoesNotBuildApi(self):
43
- class MockFlagsCache(object):
44
- """Mock FlagsCache for testing."""
45
-
46
- def SynchronizeFlags(self):
47
- """Mock SynchronizeFlags method that does nothing."""
48
- pass
49
-
50
- class MockCredential(object):
51
- """Mock OAuth2 Credential."""
52
-
53
- def authorize(self, http):
54
- """Authorize an http2.Http instance with this credential.
55
-
56
- Args:
57
- http: httplib2.http to append authorization to.
58
-
59
- Returns:
60
- An httplib2.http compatible object.
61
- """
62
- return http
63
-
64
- def MockGetCredentialFromStore(scopes,
65
- ask_user,
66
- force_reauth):
67
- """Returns a mock cred.
68
-
69
- Args:
70
- scopes: Scopes for which auth is being requested.
71
- ask_user: Should the user be asked to auth?
72
- force_reauth: Force user to reauth.
73
-
74
- Returns:
75
- A credentials object.
76
- """
77
- force_reauth = force_reauth # silence lint
78
- ask_user = ask_user
79
- scopes = scopes
80
- return MockCredential()
81
-
82
- flag_values = copy.deepcopy(FLAGS)
83
- flags_cache.FlagsCache = MockFlagsCache
84
- auth_helper.GetCredentialFromStore = MockGetCredentialFromStore
85
-
86
- command = basic_cmds.AuthCommand('auth', flag_values)
87
-
88
- flag_values.fetch_discovery = False
89
- flag_values.api_host = None
90
- flag_values.service_version = None
91
- flag_values.project = None
92
- flag_values.force_reauth = True
93
- flag_values.confirm_email = False
94
-
95
- command.SetFlags(flag_values)
96
- result = command.RunWithFlagsAndPositionalArgs(flag_values,
97
- ['path/to/gcutil'])
98
- self.assertEqual(result, (None, []))
99
-
100
- def testGetVersionGeneratesCorrectResponse(self):
101
- flag_values = copy.deepcopy(FLAGS)
102
- command = basic_cmds.GetVersion('version', flag_values)
103
- result = command.Run([])
104
-
105
- self.assertEqual(result, 0)
106
- self.assertEqual(
107
- basic_cmds.version.__version__, '1.7.1')
108
-
109
-
110
- if __name__ == '__main__':
111
- unittest.main()
@@ -1,1808 +0,0 @@
1
- # Copyright 2012 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- """Base command types for interacting with Google Compute Engine."""
16
-
17
-
18
-
19
- import datetime
20
- import httplib
21
- import inspect
22
- import json
23
- import os
24
- import re
25
- import sys
26
- import time
27
- import traceback
28
-
29
-
30
- from apiclient import discovery
31
- from apiclient import errors
32
- from apiclient import model
33
- import httplib2
34
- import iso8601
35
- import oauth2client.client as oauth2_client
36
-
37
-
38
- from google.apputils import app
39
- from google.apputils import appcommands
40
- import gflags as flags
41
-
42
- from gcutil import auth_helper
43
- from gcutil import flags_cache
44
- from gcutil import gcutil_logging
45
- from gcutil import metadata_lib
46
- from gcutil import scopes
47
- from gcutil import thread_pool
48
- from gcutil import utils
49
- from gcutil import version
50
- from gcutil import table_formatter
51
-
52
- FLAGS = flags.FLAGS
53
- LOGGER = gcutil_logging.LOGGER
54
- CLIENT_ID = 'google-api-client-python-compute-cmdline/1.0'
55
-
56
- CURRENT_VERSION = version.__default_api_version__
57
- SUPPORTED_VERSIONS = version.__supported_api_versions__
58
-
59
- GLOBAL_ZONE_NAME = 'global'
60
-
61
- # The ordering to impose on machine types when prompting the user for
62
- # a machine type choice.
63
- MACHINE_TYPE_ORDERING = ['standard', 'highcpu', 'highmem']
64
-
65
-
66
- flags.DEFINE_enum(
67
- 'service_version',
68
- CURRENT_VERSION,
69
- SUPPORTED_VERSIONS,
70
- 'Google computation service version.')
71
- flags.DEFINE_string(
72
- 'api_host',
73
- 'https://www.googleapis.com/',
74
- 'API host name')
75
- flags.DEFINE_string(
76
- 'project',
77
- None,
78
- 'The name of the Google Compute Engine project.')
79
- flags.DEFINE_string(
80
- 'project_id',
81
- None,
82
- 'The name of the Google Compute Engine project. '
83
- 'Deprecated, use --project instead.')
84
- flags.DEFINE_bool(
85
- 'print_json',
86
- False,
87
- 'Output JSON instead of tabular format. Deprecated, use --format=json.')
88
- flags.DEFINE_enum(
89
- 'format', 'table',
90
- ('table', 'sparse', 'json', 'csv', 'names'),
91
- 'Format for command output. Options include:'
92
- '\n table: formatted table output'
93
- '\n sparse: simpler table output'
94
- '\n json: raw json output (formerly --print_json)'
95
- '\n csv: csv format with header'
96
- '\n names: list of resource names only, no header')
97
- flags.DEFINE_enum(
98
- 'long_values_display_format',
99
- 'elided',
100
- ['elided', 'full'],
101
- 'The display preference for long table values.')
102
- flags.DEFINE_bool(
103
- 'fetch_discovery',
104
- False,
105
- 'If true, grab the API description from the discovery API.')
106
- flags.DEFINE_bool(
107
- 'synchronous_mode',
108
- True,
109
- 'If false, return immediately after posting a request.')
110
- flags.DEFINE_integer(
111
- 'sleep_between_polls',
112
- 3,
113
- 'The time to sleep between polls to the server in seconds.',
114
- 1, 600)
115
- flags.DEFINE_integer(
116
- 'max_wait_time',
117
- 240,
118
- 'The maximum time to wait for an asynchronous operation to complete in '
119
- 'seconds.',
120
- 30, 1200)
121
- flags.DEFINE_string(
122
- 'trace_token',
123
- None,
124
- 'Trace the API requests using a trace token provided by Google.')
125
- flags.DEFINE_integer(
126
- 'concurrent_operations',
127
- 10,
128
- 'The maximum number of concurrent operations to have in progress at once. '
129
- 'Increasing this number will probably result in hitting rate limits.',
130
- 1, 20)
131
-
132
-
133
- class Error(Exception):
134
- """The base class for this tool's error reporting infrastructure."""
135
-
136
-
137
- class CommandError(Error):
138
- """Raised when a command hits a general error."""
139
-
140
-
141
- # A wrapper around an Api that adds a trace keyword to the Api.
142
- class TracedApi(object):
143
- """Wrap an Api to add a trace keyword argument."""
144
-
145
- def __init__(self, obj, trace_token):
146
- def Wrap(func):
147
- def _Wrapped(*args, **kwargs):
148
- # Add a trace= URL parameter to the method call.
149
- if trace_token:
150
- kwargs['trace'] = trace_token
151
- return func(*args, **kwargs)
152
- return _Wrapped
153
-
154
- # Find all public methods and interpose them.
155
- for method in inspect.getmembers(obj, (inspect.ismethod)):
156
- if not method[0].startswith('__'):
157
- setattr(self, method[0], Wrap(method[1]))
158
-
159
-
160
- class TracedComputeApi(object):
161
- """Wrap a ComputeApi object to return TracedApis."""
162
-
163
- def __init__(self, obj, trace_token):
164
- def Wrap(func):
165
- def _Wrapped(*args, **kwargs):
166
- ret = func(*args, **kwargs)
167
- if ret:
168
- ret = TracedApi(ret, trace_token)
169
- return ret
170
- return _Wrapped
171
-
172
- # Find all our public methods and interpose them.
173
- for method in inspect.getmembers(obj, (inspect.ismethod)):
174
- if not method[0].startswith('__'):
175
- setattr(self, method[0], Wrap(method[1]))
176
-
177
-
178
- class ApiThreadPoolOperation(thread_pool.Operation):
179
- """A Thread pool operation that will execute an API request.
180
-
181
- This will wait for the operation to complete, if appropriate. The
182
- result from the object will be the last operation object returned.
183
- """
184
-
185
- def __init__(self, request, command, wait_for_operation,
186
- collection_name=None):
187
- """Initializer."""
188
- super(ApiThreadPoolOperation, self).__init__()
189
- self._request = request
190
- self._command = command
191
- self._wait_for_operation = wait_for_operation
192
- self._collection_name = collection_name
193
-
194
- def Run(self):
195
- """Execute the request on a separate thread."""
196
- # Note that the httplib2.Http command isn't thread safe. As such,
197
- # we need to create a new Http object here.
198
- http = self._command.CreateHttp()
199
- result = self._request.execute(http=http)
200
- if self._wait_for_operation:
201
- result = self._command.WaitForOperation(
202
- self._command.GetFlags(), time, result, http=http,
203
- collection_name=self._collection_name)
204
- return result
205
-
206
-
207
- class GoogleComputeCommand(appcommands.Cmd):
208
- """Base class for commands that interact with the Google Compute Engine API.
209
-
210
- Overriding classes must override the SetApi and Handle methods.
211
-
212
- Attributes:
213
- GOOGLE_PROJECT_PATH: The common 'google' project used for storage of shared
214
- images and kernels.
215
- operation_detail_fields: A set of tuples of (json field name, human
216
- readable name) used to generate a pretty-printed detailed description
217
- of an operation resource.
218
- supported_versions: The list of API versions supported by this tool.
219
- safety_prompt: A boolean indicating whether the command requires user
220
- confirmation prior to executing.
221
- """
222
-
223
- GOOGLE_PROJECT_PATH = 'projects/google'
224
-
225
- operation_default_sort_field = 'insert-time'
226
- operation_summary_fields = (('name', 'name'),
227
- ('zone', 'zone'),
228
- ('status', 'status'),
229
- ('status-message', 'statusMessage'),
230
- ('target', 'targetLink'),
231
- ('insert-time', 'insertTime'),
232
- ('operation-type', 'operationType'),
233
- ('error', 'error.errors.code'),
234
- ('warning', 'warnings.code'))
235
- operation_detail_fields = (('name', 'name'),
236
- ('zone', 'zone'),
237
- ('creation-time', 'creationTimestamp'),
238
- ('status', 'status'),
239
- ('progress', 'progress'),
240
- ('status-message', 'statusMessage'),
241
- ('target', 'targetLink'),
242
- ('target-id', 'targetId'),
243
- ('client-operation-id', 'clientOperationId'),
244
- ('insert-time', 'insertTime'),
245
- ('user', 'user'),
246
- ('start-time', 'startTime'),
247
- ('end-time', 'endTime'),
248
- ('operation-type', 'operationType'),
249
- ('error-code', 'httpErrorStatusCode'),
250
- ('error-message', 'httpErrorMessage'),
251
- ('warning', 'warnings.code'),
252
- ('warning-message', 'warnings.message'))
253
-
254
- # If this is set to True then the arguments and flags for this
255
- # command are sorted such that everything that looks like a flag is
256
- # pulled out of the arguments. If a command needs unparsed flags
257
- # after positional arguments (like ssh) then set this to False.
258
- sort_args_and_flags = True
259
-
260
- def __init__(self, name, flag_values):
261
- """Initializes a new instance of a GoogleComputeCommand.
262
-
263
- Args:
264
- name: The name of the command.
265
- flag_values: The values of command line flags to be used by the command.
266
- """
267
- super(GoogleComputeCommand, self).__init__(name, flag_values)
268
- self._credential = None
269
- self.supported_versions = SUPPORTED_VERSIONS
270
-
271
- if hasattr(self, 'safety_prompt'):
272
- flags.DEFINE_bool('force',
273
- False,
274
- 'Override the "%s" prompt' % self.safety_prompt,
275
- flag_values=flag_values,
276
- short_name='f')
277
-
278
- def _ReadInSelectedItem(self, menu, menu_name):
279
- while True:
280
- userinput = raw_input('>>> ').strip()
281
- try:
282
- selection = int(userinput)
283
- if selection in menu:
284
- return selection
285
- except ValueError:
286
- pass
287
- print 'Invalid selection, please choose one of the listed ' + menu_name
288
-
289
- def _PromptForEntry(self, collection_api, collection_name, project=None,
290
- auto_select=True, extract_resource_prompt=None,
291
- additional_key_func=None):
292
- """Prompt the user to select an entry from an API collection.
293
-
294
- Args:
295
- collection_api: The API collection wrapper.
296
- collection_name: The name of the collection used in building the prompts.
297
- project: A project whose collection to use. Defaults to self._project.
298
- auto_select: If True and the collection has a single element then that
299
- element is chosen without prompting the user.
300
- extract_resource_prompt: A function that takes a resource JSON and returns
301
- the resource prompt. If not provided, the resource's 'name' field is
302
- going to be used as the default prompt text.
303
- additional_key_func: Lambda resource_name -> int. If supplied, this
304
- function will be used as the first sort key of the name.
305
-
306
- Returns:
307
- A collection entry as selected by the user or None if the collection is
308
- empty;
309
- """
310
- choices = utils.All(collection_api.list, project or self._project)['items']
311
- return self._PromptForChoice(
312
- choices, collection_name, auto_select, extract_resource_prompt,
313
- additional_key_func)
314
-
315
- def _PromptForChoice(self, choices, collection_name, auto_select=True,
316
- extract_resource_prompt=None, additional_key_func=None):
317
- """Prompts user to select one of the resources from the choices list.
318
-
319
- The function will create list of prompts from the list of choices. If caller
320
- passed extract_resource_prompt function, the extract_resource_prompt will be
321
- called on each resource to generate appropriate prompt text.
322
-
323
- Prompt strings are sorted alphabetically and offered to the user to select
324
- the desired option. The selected resource is then returned to the caller.
325
-
326
- If the list of choices is empty, None is returned.
327
- If there is only one available choice and auto_select is True, user is not
328
- prompted but rather, the only available option is returned.
329
-
330
- Args:
331
- choices: List of Google Compute Engine resources from which user should
332
- choose.
333
- collection_name: Name of the collection to present to the user.
334
- auto_select: Boolean. If set to True and only one resource is available in
335
- the list of choices, user will not be prompted but rather, the only
336
- available option will be chosen.
337
- extract_resource_prompt: Lambda resource -> string. If supplied, this
338
- function will be called on each resource to generate the prompt string
339
- for the resource.
340
- additional_key_func: Lambda resource_name -> int. If supplied, this
341
- function will be used as the first sort key of the name.
342
-
343
- Returns:
344
- The resource user selected. Returns the actual resource as the JSON object
345
- model represented as Python dictionary.
346
- """
347
- if extract_resource_prompt is None:
348
-
349
- def ExtractResourcePrompt(resource):
350
- return resource['name'].split('/')[-1]
351
-
352
- extract_resource_prompt = ExtractResourcePrompt
353
-
354
- if not choices:
355
- return None
356
-
357
- if auto_select and len(choices) == 1:
358
- print 'Selecting the only available %s: %s' % (
359
- collection_name, choices[0]['name'])
360
- if 'deprecated' in choices[0]:
361
- LOGGER.warn('Warning: %s is deprecated!', choices[0]['name'])
362
- return choices[0]
363
-
364
- deprecated_choices = [(extract_resource_prompt(ch) + ' (DEPRECATED)', ch)
365
- for ch in choices if 'deprecated' in ch
366
- and ch['deprecated']['state'] == 'DEPRECATED']
367
- deprecated_choices.sort(key=lambda pair: pair[0])
368
- choices = [(extract_resource_prompt(ch), ch) for ch in choices
369
- if not 'deprecated' in ch]
370
-
371
- if additional_key_func:
372
- key_func = lambda pair: (additional_key_func(pair[0]), pair[0])
373
- else:
374
- key_func = lambda pair: pair[0]
375
-
376
- choices.sort(key=key_func)
377
- choices.extend(deprecated_choices)
378
-
379
- for i, (short_name, unused_choice) in enumerate(choices):
380
- print '%d: %s' % (i + 1, short_name)
381
-
382
- selection = self._ReadInSelectedItem(
383
- range(1, len(choices) + 1), collection_name + 's')
384
- return choices[selection - 1][1]
385
-
386
- def _PromptForKernel(self):
387
- """Prompt the user to select a kernel from the available kernels.
388
-
389
- Returns:
390
- A kernel resource selected by the user, or None if no kernels available.
391
- """
392
-
393
- def ExtractKernelPrompt(kernel):
394
- return self._PresentElement(
395
- self.NormalizeGlobalResourceName('google', 'kernels', kernel['name']))
396
-
397
- return self._PromptForEntry(
398
- self._kernels_api, 'kernel', 'google',
399
- extract_resource_prompt=ExtractKernelPrompt)
400
-
401
- def _PromptForImage(self):
402
- choices = (utils.All(self._images_api.list, 'google')['items'] +
403
- utils.All(self._images_api.list, self._project)['items'])
404
-
405
- def ExtractImagePrompt(image):
406
- return self._PresentElement(image['selfLink'])
407
-
408
- return self._PromptForChoice(choices, 'image', True, ExtractImagePrompt)
409
-
410
- def _PromptForZone(self):
411
- """Prompt the user to select a zone from the current list.
412
-
413
- Returns:
414
- A zone resource as selected by the user.
415
- """
416
- now = datetime.datetime.utcnow()
417
-
418
- def ExtractZonePrompt(zone):
419
- """Creates a text prompt for a zone resource.
420
-
421
- Includes maintenance information for zones that enter maintenance in less
422
- than two weeks.
423
-
424
- Args:
425
- zone: The Google Compute Engine zone resource.
426
-
427
- Returns:
428
- string to represent a specific zone choice to present to the user.
429
- """
430
- name = zone['name'].split('/')[-1]
431
- maintenance = GoogleComputeCommand._GetNextMaintenanceStart(zone, now)
432
- if maintenance is not None:
433
- if maintenance < now:
434
- msg = 'currently in maintenance'
435
- else:
436
- delta = maintenance - now
437
- if delta >= datetime.timedelta(weeks=2):
438
- msg = None
439
- elif delta.days < 1:
440
- msg = 'maintenance starts in less than 24 hours'
441
- elif delta.days == 1:
442
- msg = 'maintenance starts in 1 day'
443
- else:
444
- msg = 'maintenance starts in %s days' % delta.days
445
- if msg:
446
- return '%s (%s)' % (name, msg)
447
- return name
448
-
449
- return self._PromptForEntry(self._zones_api, 'zone',
450
- extract_resource_prompt=ExtractZonePrompt)
451
-
452
- def _PromptForDisk(self):
453
- """Prompt the user to select a disk from the current list.
454
-
455
- Returns:
456
- A disk resource as selected by the user.
457
- """
458
- return self._PromptForEntry(self._disks_api, 'disk', auto_select=False)
459
-
460
- def _GetMachineTypeSecondarySortScore(self, value):
461
- """Returns a score for the given machine type to be used in sorting.
462
-
463
- This is used to ensure that the lower cost machine types are the
464
- first ones displayed to the user.
465
-
466
- Args:
467
- value: The name of a machine type.
468
-
469
- Returns:
470
- An integer that defines a sort order.
471
- """
472
- for i in range(len(MACHINE_TYPE_ORDERING)):
473
- if MACHINE_TYPE_ORDERING[i] in value:
474
- return i
475
- return len(MACHINE_TYPE_ORDERING)
476
-
477
- def _PromptForMachineType(self):
478
- """Prompt the user to select a machine type from the current list.
479
-
480
- Returns:
481
- A machine type resource as selected by the user.
482
- """
483
- return self._PromptForEntry(
484
- self._machine_types_api, 'machine type',
485
- additional_key_func=self._GetMachineTypeSecondarySortScore)
486
-
487
- @staticmethod
488
- def _GetNextMaintenanceStart(zone, now=None):
489
- def ParseDate(date):
490
- # Removes the timezone awareness from the timestamp we get back
491
- # from the server. This is necessary because utcnow() is
492
- # timezone unaware and it's much easier to remove timezone
493
- # awareness than to add it in. The latter option requires more
494
- # code and possibly other libraries.
495
- return iso8601.parse_date(date).replace(tzinfo=None)
496
-
497
- if now is None:
498
- now = datetime.datetime.utcnow()
499
- maintenance = zone.get('maintenanceWindows')
500
- next_window = None
501
- if maintenance:
502
- # Find the next maintenance window.
503
- for mw in maintenance:
504
- # Is it already past?
505
- end = mw.get('endTime')
506
- if end:
507
- end = ParseDate(end)
508
- if end < now:
509
- # Skip maintenance because it has occurred in the past.
510
- continue
511
-
512
- begin = mw.get('beginTime')
513
- if begin:
514
- begin = ParseDate(begin)
515
- if next_window is None or begin < next_window:
516
- next_window = begin
517
- return next_window
518
-
519
- def _GetZone(self, zone=None):
520
- """Notifies the user if the given zone will enter maintenance soon.
521
-
522
- The given zone can be None in which case the user is prompted for
523
- a zone. This method is intended to provide a warning to the user
524
- if he or she seeks to create a disk or instance in a zone that
525
- will enter maintenance in less than two weeks.
526
-
527
- Args:
528
- zone: The name of the zone chosen, or None.
529
-
530
- Returns:
531
- The given zone or the zone chosen through the prompt.
532
- """
533
- if zone is None:
534
- zone_resource = self._PromptForZone()
535
- zone = zone_resource['name']
536
- else:
537
- zone = zone.split('/')[-1]
538
- zone_resource = self._zones_api.get(
539
- project=self._project, zone=zone).execute()
540
-
541
- # Warns the user if there is an upcoming maintenance for the
542
- # chosen zone. Times returned from the server are in UTC.
543
- now = datetime.datetime.utcnow()
544
- next_win = GoogleComputeCommand._GetNextMaintenanceStart(
545
- zone_resource, now)
546
- if next_win is not None:
547
- if next_win < now:
548
- msg = 'is unavailable due to maintenance'
549
- else:
550
- delta = next_win - now
551
- if delta >= datetime.timedelta(weeks=2):
552
- msg = None
553
- elif delta.days < 1:
554
- msg = 'less than 24 hours'
555
- elif delta.days == 1:
556
- msg = '1 day'
557
- else:
558
- msg = '%s days' % delta.days
559
- if msg:
560
- msg = 'will become unavailable due to maintenance in %s' % msg
561
- if msg:
562
- LOGGER.warn('%s %s.', zone, msg)
563
- return zone
564
-
565
- def _GetZones(self):
566
- """Retrieves the full list of zones available to this project.
567
-
568
- Returns:
569
- List of zones available to this project.
570
- """
571
- return utils.AllNames(self._zones_api.list, self._project)
572
-
573
- def _AuthenticateWrapper(self, http):
574
- """Adds the OAuth token into http request.
575
-
576
- Args:
577
- http: An instance of httplib2.Http or something that acts like it.
578
-
579
- Returns:
580
- httplib2.Http like object.
581
-
582
- Raises:
583
- CommandError: If the credentials can't be found.
584
- """
585
- if not self._credential:
586
- self._credential = auth_helper.GetCredentialFromStore(
587
- self.__GetRequiredAuthScopes())
588
- if not self._credential:
589
- raise CommandError(
590
- 'Could not get valid credentials for API.')
591
- return self._credential.authorize(http)
592
-
593
-
594
- def _ParseArgumentsAndFlags(self, flag_values, argv):
595
- """Parses the command line arguments for the command.
596
-
597
- This method matches up positional arguments based on the
598
- signature of the Handle method. It also parses the flags
599
- found on the command line.
600
-
601
- argv will contain, <main python file>, positional-arguments, flags...
602
-
603
- Args:
604
- flag_values: The flags list to update
605
- argv: The command line argument list
606
-
607
- Returns:
608
- The list of position arguments for the given command.
609
-
610
- Raises:
611
- CommandError: If any problems occur with parsing the commands (e.g.,
612
- type mistmatches, out of bounds, unknown commands, ...).
613
- """
614
- # If we are sorting args and flags, kick the flag parser into gnu
615
- # mode and parse some more. argv will be all of the unparsed args
616
- # after this.
617
- if self.sort_args_and_flags:
618
- try:
619
- old_gnu_mode = flag_values.IsGnuGetOpt()
620
- flag_values.UseGnuGetOpt(True)
621
- argv = flag_values(argv)
622
- except (flags.IllegalFlagValue, flags.UnrecognizedFlagError) as e:
623
- raise CommandError(e)
624
- finally:
625
- flag_values.UseGnuGetOpt(old_gnu_mode)
626
-
627
- # We use the same positional arguments used by the command's Handle method.
628
- # For AddDisk this will be, ['self', 'disk_name'].
629
- argspec = inspect.getargspec(self.Handle)
630
-
631
- # Skip the implicit argument 'self' and take the list of
632
- # positional command args.
633
- default_count = len(argspec.defaults) if argspec.defaults else 0
634
- pos_arg_names = argspec.args[1:]
635
-
636
- # We then parse off values for those positional arguments from argv.
637
- # Note that we skip the first argument, as that is the command path.
638
- pos_arg_values = argv[1:len(pos_arg_names) + 1]
639
-
640
- # Take all the arguments past the positional arguments. If there
641
- # is a var_arg on the command this will get passed in.
642
- unparsed_args = argv[len(pos_arg_names) + 1:]
643
-
644
- # If we did not get enough positional argument values print error and exit.
645
- if len(pos_arg_names) - default_count > len(pos_arg_values):
646
- missing_args = pos_arg_names[len(pos_arg_values):]
647
- missing_args = ['"%s"' % a for a in missing_args]
648
- raise CommandError('Positional argument %s is missing.' %
649
- ', '.join(missing_args))
650
-
651
- # If users specified flags in place of positional argument values,
652
- # print error and exit.
653
- for (name, value) in zip(pos_arg_names, pos_arg_values):
654
- if value.startswith('--'):
655
- raise CommandError('Invalid positional argument value \'%s\' '
656
- 'for argument \'%s\'\n' % (value, name))
657
-
658
- # If there are any unparsed args and the command is not expecting
659
- # varargs, print error and exit.
660
- if (unparsed_args and
661
-
662
- # MOE_begin_strip
663
- # This is a temporary measure to allow new-style commands to
664
- # have varargs without having a Handle method.
665
- # MOE_end_strip
666
- not getattr(self, 'has_varargs', False) and
667
-
668
- not argspec.varargs):
669
- unparsed_args = ['"%s"' % a for a in unparsed_args]
670
- raise CommandError('Unknown argument: %s' %
671
- ', '.join(unparsed_args))
672
-
673
- return argv[1:]
674
-
675
- def _BuildComputeApi(self, http):
676
- """Builds the Google Compute Engine API to use.
677
-
678
- Args:
679
- http: a httplib2.Http like object for communication.
680
-
681
- Returns:
682
- The API object to use.
683
- """
684
- # For versions of the apiclient library prior to v1beta2, we need to
685
- # specify the LoggingJsonModel in order to get request and response
686
- # logging to work.
687
- json_model = (model.LoggingJsonModel()
688
- if 'LoggingJsonModel' in dir(model)
689
- else model.JsonModel())
690
- if FLAGS.fetch_discovery:
691
- discovery_uri = (FLAGS.api_host +
692
- 'discovery/v1/apis/{api}/{apiVersion}/rest')
693
- return self.WrapApiIfNeeded(discovery.build(
694
- 'compute',
695
- FLAGS.service_version,
696
- http=http,
697
- discoveryServiceUrl=discovery_uri,
698
- model=json_model))
699
- else:
700
- discovery_file_name = os.path.join(
701
- os.path.dirname(__file__),
702
- 'compute/%s.json' % FLAGS.service_version)
703
- try:
704
- discovery_file = file(discovery_file_name, 'r')
705
- discovery_doc = discovery_file.read()
706
- discovery_file.close()
707
- except IOError:
708
- raise CommandError(
709
- 'Could not load discovery document from disk. Perhaps try '
710
- '--fetch_discovery. \nFile: %s' % discovery_file_name)
711
-
712
- return self.WrapApiIfNeeded(discovery.build_from_document(
713
- discovery_doc,
714
- base=FLAGS.api_host,
715
- http=http,
716
- model=json_model))
717
-
718
- @staticmethod
719
- def WrapApiIfNeeded(api):
720
- """Wraps the API to enable logging or tracing."""
721
- if FLAGS.trace_token:
722
- return TracedComputeApi(api, 'token:%s' % (FLAGS.trace_token))
723
- return api
724
-
725
- @staticmethod
726
- def DenormalizeResourceName(resource_name):
727
- """Return the relative name for the given resource.
728
-
729
- Args:
730
- resource_name: The name of the resource. This can be either relative or
731
- absolute.
732
-
733
- Returns:
734
- The name of the resource relative to its enclosing collection.
735
- """
736
- return resource_name.strip('/').rpartition('/')[2]
737
-
738
- @staticmethod
739
- def DenormalizeProjectName(flag_values):
740
- """Denormalize the 'project' entry in the given FlagValues instance.
741
-
742
- Args:
743
- flag_values: The FlagValues instance to update.
744
-
745
- Raises:
746
- CommandError: If the project is missing or malformed.
747
- """
748
- project = flag_values.project or flag_values.project_id
749
-
750
- if not project:
751
- raise CommandError(
752
- 'You must specify a project name using the "--project" flag.')
753
- elif project.lower() != project:
754
- raise CommandError(
755
- 'Characters in project name must be lowercase: %s.' % project)
756
-
757
- project = project.strip('/')
758
- if project.startswith('projects/'):
759
- project = project[len('projects/'):]
760
- if '/' in project:
761
- raise CommandError('Project names can contain a \'/\' only when they '
762
- 'begin with \'projects/\'.')
763
-
764
- flag_values.project = project
765
- flag_values.project_id = None
766
-
767
- def _GetBaseApiUrl(self):
768
- """Get the base API URL given the current flag_values.
769
-
770
- Returns:
771
- The base API URL. For example,
772
- https://www.googleapis.com/compute/v1beta14.
773
- """
774
- return '%scompute/%s' % (self._flags.api_host, self._flags.service_version)
775
-
776
- def _AddBaseUrlIfNecessary(self, resource_path):
777
- """Add the base URL to a resource_path if required by the service_version.
778
-
779
- Args:
780
- resource_path: The resource path to add the URL to.
781
-
782
- Returns:
783
- A full API-usable reference to the given resource_path.
784
- """
785
- if not self._GetBaseApiUrl() in resource_path:
786
- return '%s/%s' % (self._GetBaseApiUrl(), resource_path)
787
- return resource_path
788
-
789
- def _StripBaseUrl(self, value):
790
- """Removes the a base URL from the string if it exists.
791
-
792
- Note that right now the server may not return exactly the right
793
- base URL so we strip off stuff that looks like a base URL.
794
-
795
- Args:
796
- value: The string to strip the base URL from.
797
-
798
- Returns:
799
- A string without the base URL.
800
- """
801
- pattern = '^' + re.escape(self._flags.api_host) + r'compute/\w*/'
802
- return re.sub(pattern, '', value)
803
-
804
- def NormalizeResourceName(self, project, scope_name, collection_name,
805
- resource_name):
806
- """Return the full name for the given resource.
807
-
808
- Args:
809
- project: The name of the project containing the resource.
810
- scope_name: The scope of the collection containing the resource.
811
- collection_name: The name of the collection containing the resource.
812
- resource_name: The name of the resource. This can be either relative
813
- or absolute.
814
-
815
- Returns:
816
- The full URL of the resource.
817
- """
818
- resource_name = resource_name.strip('/')
819
-
820
- if (collection_name == 'machine-types' and
821
- 'v1beta13' in self.supported_versions and
822
- self._IsUsingAtLeastApiVersion('v1beta13')):
823
- collection_name = 'machineTypes'
824
-
825
- if (resource_name.startswith('projects/') or
826
- resource_name.startswith(collection_name + '/') or
827
- resource_name.startswith(self._flags.api_host)):
828
- # This does not appear to be a relative name.
829
- return self._AddBaseUrlIfNecessary(resource_name)
830
-
831
- absolute_name = 'projects/%s/%s/%s' % (project,
832
- collection_name,
833
- resource_name)
834
-
835
- if self._IsUsingAtLeastApiVersion('v1beta14') and scope_name:
836
- absolute_name = 'projects/%s/%s/%s/%s' % (project,
837
- scope_name,
838
- collection_name,
839
- resource_name)
840
- return self._AddBaseUrlIfNecessary(absolute_name)
841
-
842
- def NormalizeTopLevelResourceName(self, project, collection, resource):
843
- """Return the full name for the given resource.
844
-
845
- Args:
846
- project: The name of the project containing the resource.
847
- collection: The name of the collection containing the resource.
848
- resource: The name of the resource. This can be either relative or
849
- absolute.
850
-
851
- Returns:
852
- The full URL of the resource.
853
- """
854
- return self.NormalizeResourceName(project,
855
- None,
856
- collection,
857
- resource)
858
-
859
- def NormalizeGlobalResourceName(self, project, collection, resource):
860
- """Return the full name for the given resource.
861
-
862
- Args:
863
- project: The name of the project containing the resource.
864
- collection: The name of the collection containing the resource.
865
- resource: The name of the resource. This can be either relative or
866
- absolute.
867
-
868
- Returns:
869
- The full URL of the resource.
870
- """
871
- return self.NormalizeResourceName(project,
872
- 'global',
873
- collection,
874
- resource)
875
-
876
- def NormalizePerZoneResourceName(self, project, zone, collection, resource):
877
- """Return the full name for the given resource.
878
-
879
- Args:
880
- project: The name of the project containing the resource.
881
- zone: The name of the zone containing the resource.
882
- collection: The name of the collection containing the resource.
883
- resource: The name of the resource. This can be either relative or
884
- absolute.
885
-
886
- Returns:
887
- The full URL of the resource.
888
- """
889
- return self.NormalizeResourceName(project,
890
- 'zones/%s' % zone,
891
- collection,
892
- resource)
893
-
894
- def GetZoneForResource(self, api, resource_name, fail_if_not_found=True):
895
- """Gets the unqualified zone name for a given resource.
896
-
897
- The function first tries to use 'zone' parameter if set, but falls back
898
- to searching for the resource name across zones.
899
-
900
- Args:
901
- api: The API service that must expose 'list' method.
902
- resource_name: Name of the resource to find.
903
- fail_if_not_found: Raise an error when the resource is not found.
904
-
905
- Returns:
906
- Unqualified name of the zone the resource belongs to.
907
-
908
- Raises:
909
- CommandError: If the zone for the resource cannot be resolved.
910
- """
911
- # If the resource is already project- and zone-qualified, use the zone.
912
- if not resource_name:
913
- return None
914
-
915
- resource_name_parts = self._StripBaseUrl(resource_name).split('/')
916
- if (len(resource_name_parts) > 3 and
917
- resource_name_parts[0] == 'projects' and
918
- resource_name_parts[2] == 'zones'):
919
- return resource_name_parts[3]
920
-
921
- if self._flags.zone == GLOBAL_ZONE_NAME:
922
- return None
923
-
924
- if self._flags.zone:
925
- return self._flags.zone
926
-
927
- filter_expression = utils.RegexesToFilterExpression(
928
- [self.DenormalizeResourceName(resource_name)])
929
-
930
- items = []
931
- for zone in self._GetZones():
932
- # Limiting the number of results to 2, since anything other than one
933
- # is an error.
934
- sub_result = utils.All(api.list,
935
- self._project,
936
- max_results=2,
937
- filter=filter_expression,
938
- zone=zone)
939
- items.extend(sub_result.get('items', []))
940
-
941
- if len(items) == 1:
942
- zone = self._GetZoneFromSelfLink(items[0]['selfLink'])
943
- LOGGER.info('Zone for %s detected as %s.', repr(resource_name),
944
- repr(zone or GLOBAL_ZONE_NAME))
945
- LOGGER.warning('Consider passing \'--zone=%s\' to avoid the unnecessary '
946
- 'zone lookup which requires extra API calls.',
947
- zone or GLOBAL_ZONE_NAME)
948
- return zone
949
-
950
- if fail_if_not_found:
951
- raise CommandError('Could not determine the zone of \'%s\'.' %
952
- resource_name)
953
- else:
954
- return None
955
-
956
- def _GetZoneFromSelfLink(self, self_link):
957
- """Parses the given self-link and returns per-project zone name."""
958
- resource_name = self._StripBaseUrl(self_link)
959
- parts = resource_name.split('/')
960
- if len(parts) > 3 and parts[0] == 'projects' and parts[2] == 'zones':
961
- return parts[3]
962
- else:
963
- return None
964
-
965
- def _HandleSafetyPrompt(self, positional_arguments):
966
- """If a safety prompt is present on the class, handle it now.
967
-
968
- By defining a field 'safety_prompt', derived classes can request
969
- that the user confirm a dangerous operation prior to execution,
970
- e.g. deleting a resource. Users may override this check by
971
- passing the --force flag on the command line.
972
-
973
- Args:
974
- positional_arguments: A list of positional argument strings.
975
-
976
- Returns:
977
- True if the command should continue, False if not.
978
- """
979
- if hasattr(self, 'safety_prompt'):
980
- if not self._flags.force:
981
- prompt = self.safety_prompt
982
- if positional_arguments:
983
- prompt = '%s %s' % (prompt, ', '.join(positional_arguments))
984
- print '%s? [y/N]' % prompt
985
- userinput = raw_input('>>> ')
986
-
987
- if not userinput:
988
- userinput = 'n'
989
- userinput = userinput.lstrip()[:1].lower()
990
-
991
- if not userinput == 'y':
992
- return False
993
-
994
- return True
995
-
996
- def _IsUsingAtLeastApiVersion(self, required_version):
997
- """Determine if in-use API version is at least the specified version.
998
-
999
- Args:
1000
- required_version: The API version to test.
1001
-
1002
- Returns:
1003
- True if the given API version is equal or newer than the in-use
1004
- API version, False otherwise.
1005
-
1006
- Raises:
1007
- CommandError: If the specified API version is not known.
1008
- """
1009
- if not (required_version in self.supported_versions and
1010
- self._flags.service_version in self.supported_versions):
1011
- raise CommandError('API version %s/%s unknown' % (
1012
- required_version, self._flags.service_version))
1013
-
1014
- for index, known_version in enumerate(self.supported_versions):
1015
- if known_version == self._flags.service_version:
1016
- current_index = index
1017
- if known_version == required_version:
1018
- given_index = index
1019
-
1020
- return current_index >= given_index
1021
-
1022
- def _GetResourceApiKind(self, resource):
1023
- """Determine the API version driven resource 'kind'.
1024
-
1025
- Args:
1026
- resource: The resource type to generate a 'kind' string for.
1027
-
1028
- Returns:
1029
- A string containing the API 'kind'
1030
- """
1031
- return 'compute#%s' % resource
1032
-
1033
- def _ErrorInResult(self, result):
1034
- """Return True if a result should be considered an error."""
1035
- ops = []
1036
- if self.IsResultAnOperation(result):
1037
- ops = [result]
1038
- elif self.IsResultAList(result):
1039
- ops = result.get('items', [])
1040
- for op in ops:
1041
- # If op contains errors, it will be of the form:
1042
- # {'error': {'errors': [...]}, ...}
1043
- if (self._flags.synchronous_mode and
1044
- op.get('error', {}).get('errors', [])):
1045
- return True
1046
- return False
1047
-
1048
- def Run(self, argv):
1049
- """Run the command, printing the result.
1050
-
1051
- Args:
1052
- argv: The arguments to the command.
1053
-
1054
- Returns:
1055
- 0 if the command completes successfully, otherwise 1.
1056
- """
1057
- try:
1058
- pos_arg_values = self._ParseArgumentsAndFlags(FLAGS, argv)
1059
- gcutil_logging.SetupLogging()
1060
-
1061
- # Synchronize the flags with any cached values present.
1062
- flags_cache_obj = flags_cache.FlagsCache()
1063
- flags_cache_obj.SynchronizeFlags()
1064
-
1065
-
1066
- self.SetFlagDefaults()
1067
- self.DenormalizeProjectName(FLAGS)
1068
- self.SetFlags(FLAGS)
1069
-
1070
- auth_retry = True
1071
- error_in_result = False
1072
-
1073
- while auth_retry:
1074
- try:
1075
- result, exceptions = self.RunWithFlagsAndPositionalArgs(
1076
- self._flags, pos_arg_values)
1077
- auth_retry = False
1078
-
1079
- self.PrintResult(result)
1080
- self.LogExceptions(exceptions)
1081
-
1082
- if self._ErrorInResult(result):
1083
- error_in_result = True
1084
-
1085
- # If we just have an AccessTokenRefreshError raise it so
1086
- # that we retry.
1087
- for exception in exceptions:
1088
- if isinstance(exception, oauth2_client.AccessTokenRefreshError):
1089
- if not result:
1090
- raise exception
1091
- else:
1092
- LOGGER.warning('Refresh error when running multiple '
1093
- 'operations. Not automatically retrying as '
1094
- 'some requests succeeded.')
1095
- break
1096
-
1097
- except oauth2_client.AccessTokenRefreshError, e:
1098
- if not auth_retry:
1099
- raise
1100
- # Retrying the operation will induce OAuth2 reauthentication and
1101
- # creation of the new refresh token.
1102
- LOGGER.info('OAuth2 token refresh error (%s), retrying.\n', str(e))
1103
- auth_retry = False
1104
-
1105
- has_errors = bool(exceptions or error_in_result)
1106
-
1107
- # Updates the flags cache file only when the command exits with
1108
- # a non-zero error code.
1109
- if not has_errors:
1110
- flags_cache_obj.UpdateCacheFile()
1111
-
1112
- return has_errors
1113
- except errors.HttpError, http_error:
1114
- self.LogHttpError(http_error)
1115
- return 1
1116
- except app.UsageError:
1117
- raise
1118
- except:
1119
- sys.stderr.write('%s\n' % '\n'.join(
1120
- traceback.format_exception_only(sys.exc_type, sys.exc_value)))
1121
- LOGGER.debug(traceback.format_exc())
1122
- return 1
1123
-
1124
- def CreateHttp(self):
1125
- """Construct an HTTP object to use with an API call.
1126
-
1127
- This is useful when doing multithreaded work as httplib2 Http
1128
- objects aren't threadsafe.
1129
-
1130
- Returns:
1131
- An object that implements the httplib2.Http interface
1132
- """
1133
- http = httplib2.Http()
1134
- http = self._AuthenticateWrapper(http)
1135
- return http
1136
-
1137
- def RunWithFlagsAndPositionalArgs(self, flag_values, pos_arg_values):
1138
- """Run the command with the parsed flags and positional arguments.
1139
-
1140
- This method is what a subclass should override if they do not want
1141
- to use the REST API.
1142
-
1143
- Args:
1144
- flag_values: The parsed FlagValues instance.
1145
- pos_arg_values: The positional arguments for the Handle method.
1146
-
1147
- Raises:
1148
- CommandError: If user choses to not proceed with the command at safety
1149
- prompt.
1150
-
1151
- Returns:
1152
- A tuple (result, exceptions) where results is a
1153
- JSON-serializable result and exceptions is a list of exceptions
1154
- that were thrown when running this command.
1155
- """
1156
- http = self.CreateHttp()
1157
- compute_api = self._BuildComputeApi(http)
1158
- if self._IsUsingAtLeastApiVersion('v1beta14'):
1159
- self._zone_operations_api = compute_api.zoneOperations()
1160
- self._global_operations_api = compute_api.globalOperations()
1161
- else:
1162
- self._global_operations_api = compute_api.operations()
1163
-
1164
- self.SetApi(compute_api)
1165
-
1166
- if not self._HandleSafetyPrompt(pos_arg_values):
1167
- raise CommandError('Operation aborted')
1168
-
1169
- exceptions = []
1170
- result = self.Handle(*pos_arg_values)
1171
- if isinstance(result, tuple):
1172
- result, exceptions = result
1173
- if self._flags.synchronous_mode:
1174
- result = self.WaitForOperation(flag_values, time, result)
1175
- if isinstance(result, list):
1176
- result = self.MakeListResult(result, 'operationList')
1177
-
1178
- return result, exceptions
1179
-
1180
- def IsResultAnOperation(self, result):
1181
- """Determine if the result object is an operation."""
1182
- try:
1183
- return ('kind' in result
1184
- and result['kind'].endswith('#operation'))
1185
- except TypeError:
1186
- return False
1187
-
1188
- def IsResultAList(self, result):
1189
- """Determine if the result object is a list of some sort."""
1190
- try:
1191
- return ('kind' in result
1192
- and result['kind'].endswith('List'))
1193
- except TypeError:
1194
- return False
1195
-
1196
- def MakeListResult(self, results, kind_base):
1197
- """Given an array of results, create an list object for those results.
1198
-
1199
- Args:
1200
- results: The list of results.
1201
- kind_base: The kind of list to create
1202
-
1203
- Returns:
1204
- A synthetic list resource created from the list of individual results.
1205
- """
1206
- return {
1207
- 'kind': self._GetResourceApiKind(kind_base),
1208
- 'items': results,
1209
- 'note': ('This JSON result is based on multiple API calls. This '
1210
- 'object was created in the client.')
1211
- }
1212
-
1213
- def ExecuteRequests(self, requests, collection_name=None):
1214
- """Execute a list of requests in a thread pool.
1215
-
1216
- Args:
1217
- requests: A list of requests objects to execute.
1218
- collection_name: The name of the collection. This is optional and is
1219
- useful for subclasses that mutate more than one resource type.
1220
-
1221
- Returns:
1222
- A tuple with (results, exceptions) where result list is the list
1223
- of all results and exceptions is any exceptions that were
1224
- raised.
1225
- """
1226
- tp = thread_pool.ThreadPool(self._flags.concurrent_operations)
1227
- ops = []
1228
- for request in requests:
1229
- op = ApiThreadPoolOperation(
1230
- request, self, self._flags.synchronous_mode,
1231
- collection_name=collection_name)
1232
- ops.append(op)
1233
- tp.Add(op)
1234
- tp.WaitShutdown()
1235
- results = []
1236
- exceptions = []
1237
- for op in ops:
1238
- if op.RaisedException():
1239
- exceptions.append(op.Result())
1240
- else:
1241
- if isinstance(op.Result(), list):
1242
- results.extend(op.Result())
1243
- else:
1244
- results.append(op.Result())
1245
- return (results, exceptions)
1246
-
1247
- def WaitForOperation(self, flag_values, timer, result, http=None,
1248
- collection_name=None):
1249
- """Wait for a potentially asynchronous operation to complete.
1250
-
1251
- Args:
1252
- flag_values: The parsed FlagValues instance.
1253
- timer: An implementation of the time object, providing time and sleep
1254
- methods.
1255
- result: The result of the request, potentially containing an operation.
1256
- http: An optional httplib2.Http object to use for requests.
1257
-
1258
- Returns:
1259
- The synchronous return value, usually an operation object.
1260
- """
1261
- resource = None
1262
- if not self.IsResultAnOperation(result):
1263
- return result
1264
-
1265
- start_time = timer.time()
1266
- operation_type = result['operationType']
1267
- target = result['targetLink'].split('/')[-1]
1268
-
1269
- while result['status'] != 'DONE':
1270
- if timer.time() - start_time >= flag_values.max_wait_time:
1271
- LOGGER.warn('Timeout reached. %s of %s has not yet completed. '
1272
- 'The operation (%s) is still %s.',
1273
- operation_type, target, result['name'], result['status'])
1274
- break # Timeout
1275
-
1276
- collection_name = (collection_name
1277
- or getattr(self, 'resource_collection_name', None))
1278
- if collection_name:
1279
- singular_collection_name = utils.Singularize(collection_name)
1280
- qualified_name = '%s %s' % (singular_collection_name, target)
1281
- else:
1282
- qualified_name = target
1283
-
1284
- LOGGER.info('Waiting for %s of %s. Sleeping for %ss.', operation_type,
1285
- qualified_name, flag_values.sleep_between_polls)
1286
- timer.sleep(flag_values.sleep_between_polls)
1287
-
1288
- kwargs = {
1289
- 'project': self._project,
1290
- 'operation': result['name'],
1291
- }
1292
-
1293
- poll_api = self._global_operations_api
1294
-
1295
- if self._IsUsingAtLeastApiVersion('v1beta14'):
1296
- operation_zone = self._GetZoneFromSelfLink(result['selfLink'])
1297
- if operation_zone:
1298
- kwargs['zone'] = operation_zone
1299
- poll_api = self._zone_operations_api
1300
-
1301
- # Poll the operation for status.
1302
- request = poll_api.get(**kwargs)
1303
- result = request.execute(http=http)
1304
- else:
1305
- if result['operationType'] != 'delete' and 'error' not in result:
1306
- # We are going to replace the operation with its resulting resource.
1307
- # Save the operation to return as well.
1308
- target_link = result['targetLink']
1309
- http = self.CreateHttp()
1310
- response, data = http.request(target_link, method='GET')
1311
- if 200 <= response.status <= 299:
1312
- resource = json.loads(data)
1313
-
1314
- if resource is not None:
1315
- results = []
1316
- results.append(result)
1317
- results.append(resource)
1318
- return results
1319
- return result
1320
-
1321
- def CommandGetHelp(self, unused_argv, cmd_names=None):
1322
- """Get help for command.
1323
-
1324
- Args:
1325
- unused_argv: Remaining command line flags and arguments after parsing
1326
- command (that is a copy of sys.argv at the time of the
1327
- function call with all parsed flags removed); unused in this
1328
- implementation.
1329
- cmd_names: By default, if help is being shown for more than one command,
1330
- and this command defines _all_commands_help, then
1331
- _all_commands_help will be displayed instead of the class
1332
- doc. cmd_names is used to determine the number of commands
1333
- being displayed and if only a single command is display then
1334
- the class doc is returned.
1335
-
1336
- Returns:
1337
- __doc__ property for command function or a message stating there is no
1338
- help.
1339
- """
1340
- help_str = super(
1341
- GoogleComputeCommand, self).CommandGetHelp(unused_argv, cmd_names)
1342
- return '%s\n\nUsage: %s' % (help_str, self._GetUsage())
1343
-
1344
- def _GetUsage(self):
1345
- """Get the usage string for the command, used to print help messages.
1346
-
1347
- Returns:
1348
- The usage string for the command.
1349
- """
1350
- res = '%s [--global_flags] %s [--command_flags]' % (
1351
- os.path.basename(sys.argv[0]), self._command_name)
1352
-
1353
- args = getattr(self, 'positional_args', None)
1354
- if args:
1355
- res = '%s %s' % (res, args)
1356
-
1357
- return res
1358
-
1359
- def Handle(self):
1360
- """Actual implementation of the command.
1361
-
1362
- Derived classes override this method, adding positional arguments
1363
- to this method as required.
1364
-
1365
- Returns:
1366
- Either a single JSON-serializable result or a tuple of a result
1367
- and a list of exceptions that are thrown.
1368
- """
1369
- raise NotImplementedError()
1370
-
1371
- def SetFlags(self, flag_values):
1372
- """Set the flags to be used by the command.
1373
-
1374
- Args:
1375
- flag_values: The parsed flags values.
1376
- """
1377
- self._flags = flag_values
1378
- self._project = self._flags.project
1379
-
1380
- def GetFlags(self):
1381
- """Get the flags object used by the command."""
1382
- return self._flags
1383
-
1384
- def SetApi(self, api):
1385
- """Set the Google Compute Engine API for the command.
1386
-
1387
- Derived classes override this method, pulling the necessary
1388
- domain specific API out of the global API.
1389
-
1390
- Args:
1391
- api: The Google Compute Engine API used by this command.
1392
- """
1393
- raise NotImplementedError()
1394
-
1395
- def _PresentElement(self, field_value):
1396
- """Format a json value for tabular display.
1397
-
1398
- Strips off the project qualifier if present and elides the value
1399
- if it won't fit inside of a max column size of 64 characters.
1400
-
1401
- Args:
1402
- field_value: The json field value to be formatted.
1403
-
1404
- Returns:
1405
- The formatted json value.
1406
- """
1407
- if isinstance(field_value, basestring):
1408
- field_value = self._StripBaseUrl(field_value).strip('/')
1409
-
1410
- if field_value.startswith('projects/' + self._project):
1411
- field_value_parts = field_value.split('/')
1412
- if len(field_value_parts) > 3:
1413
- field_value = '/'.join(field_value_parts[3:])
1414
- else:
1415
- field_value = field_value_parts[-1]
1416
- if (self._flags.long_values_display_format == 'elided' and
1417
- len(field_value) > 64):
1418
- return field_value[:31] + '..' + field_value[-31:]
1419
- return field_value
1420
-
1421
- def _FlattenObjectToList(self, instance_json, name_map):
1422
- """Convert a json instance to a dictionary for output.
1423
-
1424
- Args:
1425
- instance_json: A JSON object represented as a python dict.
1426
- name_map: A list of key, json-path object tuples where the
1427
- json-path object is either a string or a list of strings.
1428
- ('name', 'container.id') or
1429
- ('name', ['container.id.new', 'container.id.old'])
1430
-
1431
- Returns:
1432
- A list of extracted values selected by the associated JSON path. In
1433
- addition, names are simplified to their shortest path components.
1434
- """
1435
-
1436
- def ExtractSubKeys(json_object, subkey):
1437
- """Extract and flatten a (possibly-repeated) field in a json object.
1438
-
1439
- Args:
1440
- json_object: A JSON object represented as a python dict.
1441
- subkey: a list of path elements, e.g. ['container', 'id'].
1442
-
1443
- Returns:
1444
- [element1, element2, ...] or [] if the subkey could not be found.
1445
- """
1446
- if not subkey:
1447
- return [self._PresentElement(json_object)]
1448
- if subkey[0] in json_object:
1449
- element = json_object[subkey[0]]
1450
- if isinstance(element, list):
1451
- return sum([ExtractSubKeys(x, subkey[1:]) for x in element], [])
1452
- return ExtractSubKeys(element, subkey[1:])
1453
- return []
1454
-
1455
- ret = []
1456
- for unused_key, paths in name_map:
1457
- # There may be multiple possible paths indicating the field name due to
1458
- # versioning changes. Walk through them in order until one is found.
1459
- if isinstance(paths, basestring):
1460
- elements = ExtractSubKeys(instance_json, paths.split('.'))
1461
- else:
1462
- for path in paths:
1463
- elements = ExtractSubKeys(instance_json, path.split('.'))
1464
- if elements:
1465
- break
1466
-
1467
- ret.append(','.join([str(x) for x in elements]))
1468
- return ret
1469
-
1470
- def __AddErrorsForOperation(self, result, table):
1471
- """Add any errors present in the operation result to the output table.
1472
-
1473
- Args:
1474
- result: The json dictionary returned by the server.
1475
- table: The pretty printing table to be customized.
1476
- """
1477
- if 'error' in result:
1478
- table.AddRow(('', ''))
1479
- table.AddRow(('errors', ''))
1480
- for error in result['error']['errors']:
1481
- table.AddRow(('', ''))
1482
- table.AddRow((' error', error['code']))
1483
- table.AddRow((' message', error['message']))
1484
-
1485
- def LogExceptions(self, exceptions):
1486
- """Log a list of exceptions returned in multithreaded operation."""
1487
- for exception in exceptions:
1488
- if isinstance(exception, errors.HttpError):
1489
- self.LogHttpError(exception)
1490
- elif isinstance(exception, Exception):
1491
- sys.stderr.write('%s\n' % '\n'.join(traceback.format_exception_only(
1492
- type(exception).__name__, exception)))
1493
-
1494
- def LogHttpError(self, http_error):
1495
- """Do specific logging when we hit an HttpError."""
1496
-
1497
- def AddMessage(messages, error):
1498
- msg = error.get('message')
1499
- if msg:
1500
- messages.add(msg)
1501
-
1502
- message = http_error.resp.reason
1503
- try:
1504
- data = json.loads(http_error.content)
1505
- messages = set()
1506
- if isinstance(data, dict):
1507
- error = data.get('error', {})
1508
- AddMessage(messages, error)
1509
- for error in error.get('errors', []):
1510
- AddMessage(messages, error)
1511
- message = '\n'.join(messages)
1512
- except ValueError:
1513
- pass
1514
-
1515
- sys.stderr.write('Error: %s\n' % message)
1516
- # Log the full error response for debugging purposes.
1517
- LOGGER.debug(http_error.resp)
1518
- LOGGER.debug(http_error.content)
1519
-
1520
- def PrintResult(self, result):
1521
- """Pretty-print the result of the command.
1522
-
1523
- If a class defines a list of ('title', 'json.field.path') values named
1524
- 'fields', this list will be used to print a table of results using
1525
- prettytable. If self.fields does not exist, result will be printed as
1526
- pretty JSON.
1527
-
1528
- Note that if the result is either an Operations object or an
1529
- OperationsList, it will be special cased and formatted
1530
- appropriately.
1531
-
1532
- Args:
1533
- result: A JSON-serializable object to print.
1534
- """
1535
- if self._flags.print_json or self._flags.format == 'json':
1536
- # We could have used the pprint module, but it produces
1537
- # noisy output due to all of our keys and values being
1538
- # unicode strings rather than simply ascii.
1539
- print json.dumps(result, sort_keys=True, indent=2)
1540
- return
1541
-
1542
- if result:
1543
- if self._flags.format == 'names':
1544
- self._PrintNamesOnly(result)
1545
- elif self.IsResultAList(result):
1546
- self._PrintList(result)
1547
- else:
1548
- self._PrintDetail(result)
1549
-
1550
- def _PrintNamesOnly(self, result):
1551
- """Prints only names of the resources returned by Google Compute Engine API.
1552
-
1553
- Args:
1554
- result: A GCE List resource to print.
1555
- """
1556
- if self.IsResultAList(result):
1557
- results = result.get('items', [])
1558
- else:
1559
- results = [result]
1560
-
1561
- for obj in results:
1562
- name = obj.get('name')
1563
- if name:
1564
- print name
1565
-
1566
- def _CreateFormatter(self):
1567
- if self._flags.format == 'sparse':
1568
- return table_formatter.SparsePrettyFormatter()
1569
- elif self._flags.format == 'csv':
1570
- return table_formatter.CsvFormatter()
1571
- else:
1572
- return table_formatter.PrettyFormatter()
1573
-
1574
- def _PartitionResults(self, result):
1575
- """Partitions results into operations and non-operation resources."""
1576
- res = []
1577
- ops = []
1578
- for obj in result.get('items', []):
1579
- if self.IsResultAnOperation(obj):
1580
- ops.append(obj)
1581
- else:
1582
- res.append(obj)
1583
- return res, ops
1584
-
1585
- def _PrintList(self, result):
1586
- """Prints a result which is a Google Compute Engine List resource.
1587
-
1588
- For the result of batch operations, splits the result list into
1589
- operations and other resources and possibly prints two tables. The
1590
- operations typically represent errors (unless printing results of
1591
- listoperations command) whereas the real resources typically
1592
- represent successfully completed operations.
1593
-
1594
- Args:
1595
- result: A GCE List resource to print.
1596
- """
1597
- # Split results into operations and the rest of resources.
1598
- res, ops = self._PartitionResults(result)
1599
- if res and ops:
1600
- res_header = '\nTable of resources:\n'
1601
- ops_header = '\nTable of operations:\n'
1602
- else:
1603
- res_header = ops_header = None
1604
-
1605
- if res or not ops:
1606
- self._CreateAndPrintTable(res, res_header,
1607
- getattr(self, 'summary_fields', None))
1608
-
1609
- if ops:
1610
- self._CreateAndPrintTable(ops, ops_header,
1611
- self.operation_summary_fields)
1612
-
1613
- def _CreateAndPrintTable(self, values, header, fields):
1614
- """Creates a table representation of the list of resources and prints it.
1615
-
1616
- Args:
1617
- values: List of resources to display.
1618
- header: A header to print before the table (can be None).
1619
- fields: Summary field definition for the table.
1620
- """
1621
- column_names = [x[0] for x in fields]
1622
- rows = [self._FlattenObjectToList(row, fields) for row in values]
1623
-
1624
- table = self._CreateFormatter()
1625
- table.AddColumns(column_names)
1626
- table.AddRows(rows)
1627
-
1628
- if header:
1629
- print header
1630
- print table
1631
-
1632
- def _PrintDetail(self, result):
1633
- """Prints a detail view of the result which is an individual resource.
1634
-
1635
- Args:
1636
- result: A resource to print.
1637
- """
1638
- if self.IsResultAnOperation(result):
1639
- detail_fields = self.operation_detail_fields
1640
- else:
1641
- detail_fields = getattr(self, 'detail_fields', None)
1642
-
1643
- if not detail_fields:
1644
- return
1645
-
1646
- row_names = [x[0] for x in detail_fields]
1647
- table = self._CreateFormatter()
1648
- table.AddColumns(('property', 'value'))
1649
- property_bag = self._FlattenObjectToList(result, detail_fields)
1650
- for i, v in enumerate(property_bag):
1651
- table.AddRow((row_names[i], v))
1652
-
1653
- # Handle customized printing of this result.
1654
- # Operations are special cased here.
1655
- if self.IsResultAnOperation(result):
1656
- self.__AddErrorsForOperation(result, table)
1657
- elif hasattr(self, 'CustomizePrintResult'):
1658
- self.CustomizePrintResult(result, table)
1659
-
1660
- print table
1661
-
1662
- def __GetRequiredAuthScopes(self):
1663
- """Returns a list of scopes required for this command."""
1664
- return scopes.DEFAULT_AUTH_SCOPES
1665
-
1666
- def SetFlagDefaults(self):
1667
- if 'project' in FLAGS.FlagDict() and not FLAGS['project'].present:
1668
- try:
1669
- metadata = metadata_lib.Metadata()
1670
- setattr(FLAGS, 'project', metadata.GetProjectId())
1671
- except metadata_lib.MetadataError:
1672
- pass
1673
-
1674
-
1675
-
1676
- class GoogleComputeListCommand(GoogleComputeCommand):
1677
- """Base class for list commands."""
1678
-
1679
- # Overload these values in derived classes if they represent collections
1680
- # at non-global scopes.
1681
- is_global_level_collection = True
1682
- is_zone_level_collection = False
1683
-
1684
- def __init__(self, name, flag_values):
1685
- """Initializes a new instance of a GoogleComputeListCommand.
1686
-
1687
- Args:
1688
- name: The name of the command.
1689
- flag_values: The values of command line flags to be used by the command.
1690
- """
1691
- super(GoogleComputeListCommand, self).__init__(name, flag_values)
1692
-
1693
- summary_fields = [x[0] for x in getattr(self, 'summary_fields', [])]
1694
- if summary_fields:
1695
- sort_fields = []
1696
- for field in summary_fields:
1697
- sort_fields.append(field)
1698
- sort_fields.append('-' + field)
1699
-
1700
- flags.DEFINE_enum('sort_by',
1701
- None,
1702
- sort_fields,
1703
- 'Sort output results by the given field name. Field '
1704
- 'names starting with a "-" will lead to a descending '
1705
- 'order.',
1706
- flag_values=flag_values)
1707
-
1708
- flags.DEFINE_integer('max_results',
1709
- 100,
1710
- 'Maximum number of items to list',
1711
- lower_bound=1,
1712
- flag_values=flag_values)
1713
- flags.DEFINE_string('filter',
1714
- None,
1715
- 'Filter expression for filtering listed resources. '
1716
- 'See gcutil documentation for syntax of the filter '
1717
- 'expression here: http://developers.google.com'
1718
- '/compute/docs/gcutil/tips#filtering',
1719
- flag_values=flag_values)
1720
- flags.DEFINE_bool('fetch_all_pages',
1721
- False,
1722
- 'Whether to fetch all pages on truncated results',
1723
- flag_values=flag_values)
1724
-
1725
- def Handle(self):
1726
- """Returns the result of list on a resource type."""
1727
- if self._flags.sort_by or self._flags.fetch_all_pages:
1728
- max_results = None
1729
- else:
1730
- max_results = self._flags.max_results
1731
-
1732
- if (self._IsUsingAtLeastApiVersion('v1beta14') and
1733
- self.is_zone_level_collection):
1734
- # We have three cases for zone level collections:
1735
- # 1. A specific zone was specified via flag - just list the resources
1736
- # in that zone.
1737
- # 2. The collection exists in both the zone and global namespaces and
1738
- # the "global" zone was specified - just list the resources in the
1739
- # global namespace.
1740
- # 3. No zone was specified via flag - list all resources in all
1741
- # namespaces for this resource type.
1742
- if 'zone' in self._flags and self._flags.zone:
1743
- if (self.is_global_level_collection and
1744
- self._flags.zone == GLOBAL_ZONE_NAME):
1745
- zones = [None]
1746
- else:
1747
- zones = [self.DenormalizeResourceName(self._flags.zone)]
1748
- else:
1749
- zones = []
1750
- # If the collection is global and per-zone, include results from both.
1751
- if self.is_global_level_collection:
1752
- zones.append(None)
1753
- zones.extend(self._GetZones())
1754
-
1755
- items = []
1756
- for zone in zones:
1757
- list_func = self.ListZoneFunc() if zone else self.ListFunc()
1758
- sub_result = utils.All(list_func,
1759
- self._project,
1760
- max_results,
1761
- self._flags.filter,
1762
- zone)
1763
- kind = sub_result.get('kind')
1764
- items.extend(sub_result.get('items', []))
1765
-
1766
- return {'kind': kind, 'items': items}
1767
-
1768
- # A global collection
1769
- return utils.All(
1770
- self.ListFunc(),
1771
- self._project,
1772
- max_results=max_results,
1773
- filter=self._flags.filter)
1774
-
1775
- def _PrintList(self, result):
1776
- """Prints a table for the given resources."""
1777
- items = result.get('items', [])
1778
- column_names = [x[0] for x in self.summary_fields]
1779
- rows = [self._FlattenObjectToList(row, self.summary_fields)
1780
- for row in items]
1781
-
1782
- sort_col = self._flags.sort_by or getattr(self, 'default_sort_field', None)
1783
- if sort_col:
1784
- reverse = False
1785
- if sort_col.startswith('-'):
1786
- reverse = True
1787
- sort_col = sort_col[1:]
1788
-
1789
- if sort_col in column_names:
1790
- sort_col_idx = column_names.index(sort_col)
1791
- rows = sorted(rows, key=(lambda row: row[sort_col_idx]),
1792
- reverse=reverse)
1793
- else:
1794
- LOGGER.warn('Invalid sort column: ' + sort_col)
1795
-
1796
- if not self._flags.fetch_all_pages:
1797
- # Truncates the list of results. If sorting was requested, all
1798
- # the pages had to be fetched, so we have to truncate the final
1799
- # results on the client side. If sorting was not requested, we
1800
- # truncate anyway in case the server gives back more results
1801
- # than requested.
1802
- rows = rows[:self._flags.max_results]
1803
-
1804
- table = self._CreateFormatter()
1805
- table.AddColumns(column_names)
1806
- table.AddRows(rows)
1807
-
1808
- print table