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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +40 -0
- data/README.md +1 -1
- data/SECURITY.md +16 -0
- data/ci/README.md +3 -2
- data/ci/build-head-pipeline.yml +173 -0
- data/ci/{pipeline.yml → integration-pipeline.yml} +0 -24
- data/ci/pipeline-dev.yml +58 -0
- data/ci/tasks/run-int.sh +20 -1
- data/ci/tasks/run-int.yml +2 -0
- data/examples/sql/flags.rb +10 -6
- data/examples/sql/instances.rb +38 -34
- data/examples/sql/operations.rb +20 -16
- data/examples/sql/ssl_certs.rb +32 -28
- data/examples/sql/tiers.rb +10 -6
- data/fog-google.gemspec +1 -1
- data/lib/fog/compute/google.rb +4 -0
- data/lib/fog/compute/google/mock.rb +2 -1
- data/lib/fog/compute/google/models/address.rb +15 -2
- data/lib/fog/compute/google/models/disk.rb +6 -2
- data/lib/fog/compute/google/models/images.rb +6 -1
- data/lib/fog/compute/google/models/instance_groups.rb +2 -2
- data/lib/fog/compute/google/models/server.rb +30 -6
- data/lib/fog/compute/google/real.rb +2 -1
- data/lib/fog/compute/google/requests/abandon_instances.rb +2 -0
- data/lib/fog/compute/google/requests/add_backend_service_backends.rb +2 -0
- data/lib/fog/compute/google/requests/add_instance_group_instances.rb +2 -0
- data/lib/fog/compute/google/requests/add_server_access_config.rb +2 -0
- data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +2 -0
- data/lib/fog/compute/google/requests/add_target_pool_instances.rb +2 -0
- data/lib/fog/compute/google/requests/attach_disk.rb +2 -0
- data/lib/fog/compute/google/requests/create_disk_snapshot.rb +2 -0
- data/lib/fog/compute/google/requests/delete_address.rb +2 -0
- data/lib/fog/compute/google/requests/delete_backend_service.rb +2 -0
- data/lib/fog/compute/google/requests/delete_disk.rb +2 -0
- data/lib/fog/compute/google/requests/delete_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/delete_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/delete_global_address.rb +2 -0
- data/lib/fog/compute/google/requests/delete_global_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/delete_global_operation.rb +2 -0
- data/lib/fog/compute/google/requests/delete_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/delete_image.rb +2 -0
- data/lib/fog/compute/google/requests/delete_instance_group.rb +2 -0
- data/lib/fog/compute/google/requests/delete_instance_group_manager.rb +2 -0
- data/lib/fog/compute/google/requests/delete_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/delete_network.rb +2 -0
- data/lib/fog/compute/google/requests/delete_region_operation.rb +2 -0
- data/lib/fog/compute/google/requests/delete_route.rb +2 -0
- data/lib/fog/compute/google/requests/delete_server.rb +2 -0
- data/lib/fog/compute/google/requests/delete_server_access_config.rb +2 -0
- data/lib/fog/compute/google/requests/delete_snapshot.rb +2 -0
- data/lib/fog/compute/google/requests/delete_ssl_certificate.rb +2 -0
- data/lib/fog/compute/google/requests/delete_subnetwork.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_http_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_https_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_instance.rb +2 -0
- data/lib/fog/compute/google/requests/delete_target_pool.rb +2 -0
- data/lib/fog/compute/google/requests/delete_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/delete_zone_operation.rb +2 -0
- data/lib/fog/compute/google/requests/deprecate_image.rb +2 -0
- data/lib/fog/compute/google/requests/detach_disk.rb +2 -0
- data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +2 -0
- data/lib/fog/compute/google/requests/get_address.rb +2 -0
- data/lib/fog/compute/google/requests/get_backend_service_health.rb +2 -0
- data/lib/fog/compute/google/requests/get_disk.rb +2 -0
- data/lib/fog/compute/google/requests/get_disk_type.rb +2 -0
- data/lib/fog/compute/google/requests/get_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/get_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/get_global_address.rb +2 -0
- data/lib/fog/compute/google/requests/get_global_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/get_global_operation.rb +2 -0
- data/lib/fog/compute/google/requests/get_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/get_image.rb +2 -0
- data/lib/fog/compute/google/requests/get_image_from_family.rb +2 -0
- data/lib/fog/compute/google/requests/get_instance_group.rb +2 -0
- data/lib/fog/compute/google/requests/get_instance_group_manager.rb +2 -0
- data/lib/fog/compute/google/requests/get_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/get_machine_type.rb +2 -0
- data/lib/fog/compute/google/requests/get_network.rb +2 -0
- data/lib/fog/compute/google/requests/get_project.rb +2 -0
- data/lib/fog/compute/google/requests/get_region.rb +2 -0
- data/lib/fog/compute/google/requests/get_route.rb +2 -0
- data/lib/fog/compute/google/requests/get_server.rb +2 -0
- data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +2 -0
- data/lib/fog/compute/google/requests/get_snapshot.rb +2 -0
- data/lib/fog/compute/google/requests/get_ssl_certificate.rb +2 -0
- data/lib/fog/compute/google/requests/get_subnetwork.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_http_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_https_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_instance.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_pool.rb +2 -0
- data/lib/fog/compute/google/requests/get_target_pool_health.rb +2 -0
- data/lib/fog/compute/google/requests/get_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/get_zone.rb +2 -0
- data/lib/fog/compute/google/requests/get_zone_operation.rb +2 -0
- data/lib/fog/compute/google/requests/insert_address.rb +2 -0
- data/lib/fog/compute/google/requests/insert_backend_service.rb +2 -0
- data/lib/fog/compute/google/requests/insert_disk.rb +8 -5
- data/lib/fog/compute/google/requests/insert_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/insert_global_address.rb +2 -0
- data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +2 -0
- data/lib/fog/compute/google/requests/insert_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/insert_image.rb +2 -0
- data/lib/fog/compute/google/requests/insert_instance_group.rb +2 -0
- data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +2 -0
- data/lib/fog/compute/google/requests/insert_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/insert_network.rb +2 -0
- data/lib/fog/compute/google/requests/insert_route.rb +2 -0
- data/lib/fog/compute/google/requests/insert_server.rb +2 -0
- data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +2 -0
- data/lib/fog/compute/google/requests/insert_subnetwork.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_instance.rb +2 -0
- data/lib/fog/compute/google/requests/insert_target_pool.rb +2 -0
- data/lib/fog/compute/google/requests/insert_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +2 -0
- data/lib/fog/compute/google/requests/list_addresses.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_disks.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_servers.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +2 -0
- data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +2 -0
- data/lib/fog/compute/google/requests/list_disk_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_disks.rb +2 -0
- data/lib/fog/compute/google/requests/list_firewalls.rb +2 -0
- data/lib/fog/compute/google/requests/list_forwarding_rules.rb +2 -0
- data/lib/fog/compute/google/requests/list_global_addresses.rb +2 -0
- data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +2 -0
- data/lib/fog/compute/google/requests/list_global_operations.rb +2 -0
- data/lib/fog/compute/google/requests/list_http_health_checks.rb +2 -0
- data/lib/fog/compute/google/requests/list_images.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_group_instances.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_group_managers.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_groups.rb +2 -0
- data/lib/fog/compute/google/requests/list_instance_templates.rb +2 -0
- data/lib/fog/compute/google/requests/list_machine_types.rb +2 -0
- data/lib/fog/compute/google/requests/list_networks.rb +2 -0
- data/lib/fog/compute/google/requests/list_region_operations.rb +2 -0
- data/lib/fog/compute/google/requests/list_regions.rb +2 -0
- data/lib/fog/compute/google/requests/list_routes.rb +2 -0
- data/lib/fog/compute/google/requests/list_servers.rb +2 -0
- data/lib/fog/compute/google/requests/list_snapshots.rb +2 -0
- data/lib/fog/compute/google/requests/list_ssl_certificates.rb +2 -0
- data/lib/fog/compute/google/requests/list_subnetworks.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_http_proxies.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_https_proxies.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_instances.rb +2 -0
- data/lib/fog/compute/google/requests/list_target_pools.rb +2 -0
- data/lib/fog/compute/google/requests/list_url_maps.rb +2 -0
- data/lib/fog/compute/google/requests/list_zone_operations.rb +2 -0
- data/lib/fog/compute/google/requests/list_zones.rb +2 -0
- data/lib/fog/compute/google/requests/patch_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/patch_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/recreate_instances.rb +2 -0
- data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +2 -0
- data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +2 -0
- data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +2 -0
- data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +2 -0
- data/lib/fog/compute/google/requests/reset_server.rb +2 -0
- data/lib/fog/compute/google/requests/reset_windows_password.rb +154 -0
- data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +2 -0
- data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +2 -0
- data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +2 -0
- data/lib/fog/compute/google/requests/set_instance_template.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_disk_auto_delete.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_machine_type.rb +23 -0
- data/lib/fog/compute/google/requests/set_server_metadata.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_scheduling.rb +2 -0
- data/lib/fog/compute/google/requests/set_server_tags.rb +2 -0
- data/lib/fog/compute/google/requests/set_snapshot_labels.rb +2 -0
- data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/set_target_pool_backup.rb +2 -0
- data/lib/fog/compute/google/requests/start_server.rb +2 -0
- data/lib/fog/compute/google/requests/stop_server.rb +2 -0
- data/lib/fog/compute/google/requests/update_firewall.rb +2 -0
- data/lib/fog/compute/google/requests/update_http_health_check.rb +2 -0
- data/lib/fog/compute/google/requests/update_url_map.rb +2 -0
- data/lib/fog/compute/google/requests/validate_url_map.rb +2 -0
- data/lib/fog/dns/google/requests/create_change.rb +2 -0
- data/lib/fog/dns/google/requests/create_managed_zone.rb +2 -0
- data/lib/fog/dns/google/requests/delete_managed_zone.rb +2 -0
- data/lib/fog/dns/google/requests/get_change.rb +2 -0
- data/lib/fog/dns/google/requests/get_managed_zone.rb +2 -0
- data/lib/fog/dns/google/requests/get_project.rb +2 -0
- data/lib/fog/dns/google/requests/list_changes.rb +2 -0
- data/lib/fog/dns/google/requests/list_managed_zones.rb +2 -0
- data/lib/fog/dns/google/requests/list_resource_record_sets.rb +2 -0
- data/lib/fog/google/models/sql/ssl_cert.rb +7 -1
- data/lib/fog/google/models/sql/user.rb +2 -0
- data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +2 -0
- data/lib/fog/google/requests/monitoring/create_timeseries.rb +3 -1
- data/lib/fog/google/requests/monitoring/delete_metric_descriptor.rb +2 -0
- data/lib/fog/google/requests/monitoring/get_metric_descriptor.rb +2 -0
- data/lib/fog/google/requests/monitoring/list_monitored_resource_descriptors.rb +2 -0
- data/lib/fog/google/requests/monitoring/list_timeseries.rb +2 -0
- data/lib/fog/google/requests/sql/clone_instance.rb +2 -0
- data/lib/fog/google/requests/sql/delete_backup_run.rb +2 -0
- data/lib/fog/google/requests/sql/delete_instance.rb +2 -0
- data/lib/fog/google/requests/sql/delete_ssl_cert.rb +2 -0
- data/lib/fog/google/requests/sql/delete_user.rb +2 -0
- data/lib/fog/google/requests/sql/export_instance.rb +2 -0
- data/lib/fog/google/requests/sql/get_backup_run.rb +2 -0
- data/lib/fog/google/requests/sql/get_instance.rb +2 -0
- data/lib/fog/google/requests/sql/get_operation.rb +2 -0
- data/lib/fog/google/requests/sql/get_ssl_cert.rb +2 -0
- data/lib/fog/google/requests/sql/import_instance.rb +2 -0
- data/lib/fog/google/requests/sql/insert_backup_run.rb +2 -0
- data/lib/fog/google/requests/sql/insert_instance.rb +2 -0
- data/lib/fog/google/requests/sql/insert_ssl_cert.rb +2 -0
- data/lib/fog/google/requests/sql/insert_user.rb +2 -0
- data/lib/fog/google/requests/sql/list_backup_runs.rb +2 -0
- data/lib/fog/google/requests/sql/list_flags.rb +2 -0
- data/lib/fog/google/requests/sql/list_instances.rb +2 -0
- data/lib/fog/google/requests/sql/list_operations.rb +2 -0
- data/lib/fog/google/requests/sql/list_ssl_certs.rb +2 -0
- data/lib/fog/google/requests/sql/list_tiers.rb +2 -0
- data/lib/fog/google/requests/sql/list_users.rb +2 -0
- data/lib/fog/google/requests/sql/reset_instance_ssl_config.rb +2 -0
- data/lib/fog/google/requests/sql/restart_instance.rb +2 -0
- data/lib/fog/google/requests/sql/restore_instance_backup.rb +2 -0
- data/lib/fog/google/requests/sql/update_instance.rb +2 -0
- data/lib/fog/google/requests/sql/update_user.rb +2 -0
- data/lib/fog/google/version.rb +1 -1
- data/lib/fog/storage/google_json/requests/copy_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/delete_bucket.rb +2 -0
- data/lib/fog/storage/google_json/requests/delete_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_bucket.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_bucket_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_object_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/get_object_metadata.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_bucket_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_buckets.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_object_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/list_objects.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_bucket.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_object.rb +2 -0
- data/lib/fog/storage/google_json/requests/put_object_acl.rb +2 -0
- data/lib/fog/storage/google_xml/requests/put_bucket_acl.rb +2 -0
- data/tasks/test.rake +6 -2
- data/test/helpers/integration_test_helper.rb +2 -5
- data/test/helpers/test_helper.rb +1 -0
- data/test/integration/compute/core_compute/test_servers.rb +40 -0
- data/test/integration/compute/core_compute/test_zones.rb +1 -1
- data/test/integration/compute/core_networking/test_addresses.rb +23 -0
- data/test/integration/factories/{sql_v1_certs_factory.rb → sql_certs_factory.rb} +3 -3
- data/test/integration/factories/{sql_v1_instances_factory.rb → sql_instances_factory.rb} +3 -3
- data/test/integration/factories/{sql_v1_users_factory.rb → sql_users_factory.rb} +6 -3
- data/test/integration/monitoring/test_metric_descriptors.rb +2 -0
- data/test/integration/monitoring/test_timeseries.rb +3 -1
- data/test/integration/sql/{sqlv1/test_v1_certs.rb → test_certs.rb} +4 -3
- data/test/integration/sql/{sqlv1/test_common_flags.rb → test_common_flags.rb} +0 -0
- data/test/integration/sql/{sqlv1/test_common_tiers.rb → test_common_tiers.rb} +0 -0
- data/test/integration/sql/{sqlv1/test_coverage.rb → test_coverage.rb} +1 -1
- data/test/integration/sql/{sqlv2/test_v2_instances.rb → test_instances.rb} +22 -2
- data/test/integration/sql/{sqlv1/test_v1_users.rb → test_users.rb} +4 -4
- metadata +37 -32
- data/test/integration/factories/sql_v2_instances_factory.rb +0 -19
- data/test/integration/sql/sqlv1/test_v1_instances.rb +0 -31
- data/test/integration/sql/sqlv2/test_coverage.rb +0 -6
data/examples/sql/operations.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
|
-
|
2
|
-
|
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
|
-
|
5
|
-
|
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
|
-
|
10
|
-
puts "----------------------"
|
11
|
-
operation = instance.destroy
|
7
|
+
connection = Fog::Google::SQL.new
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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)
|
data/examples/sql/ssl_certs.rb
CHANGED
@@ -1,28 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
data/examples/sql/tiers.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
|
2
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
data/fog-google.gemspec
CHANGED
@@ -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", "
|
29
|
+
spec.add_dependency "google-api-client", ">= 0.32", "< 0.34"
|
30
30
|
|
31
31
|
# Debugger
|
32
32
|
spec.add_development_dependency "pry"
|
data/lib/fog/compute/google.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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,
|
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
|
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
|