fog-google 1.9.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (273) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +40 -0
  4. data/README.md +1 -1
  5. data/SECURITY.md +16 -0
  6. data/ci/README.md +3 -2
  7. data/ci/build-head-pipeline.yml +173 -0
  8. data/ci/{pipeline.yml → integration-pipeline.yml} +0 -24
  9. data/ci/pipeline-dev.yml +58 -0
  10. data/ci/tasks/run-int.sh +20 -1
  11. data/ci/tasks/run-int.yml +2 -0
  12. data/examples/sql/flags.rb +10 -6
  13. data/examples/sql/instances.rb +38 -34
  14. data/examples/sql/operations.rb +20 -16
  15. data/examples/sql/ssl_certs.rb +32 -28
  16. data/examples/sql/tiers.rb +10 -6
  17. data/fog-google.gemspec +1 -1
  18. data/lib/fog/compute/google.rb +4 -0
  19. data/lib/fog/compute/google/mock.rb +2 -1
  20. data/lib/fog/compute/google/models/address.rb +15 -2
  21. data/lib/fog/compute/google/models/disk.rb +6 -2
  22. data/lib/fog/compute/google/models/images.rb +6 -1
  23. data/lib/fog/compute/google/models/instance_groups.rb +2 -2
  24. data/lib/fog/compute/google/models/server.rb +30 -6
  25. data/lib/fog/compute/google/real.rb +2 -1
  26. data/lib/fog/compute/google/requests/abandon_instances.rb +2 -0
  27. data/lib/fog/compute/google/requests/add_backend_service_backends.rb +2 -0
  28. data/lib/fog/compute/google/requests/add_instance_group_instances.rb +2 -0
  29. data/lib/fog/compute/google/requests/add_server_access_config.rb +2 -0
  30. data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +2 -0
  31. data/lib/fog/compute/google/requests/add_target_pool_instances.rb +2 -0
  32. data/lib/fog/compute/google/requests/attach_disk.rb +2 -0
  33. data/lib/fog/compute/google/requests/create_disk_snapshot.rb +2 -0
  34. data/lib/fog/compute/google/requests/delete_address.rb +2 -0
  35. data/lib/fog/compute/google/requests/delete_backend_service.rb +2 -0
  36. data/lib/fog/compute/google/requests/delete_disk.rb +2 -0
  37. data/lib/fog/compute/google/requests/delete_firewall.rb +2 -0
  38. data/lib/fog/compute/google/requests/delete_forwarding_rule.rb +2 -0
  39. data/lib/fog/compute/google/requests/delete_global_address.rb +2 -0
  40. data/lib/fog/compute/google/requests/delete_global_forwarding_rule.rb +2 -0
  41. data/lib/fog/compute/google/requests/delete_global_operation.rb +2 -0
  42. data/lib/fog/compute/google/requests/delete_http_health_check.rb +2 -0
  43. data/lib/fog/compute/google/requests/delete_image.rb +2 -0
  44. data/lib/fog/compute/google/requests/delete_instance_group.rb +2 -0
  45. data/lib/fog/compute/google/requests/delete_instance_group_manager.rb +2 -0
  46. data/lib/fog/compute/google/requests/delete_instance_template.rb +2 -0
  47. data/lib/fog/compute/google/requests/delete_network.rb +2 -0
  48. data/lib/fog/compute/google/requests/delete_region_operation.rb +2 -0
  49. data/lib/fog/compute/google/requests/delete_route.rb +2 -0
  50. data/lib/fog/compute/google/requests/delete_server.rb +2 -0
  51. data/lib/fog/compute/google/requests/delete_server_access_config.rb +2 -0
  52. data/lib/fog/compute/google/requests/delete_snapshot.rb +2 -0
  53. data/lib/fog/compute/google/requests/delete_ssl_certificate.rb +2 -0
  54. data/lib/fog/compute/google/requests/delete_subnetwork.rb +2 -0
  55. data/lib/fog/compute/google/requests/delete_target_http_proxy.rb +2 -0
  56. data/lib/fog/compute/google/requests/delete_target_https_proxy.rb +2 -0
  57. data/lib/fog/compute/google/requests/delete_target_instance.rb +2 -0
  58. data/lib/fog/compute/google/requests/delete_target_pool.rb +2 -0
  59. data/lib/fog/compute/google/requests/delete_url_map.rb +2 -0
  60. data/lib/fog/compute/google/requests/delete_zone_operation.rb +2 -0
  61. data/lib/fog/compute/google/requests/deprecate_image.rb +2 -0
  62. data/lib/fog/compute/google/requests/detach_disk.rb +2 -0
  63. data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +2 -0
  64. data/lib/fog/compute/google/requests/get_address.rb +2 -0
  65. data/lib/fog/compute/google/requests/get_backend_service_health.rb +2 -0
  66. data/lib/fog/compute/google/requests/get_disk.rb +2 -0
  67. data/lib/fog/compute/google/requests/get_disk_type.rb +2 -0
  68. data/lib/fog/compute/google/requests/get_firewall.rb +2 -0
  69. data/lib/fog/compute/google/requests/get_forwarding_rule.rb +2 -0
  70. data/lib/fog/compute/google/requests/get_global_address.rb +2 -0
  71. data/lib/fog/compute/google/requests/get_global_forwarding_rule.rb +2 -0
  72. data/lib/fog/compute/google/requests/get_global_operation.rb +2 -0
  73. data/lib/fog/compute/google/requests/get_http_health_check.rb +2 -0
  74. data/lib/fog/compute/google/requests/get_image.rb +2 -0
  75. data/lib/fog/compute/google/requests/get_image_from_family.rb +2 -0
  76. data/lib/fog/compute/google/requests/get_instance_group.rb +2 -0
  77. data/lib/fog/compute/google/requests/get_instance_group_manager.rb +2 -0
  78. data/lib/fog/compute/google/requests/get_instance_template.rb +2 -0
  79. data/lib/fog/compute/google/requests/get_machine_type.rb +2 -0
  80. data/lib/fog/compute/google/requests/get_network.rb +2 -0
  81. data/lib/fog/compute/google/requests/get_project.rb +2 -0
  82. data/lib/fog/compute/google/requests/get_region.rb +2 -0
  83. data/lib/fog/compute/google/requests/get_route.rb +2 -0
  84. data/lib/fog/compute/google/requests/get_server.rb +2 -0
  85. data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +2 -0
  86. data/lib/fog/compute/google/requests/get_snapshot.rb +2 -0
  87. data/lib/fog/compute/google/requests/get_ssl_certificate.rb +2 -0
  88. data/lib/fog/compute/google/requests/get_subnetwork.rb +2 -0
  89. data/lib/fog/compute/google/requests/get_target_http_proxy.rb +2 -0
  90. data/lib/fog/compute/google/requests/get_target_https_proxy.rb +2 -0
  91. data/lib/fog/compute/google/requests/get_target_instance.rb +2 -0
  92. data/lib/fog/compute/google/requests/get_target_pool.rb +2 -0
  93. data/lib/fog/compute/google/requests/get_target_pool_health.rb +2 -0
  94. data/lib/fog/compute/google/requests/get_url_map.rb +2 -0
  95. data/lib/fog/compute/google/requests/get_zone.rb +2 -0
  96. data/lib/fog/compute/google/requests/get_zone_operation.rb +2 -0
  97. data/lib/fog/compute/google/requests/insert_address.rb +2 -0
  98. data/lib/fog/compute/google/requests/insert_backend_service.rb +2 -0
  99. data/lib/fog/compute/google/requests/insert_disk.rb +8 -5
  100. data/lib/fog/compute/google/requests/insert_firewall.rb +2 -0
  101. data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +2 -0
  102. data/lib/fog/compute/google/requests/insert_global_address.rb +2 -0
  103. data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +2 -0
  104. data/lib/fog/compute/google/requests/insert_http_health_check.rb +2 -0
  105. data/lib/fog/compute/google/requests/insert_image.rb +2 -0
  106. data/lib/fog/compute/google/requests/insert_instance_group.rb +2 -0
  107. data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +2 -0
  108. data/lib/fog/compute/google/requests/insert_instance_template.rb +2 -0
  109. data/lib/fog/compute/google/requests/insert_network.rb +2 -0
  110. data/lib/fog/compute/google/requests/insert_route.rb +2 -0
  111. data/lib/fog/compute/google/requests/insert_server.rb +2 -0
  112. data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +2 -0
  113. data/lib/fog/compute/google/requests/insert_subnetwork.rb +2 -0
  114. data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +2 -0
  115. data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +2 -0
  116. data/lib/fog/compute/google/requests/insert_target_instance.rb +2 -0
  117. data/lib/fog/compute/google/requests/insert_target_pool.rb +2 -0
  118. data/lib/fog/compute/google/requests/insert_url_map.rb +2 -0
  119. data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +2 -0
  120. data/lib/fog/compute/google/requests/list_addresses.rb +2 -0
  121. data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +2 -0
  122. data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +2 -0
  123. data/lib/fog/compute/google/requests/list_aggregated_disks.rb +2 -0
  124. data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +2 -0
  125. data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +2 -0
  126. data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +2 -0
  127. data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +2 -0
  128. data/lib/fog/compute/google/requests/list_aggregated_servers.rb +2 -0
  129. data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +2 -0
  130. data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +2 -0
  131. data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +2 -0
  132. data/lib/fog/compute/google/requests/list_disk_types.rb +2 -0
  133. data/lib/fog/compute/google/requests/list_disks.rb +2 -0
  134. data/lib/fog/compute/google/requests/list_firewalls.rb +2 -0
  135. data/lib/fog/compute/google/requests/list_forwarding_rules.rb +2 -0
  136. data/lib/fog/compute/google/requests/list_global_addresses.rb +2 -0
  137. data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +2 -0
  138. data/lib/fog/compute/google/requests/list_global_operations.rb +2 -0
  139. data/lib/fog/compute/google/requests/list_http_health_checks.rb +2 -0
  140. data/lib/fog/compute/google/requests/list_images.rb +2 -0
  141. data/lib/fog/compute/google/requests/list_instance_group_instances.rb +2 -0
  142. data/lib/fog/compute/google/requests/list_instance_group_managers.rb +2 -0
  143. data/lib/fog/compute/google/requests/list_instance_groups.rb +2 -0
  144. data/lib/fog/compute/google/requests/list_instance_templates.rb +2 -0
  145. data/lib/fog/compute/google/requests/list_machine_types.rb +2 -0
  146. data/lib/fog/compute/google/requests/list_networks.rb +2 -0
  147. data/lib/fog/compute/google/requests/list_region_operations.rb +2 -0
  148. data/lib/fog/compute/google/requests/list_regions.rb +2 -0
  149. data/lib/fog/compute/google/requests/list_routes.rb +2 -0
  150. data/lib/fog/compute/google/requests/list_servers.rb +2 -0
  151. data/lib/fog/compute/google/requests/list_snapshots.rb +2 -0
  152. data/lib/fog/compute/google/requests/list_ssl_certificates.rb +2 -0
  153. data/lib/fog/compute/google/requests/list_subnetworks.rb +2 -0
  154. data/lib/fog/compute/google/requests/list_target_http_proxies.rb +2 -0
  155. data/lib/fog/compute/google/requests/list_target_https_proxies.rb +2 -0
  156. data/lib/fog/compute/google/requests/list_target_instances.rb +2 -0
  157. data/lib/fog/compute/google/requests/list_target_pools.rb +2 -0
  158. data/lib/fog/compute/google/requests/list_url_maps.rb +2 -0
  159. data/lib/fog/compute/google/requests/list_zone_operations.rb +2 -0
  160. data/lib/fog/compute/google/requests/list_zones.rb +2 -0
  161. data/lib/fog/compute/google/requests/patch_firewall.rb +2 -0
  162. data/lib/fog/compute/google/requests/patch_url_map.rb +2 -0
  163. data/lib/fog/compute/google/requests/recreate_instances.rb +2 -0
  164. data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +2 -0
  165. data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +2 -0
  166. data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +2 -0
  167. data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +2 -0
  168. data/lib/fog/compute/google/requests/reset_server.rb +2 -0
  169. data/lib/fog/compute/google/requests/reset_windows_password.rb +154 -0
  170. data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +2 -0
  171. data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +2 -0
  172. data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +2 -0
  173. data/lib/fog/compute/google/requests/set_instance_template.rb +2 -0
  174. data/lib/fog/compute/google/requests/set_server_disk_auto_delete.rb +2 -0
  175. data/lib/fog/compute/google/requests/set_server_machine_type.rb +23 -0
  176. data/lib/fog/compute/google/requests/set_server_metadata.rb +2 -0
  177. data/lib/fog/compute/google/requests/set_server_scheduling.rb +2 -0
  178. data/lib/fog/compute/google/requests/set_server_tags.rb +2 -0
  179. data/lib/fog/compute/google/requests/set_snapshot_labels.rb +2 -0
  180. data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +2 -0
  181. data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +2 -0
  182. data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +2 -0
  183. data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +2 -0
  184. data/lib/fog/compute/google/requests/set_target_pool_backup.rb +2 -0
  185. data/lib/fog/compute/google/requests/start_server.rb +2 -0
  186. data/lib/fog/compute/google/requests/stop_server.rb +2 -0
  187. data/lib/fog/compute/google/requests/update_firewall.rb +2 -0
  188. data/lib/fog/compute/google/requests/update_http_health_check.rb +2 -0
  189. data/lib/fog/compute/google/requests/update_url_map.rb +2 -0
  190. data/lib/fog/compute/google/requests/validate_url_map.rb +2 -0
  191. data/lib/fog/dns/google/requests/create_change.rb +2 -0
  192. data/lib/fog/dns/google/requests/create_managed_zone.rb +2 -0
  193. data/lib/fog/dns/google/requests/delete_managed_zone.rb +2 -0
  194. data/lib/fog/dns/google/requests/get_change.rb +2 -0
  195. data/lib/fog/dns/google/requests/get_managed_zone.rb +2 -0
  196. data/lib/fog/dns/google/requests/get_project.rb +2 -0
  197. data/lib/fog/dns/google/requests/list_changes.rb +2 -0
  198. data/lib/fog/dns/google/requests/list_managed_zones.rb +2 -0
  199. data/lib/fog/dns/google/requests/list_resource_record_sets.rb +2 -0
  200. data/lib/fog/google/models/sql/ssl_cert.rb +7 -1
  201. data/lib/fog/google/models/sql/user.rb +2 -0
  202. data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +2 -0
  203. data/lib/fog/google/requests/monitoring/create_timeseries.rb +3 -1
  204. data/lib/fog/google/requests/monitoring/delete_metric_descriptor.rb +2 -0
  205. data/lib/fog/google/requests/monitoring/get_metric_descriptor.rb +2 -0
  206. data/lib/fog/google/requests/monitoring/list_monitored_resource_descriptors.rb +2 -0
  207. data/lib/fog/google/requests/monitoring/list_timeseries.rb +2 -0
  208. data/lib/fog/google/requests/sql/clone_instance.rb +2 -0
  209. data/lib/fog/google/requests/sql/delete_backup_run.rb +2 -0
  210. data/lib/fog/google/requests/sql/delete_instance.rb +2 -0
  211. data/lib/fog/google/requests/sql/delete_ssl_cert.rb +2 -0
  212. data/lib/fog/google/requests/sql/delete_user.rb +2 -0
  213. data/lib/fog/google/requests/sql/export_instance.rb +2 -0
  214. data/lib/fog/google/requests/sql/get_backup_run.rb +2 -0
  215. data/lib/fog/google/requests/sql/get_instance.rb +2 -0
  216. data/lib/fog/google/requests/sql/get_operation.rb +2 -0
  217. data/lib/fog/google/requests/sql/get_ssl_cert.rb +2 -0
  218. data/lib/fog/google/requests/sql/import_instance.rb +2 -0
  219. data/lib/fog/google/requests/sql/insert_backup_run.rb +2 -0
  220. data/lib/fog/google/requests/sql/insert_instance.rb +2 -0
  221. data/lib/fog/google/requests/sql/insert_ssl_cert.rb +2 -0
  222. data/lib/fog/google/requests/sql/insert_user.rb +2 -0
  223. data/lib/fog/google/requests/sql/list_backup_runs.rb +2 -0
  224. data/lib/fog/google/requests/sql/list_flags.rb +2 -0
  225. data/lib/fog/google/requests/sql/list_instances.rb +2 -0
  226. data/lib/fog/google/requests/sql/list_operations.rb +2 -0
  227. data/lib/fog/google/requests/sql/list_ssl_certs.rb +2 -0
  228. data/lib/fog/google/requests/sql/list_tiers.rb +2 -0
  229. data/lib/fog/google/requests/sql/list_users.rb +2 -0
  230. data/lib/fog/google/requests/sql/reset_instance_ssl_config.rb +2 -0
  231. data/lib/fog/google/requests/sql/restart_instance.rb +2 -0
  232. data/lib/fog/google/requests/sql/restore_instance_backup.rb +2 -0
  233. data/lib/fog/google/requests/sql/update_instance.rb +2 -0
  234. data/lib/fog/google/requests/sql/update_user.rb +2 -0
  235. data/lib/fog/google/version.rb +1 -1
  236. data/lib/fog/storage/google_json/requests/copy_object.rb +2 -0
  237. data/lib/fog/storage/google_json/requests/delete_bucket.rb +2 -0
  238. data/lib/fog/storage/google_json/requests/delete_object.rb +2 -0
  239. data/lib/fog/storage/google_json/requests/get_bucket.rb +2 -0
  240. data/lib/fog/storage/google_json/requests/get_bucket_acl.rb +2 -0
  241. data/lib/fog/storage/google_json/requests/get_object.rb +2 -0
  242. data/lib/fog/storage/google_json/requests/get_object_acl.rb +2 -0
  243. data/lib/fog/storage/google_json/requests/get_object_metadata.rb +2 -0
  244. data/lib/fog/storage/google_json/requests/list_bucket_acl.rb +2 -0
  245. data/lib/fog/storage/google_json/requests/list_buckets.rb +2 -0
  246. data/lib/fog/storage/google_json/requests/list_object_acl.rb +2 -0
  247. data/lib/fog/storage/google_json/requests/list_objects.rb +2 -0
  248. data/lib/fog/storage/google_json/requests/put_bucket.rb +2 -0
  249. data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +2 -0
  250. data/lib/fog/storage/google_json/requests/put_object.rb +2 -0
  251. data/lib/fog/storage/google_json/requests/put_object_acl.rb +2 -0
  252. data/lib/fog/storage/google_xml/requests/put_bucket_acl.rb +2 -0
  253. data/tasks/test.rake +6 -2
  254. data/test/helpers/integration_test_helper.rb +2 -5
  255. data/test/helpers/test_helper.rb +1 -0
  256. data/test/integration/compute/core_compute/test_servers.rb +40 -0
  257. data/test/integration/compute/core_compute/test_zones.rb +1 -1
  258. data/test/integration/compute/core_networking/test_addresses.rb +23 -0
  259. data/test/integration/factories/{sql_v1_certs_factory.rb → sql_certs_factory.rb} +3 -3
  260. data/test/integration/factories/{sql_v1_instances_factory.rb → sql_instances_factory.rb} +3 -3
  261. data/test/integration/factories/{sql_v1_users_factory.rb → sql_users_factory.rb} +6 -3
  262. data/test/integration/monitoring/test_metric_descriptors.rb +2 -0
  263. data/test/integration/monitoring/test_timeseries.rb +3 -1
  264. data/test/integration/sql/{sqlv1/test_v1_certs.rb → test_certs.rb} +4 -3
  265. data/test/integration/sql/{sqlv1/test_common_flags.rb → test_common_flags.rb} +0 -0
  266. data/test/integration/sql/{sqlv1/test_common_tiers.rb → test_common_tiers.rb} +0 -0
  267. data/test/integration/sql/{sqlv1/test_coverage.rb → test_coverage.rb} +1 -1
  268. data/test/integration/sql/{sqlv2/test_v2_instances.rb → test_instances.rb} +22 -2
  269. data/test/integration/sql/{sqlv1/test_v1_users.rb → test_users.rb} +4 -4
  270. metadata +37 -32
  271. data/test/integration/factories/sql_v2_instances_factory.rb +0 -19
  272. data/test/integration/sql/sqlv1/test_v1_instances.rb +0 -31
  273. data/test/integration/sql/sqlv2/test_coverage.rb +0 -6
@@ -1,20 +1,24 @@
1
- def test
2
- connection = Fog::Google::SQL.new
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # More info on it can be found here: http://fog.io/about/getting_started.html
3
3
 
4
- puts "Create a Instance..."
5
- puts "--------------------"
6
- instance = connection.instances.create(:name => Fog::Mock.random_letters(16), :tier => "D1")
7
- instance.wait_for { ready? }
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
8
6
 
9
- puts "Delete the Instance..."
10
- puts "----------------------"
11
- operation = instance.destroy
7
+ connection = Fog::Google::SQL.new
12
8
 
13
- puts "Get the Operation..."
14
- puts "--------------------"
15
- connection.operations.get(operation.identity)
9
+ puts "Create a Instance..."
10
+ puts "--------------------"
11
+ instance = connection.instances.create(:name => Fog::Mock.random_letters(16), :tier => "D1")
12
+ instance.wait_for { ready? }
16
13
 
17
- puts "Listing all Operations..."
18
- puts "-------------------------"
19
- connection.operations.all(instance.identity)
20
- end
14
+ puts "Delete the Instance..."
15
+ puts "----------------------"
16
+ operation = instance.destroy
17
+
18
+ puts "Get the Operation..."
19
+ puts "--------------------"
20
+ connection.operations.get(operation.identity)
21
+
22
+ puts "Listing all Operations..."
23
+ puts "-------------------------"
24
+ connection.operations.all(instance.identity)
@@ -1,28 +1,32 @@
1
- def test
2
- connection = Fog::Google::SQL.new
3
-
4
- puts "Create a Instance..."
5
- puts "--------------------"
6
- instance = connection.instances.create(:name => Fog::Mock.random_letters(16), :tier => "D1")
7
- instance.wait_for { ready? }
8
-
9
- puts "Create a SSL certificate..."
10
- puts "---------------------------"
11
- ssl_cert = connection.ssl_certs.create(:instance => instance.name, :common_name => Fog::Mock.random_letters(16))
12
-
13
- puts "Get the SSL certificate..."
14
- puts "--------------------------"
15
- connection.ssl_certs.get(instance.name, ssl_cert.sha1_fingerprint)
16
-
17
- puts "List all SSL certificate..."
18
- puts "---------------------------"
19
- connection.ssl_certs.all(instance.name)
20
-
21
- puts "Delete the SSL certificate..."
22
- puts "-----------------------------"
23
- ssl_cert.destroy
24
-
25
- puts "Delete the Instance..."
26
- puts "----------------------"
27
- instance.destroy
28
- end
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # More info on it can be found here: http://fog.io/about/getting_started.html
3
+
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
6
+
7
+ connection = Fog::Google::SQL.new
8
+
9
+ puts "Create a Instance..."
10
+ puts "--------------------"
11
+ instance = connection.instances.create(:name => Fog::Mock.random_letters(16), :tier => "db-n1-standard-1")
12
+ instance.wait_for { ready? }
13
+
14
+ puts "Create a SSL certificate..."
15
+ puts "---------------------------"
16
+ ssl_cert = connection.ssl_certs.create(:instance => instance.name, :common_name => Fog::Mock.random_letters(16))
17
+
18
+ puts "Get the SSL certificate..."
19
+ puts "--------------------------"
20
+ connection.ssl_certs.get(instance.name, ssl_cert.sha1_fingerprint)
21
+
22
+ puts "List all SSL certificate..."
23
+ puts "---------------------------"
24
+ connection.ssl_certs.all(instance.name)
25
+
26
+ puts "Delete the SSL certificate..."
27
+ puts "-----------------------------"
28
+ ssl_cert.destroy
29
+
30
+ puts "Delete the Instance..."
31
+ puts "----------------------"
32
+ instance.destroy
@@ -1,7 +1,11 @@
1
- def test
2
- connection = Fog::Google::SQL.new
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # More info on it can be found here: http://fog.io/about/getting_started.html
3
3
 
4
- puts "Listing all Tiers..."
5
- puts "--------------------"
6
- connection.tiers
7
- end
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
6
+
7
+ connection = Fog::Google::SQL.new
8
+
9
+ puts "Listing all Tiers..."
10
+ puts "--------------------"
11
+ connection.tiers
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "fog-xml", "~> 0.1.0"
27
27
 
28
28
  # Hard Requirement as of 1.0
29
- spec.add_dependency "google-api-client", "~> 0.23.0"
29
+ spec.add_dependency "google-api-client", ">= 0.32", "< 0.34"
30
30
 
31
31
  # Debugger
32
32
  spec.add_development_dependency "pry"
@@ -13,6 +13,7 @@ module Fog
13
13
  :google_client,
14
14
  :google_client_options,
15
15
  :google_extra_global_projects,
16
+ :google_exclude_projects,
16
17
  :google_key_location,
17
18
  :google_key_string,
18
19
  :google_json_key_location,
@@ -170,6 +171,7 @@ module Fog
170
171
  request :set_forwarding_rule_target
171
172
  request :set_global_forwarding_rule_target
172
173
  request :set_server_disk_auto_delete
174
+ request :set_server_machine_type
173
175
  request :set_server_metadata
174
176
  request :set_server_scheduling
175
177
  request :set_server_tags
@@ -212,6 +214,8 @@ module Fog
212
214
 
213
215
  request :deprecate_image
214
216
 
217
+ request :reset_windows_password
218
+
215
219
  model_path "fog/compute/google/models"
216
220
  model :server
217
221
  collection :servers
@@ -3,11 +3,12 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  include Fog::Google::Shared
6
- attr_reader :extra_global_projects
6
+ attr_reader :extra_global_projects, :exclude_projects
7
7
 
8
8
  def initialize(options)
9
9
  shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL)
10
10
  @extra_global_projects = options.fetch(:google_extra_global_projects, [])
11
+ @exclude_projects = options.fetch(:google_exclude_projects, [])
11
12
  end
12
13
 
13
14
  def self.data(api_version)
@@ -74,7 +74,15 @@ module Fog
74
74
 
75
75
  private
76
76
 
77
- def associate(nic_name, async = true)
77
+ # Associates the ip address to a given server
78
+ #
79
+ # @param [String] server - GCE instance name
80
+ # @param [String] nic_name - NIC interface name, defaults to GCE
81
+ # standard primary nic - "nic0"
82
+ # @param [Boolean] async - whether to run the operation asynchronously
83
+ #
84
+ # @return [Fog::Compute::Google::Operation]
85
+ def associate(server, nic_name = "nic0", async = false)
78
86
  requires :address
79
87
 
80
88
  data = service.add_server_access_config(
@@ -86,7 +94,12 @@ module Fog
86
94
  operation.wait_for { ready? } unless async
87
95
  end
88
96
 
89
- def disassociate
97
+ # Disassociates the ip address from a resource it's attached to
98
+ #
99
+ # @param [Boolean] async - whether to run the operation asynchronously
100
+ #
101
+ # @return [Fog::Compute::Google::Operation]
102
+ def disassociate(async = false)
90
103
  requires :address
91
104
 
92
105
  return nil if !in_use? || users.nil? || users.empty?
@@ -17,6 +17,9 @@ module Fog
17
17
  attribute :source_snapshot, :aliases => "sourceSnapshot"
18
18
  attribute :source_snapshot_id, :aliases => "sourceSnapshotId"
19
19
  attribute :type
20
+ attribute :labels
21
+ attribute :label_fingerprint, :aliases => "labelFingerprint"
22
+ attribute :users
20
23
 
21
24
  def default_description
22
25
  if !source_image.nil?
@@ -36,8 +39,9 @@ module Fog
36
39
  :type => type,
37
40
  :size_gb => size_gb,
38
41
  :source_image => source_image,
39
- :source_snapshot => source_snapshot
40
- }
42
+ :source_snapshot => source_snapshot,
43
+ :labels => labels
44
+ }.reject { |_, v| v.nil? }
41
45
 
42
46
  if options[:source_image]
43
47
  unless source_image.include?("projects/")
@@ -14,6 +14,7 @@ module Fog
14
14
  coreos-cloud
15
15
  debian-cloud
16
16
  rhel-cloud
17
+ rhel-sap-cloud
17
18
  suse-cloud
18
19
  suse-sap-cloud
19
20
  ubuntu-os-cloud
@@ -96,7 +97,11 @@ module Fog
96
97
 
97
98
  def all_projects
98
99
  # Search own project before global projects
99
- [service.project] + GLOBAL_PROJECTS + service.extra_global_projects
100
+ project_list = [service.project] + GLOBAL_PROJECTS + service.extra_global_projects
101
+ unless service.exclude_projects.empty?
102
+ project_list.delete_if { |project| service.exclude_projects.include?(project) }
103
+ end
104
+ project_list
100
105
  end
101
106
  end
102
107
  end
@@ -40,7 +40,7 @@ module Fog
40
40
  nil
41
41
  end
42
42
 
43
- # TODO: To be deprecated
43
+ # TODO(2.0): To be deprecated
44
44
  def add_instance(params)
45
45
  Fog::Logger.deprecation(
46
46
  "#{self.class}.#{__method__} is deprecated, use Fog::Compute::Google::InstanceGroup.#{__method__} instead [light_black](#{caller(0..0)})[/]"
@@ -49,7 +49,7 @@ module Fog
49
49
  service.add_instance_group_instances(params[:group], params[:zone], params[:instance])
50
50
  end
51
51
 
52
- # TODO: To be deprecated
52
+ # TODO(2.0): To be deprecated
53
53
  def remove_instance(params)
54
54
  Fog::Logger.deprecation(
55
55
  "#{self.class}.#{__method__} is deprecated, use Fog::Compute::Google::InstanceGroup.#{__method__} instead [light_black](#{caller(0..0)})[/]"
@@ -266,14 +266,13 @@ module Fog
266
266
  # @param async [TrueClass] execute the api call asynchronously
267
267
  # @param options [Hash]
268
268
  # @return [Object]
269
- # TODO: Figure out what options hash is for here.
270
- def attach_disk(disk, async = true, options = {})
269
+ def attach_disk(disk, async = true, attached_disk_options = {})
271
270
  requires :identity, :zone
272
271
 
273
272
  if disk.is_a? Disk
274
273
  disk_obj = disk.get_attached_disk
275
274
  elsif disk.is_a? String
276
- disk_obj = service.disks.attached_disk_obj(disk, options)
275
+ disk_obj = service.disks.attached_disk_obj(disk, attached_disk_options)
277
276
  end
278
277
 
279
278
  data = service.attach_disk(identity, zone_name, disk_obj)
@@ -344,10 +343,10 @@ module Fog
344
343
  operation
345
344
  end
346
345
 
347
- def serial_port_output
346
+ def serial_port_output(port: 1)
348
347
  requires :identity, :zone
349
348
 
350
- service.get_server_serial_port_output(identity, zone_name).to_h[:contents]
349
+ service.get_server_serial_port_output(identity, zone_name, :port => port).to_h[:contents]
351
350
  end
352
351
 
353
352
  def set_disk_auto_delete(auto_delete, device_name = nil, async = true)
@@ -415,6 +414,21 @@ module Fog
415
414
  reload
416
415
  end
417
416
 
417
+ def set_machine_type(new_machine_type, async = true)
418
+ requires :identity, :zone
419
+
420
+ raise Fog::Errors::Error.new("Instance must be stopped to change machine type") unless stopped?
421
+
422
+ data = service.set_server_machine_type(
423
+ identity, zone_name, new_machine_type
424
+ )
425
+ operation = Fog::Compute::Google::Operations
426
+ .new(:service => service)
427
+ .get(data.name, data.zone)
428
+ operation.wait_for { ready? } unless async
429
+ reload
430
+ end
431
+
418
432
  def set_tags(new_tags = [], async = true)
419
433
  requires :identity, :zone
420
434
 
@@ -554,13 +568,23 @@ module Fog
554
568
 
555
569
  ssh_keys = metadata_map["ssh-keys"] || metadata_map["sshKeys"] || ""
556
570
  ssh_keys += "\n" unless ssh_keys.empty?
557
- ssh_keys += "#{username}:#{key.strip}"
571
+ ssh_keys += "#{username}:#{ensure_key_comment(key, username)}"
558
572
 
559
573
  metadata_map["ssh-keys"] = ssh_keys
560
574
  metadata[:items] = metadata_to_item_list(metadata_map)
561
575
  metadata
562
576
  end
563
577
 
578
+ def ensure_key_comment(key, default_comment = "fog-user")
579
+ parts = key.strip.split
580
+ parts << default_comment if parts.size < 3
581
+ parts.join(" ")
582
+ end
583
+
584
+ def reset_windows_password(user)
585
+ service.reset_windows_password(:server => self, :user => user)
586
+ end
587
+
564
588
  private
565
589
 
566
590
  def metadata_to_item_list(metadata)
@@ -5,7 +5,7 @@ module Fog
5
5
  include Fog::Google::Shared
6
6
 
7
7
  attr_accessor :client
8
- attr_reader :compute, :extra_global_projects
8
+ attr_reader :compute, :extra_global_projects, :exclude_projects
9
9
 
10
10
  def initialize(options)
11
11
  shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL)
@@ -16,6 +16,7 @@ module Fog
16
16
  apply_client_options(@compute, options)
17
17
 
18
18
  @extra_global_projects = options[:google_extra_global_projects] || []
19
+ @exclude_projects = options[:google_exclude_projects] || []
19
20
  end
20
21
  end
21
22
  end
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def abandon_instances(_instance_group_manager, _instances)
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def add_backend_service_backends(_backend_service, _new_backends)
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def add_instance_group_instances(_group_name, _zone, _instances)
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def add_server_access_config(_identity, _zone, _nic, _options = {})
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def add_target_pool_health_checks(_target_pool, _region, _health_checks)
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def add_target_pool_instances(_target_pool, _region, _instances)
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def attach_disk(_instance, _zone, _disk = {})
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def create_disk_snapshot(_snapshot_name, _disk, _zone, _snapshot = {})
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11
 
@@ -3,7 +3,9 @@ module Fog
3
3
  class Google
4
4
  class Mock
5
5
  def delete_address(_address_name, _region_name)
6
+ # :no-coverage:
6
7
  Fog::Mock.not_implemented
8
+ # :no-coverage:
7
9
  end
8
10
  end
9
11