fog-google 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +17 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +41 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +55 -0
- data/Rakefile +34 -0
- data/examples/backend_services.rb +22 -0
- data/examples/bootstrap.rb +9 -0
- data/examples/create.rb +49 -0
- data/examples/dns/project.rb +8 -0
- data/examples/dns/zones.rb +43 -0
- data/examples/eric-fail.rb +36 -0
- data/examples/get_list_images.rb +26 -0
- data/examples/get_list_snapshots.rb +18 -0
- data/examples/image_all.rb +6 -0
- data/examples/image_create.rb +17 -0
- data/examples/l7_load_balance.rb +73 -0
- data/examples/launch_micro_instance.rb +29 -0
- data/examples/load-balance.rb +98 -0
- data/examples/metadata.rb +30 -0
- data/examples/monitoring/metric_descriptors.rb +11 -0
- data/examples/monitoring/timeseries_collection.rb +15 -0
- data/examples/monitoring/timeseries_descriptors.rb +15 -0
- data/examples/network.rb +38 -0
- data/examples/precreated_client.rb +14 -0
- data/examples/sql/flags.rb +7 -0
- data/examples/sql/instances.rb +38 -0
- data/examples/sql/operations.rb +20 -0
- data/examples/sql/ssl_certs.rb +28 -0
- data/examples/sql/tiers.rb +7 -0
- data/fog-google.gemspec +37 -0
- data/gemfiles/Gemfile.1.9.2+ +6 -0
- data/gemfiles/Gemfile.1.9.2- +9 -0
- data/lib/fog/bin/google.rb +88 -0
- data/lib/fog/google.rb +226 -0
- data/lib/fog/google/compute.rb +1068 -0
- data/lib/fog/google/dns.rb +96 -0
- data/lib/fog/google/models/compute/address.rb +94 -0
- data/lib/fog/google/models/compute/addresses.rb +40 -0
- data/lib/fog/google/models/compute/backend_service.rb +92 -0
- data/lib/fog/google/models/compute/backend_services.rb +22 -0
- data/lib/fog/google/models/compute/disk.rb +120 -0
- data/lib/fog/google/models/compute/disk_type.rb +28 -0
- data/lib/fog/google/models/compute/disk_types.rb +40 -0
- data/lib/fog/google/models/compute/disks.rb +41 -0
- data/lib/fog/google/models/compute/firewall.rb +46 -0
- data/lib/fog/google/models/compute/firewalls.rb +25 -0
- data/lib/fog/google/models/compute/flavor.rb +33 -0
- data/lib/fog/google/models/compute/flavors.rb +31 -0
- data/lib/fog/google/models/compute/forwarding_rule.rb +86 -0
- data/lib/fog/google/models/compute/forwarding_rules.rb +41 -0
- data/lib/fog/google/models/compute/global_forwarding_rule.rb +86 -0
- data/lib/fog/google/models/compute/global_forwarding_rules.rb +23 -0
- data/lib/fog/google/models/compute/http_health_check.rb +84 -0
- data/lib/fog/google/models/compute/http_health_checks.rb +26 -0
- data/lib/fog/google/models/compute/image.rb +90 -0
- data/lib/fog/google/models/compute/images.rb +73 -0
- data/lib/fog/google/models/compute/network.rb +43 -0
- data/lib/fog/google/models/compute/networks.rb +25 -0
- data/lib/fog/google/models/compute/operation.rb +75 -0
- data/lib/fog/google/models/compute/operations.rb +37 -0
- data/lib/fog/google/models/compute/project.rb +30 -0
- data/lib/fog/google/models/compute/projects.rb +20 -0
- data/lib/fog/google/models/compute/region.rb +32 -0
- data/lib/fog/google/models/compute/regions.rb +25 -0
- data/lib/fog/google/models/compute/resource_view.rb +116 -0
- data/lib/fog/google/models/compute/resource_views.rb +57 -0
- data/lib/fog/google/models/compute/route.rb +50 -0
- data/lib/fog/google/models/compute/routes.rb +25 -0
- data/lib/fog/google/models/compute/server.rb +258 -0
- data/lib/fog/google/models/compute/servers.rb +80 -0
- data/lib/fog/google/models/compute/snapshot.rb +48 -0
- data/lib/fog/google/models/compute/snapshots.rb +26 -0
- data/lib/fog/google/models/compute/target_http_proxies.rb +22 -0
- data/lib/fog/google/models/compute/target_http_proxy.rb +75 -0
- data/lib/fog/google/models/compute/target_instance.rb +74 -0
- data/lib/fog/google/models/compute/target_instances.rb +28 -0
- data/lib/fog/google/models/compute/target_pool.rb +113 -0
- data/lib/fog/google/models/compute/target_pools.rb +41 -0
- data/lib/fog/google/models/compute/url_map.rb +95 -0
- data/lib/fog/google/models/compute/url_maps.rb +22 -0
- data/lib/fog/google/models/compute/zone.rb +23 -0
- data/lib/fog/google/models/compute/zones.rb +24 -0
- data/lib/fog/google/models/dns/change.rb +40 -0
- data/lib/fog/google/models/dns/changes.rb +52 -0
- data/lib/fog/google/models/dns/project.rb +75 -0
- data/lib/fog/google/models/dns/projects.rb +25 -0
- data/lib/fog/google/models/dns/record.rb +112 -0
- data/lib/fog/google/models/dns/records.rb +52 -0
- data/lib/fog/google/models/dns/zone.rb +74 -0
- data/lib/fog/google/models/dns/zones.rb +34 -0
- data/lib/fog/google/models/monitoring/metric_descriptor.rb +20 -0
- data/lib/fog/google/models/monitoring/metric_descriptors.rb +28 -0
- data/lib/fog/google/models/monitoring/timeseries.rb +17 -0
- data/lib/fog/google/models/monitoring/timeseries_collection.rb +31 -0
- data/lib/fog/google/models/monitoring/timeseries_descriptor.rb +20 -0
- data/lib/fog/google/models/monitoring/timeseries_descriptors.rb +31 -0
- data/lib/fog/google/models/sql/backup_run.rb +34 -0
- data/lib/fog/google/models/sql/backup_runs.rb +38 -0
- data/lib/fog/google/models/sql/flag.rb +22 -0
- data/lib/fog/google/models/sql/flags.rb +21 -0
- data/lib/fog/google/models/sql/instance.rb +353 -0
- data/lib/fog/google/models/sql/instances.rb +39 -0
- data/lib/fog/google/models/sql/operation.rb +61 -0
- data/lib/fog/google/models/sql/operations.rb +49 -0
- data/lib/fog/google/models/sql/ssl_cert.rb +73 -0
- data/lib/fog/google/models/sql/ssl_certs.rb +49 -0
- data/lib/fog/google/models/sql/tier.rb +20 -0
- data/lib/fog/google/models/sql/tiers.rb +21 -0
- data/lib/fog/google/models/storage/directories.rb +39 -0
- data/lib/fog/google/models/storage/directory.rb +74 -0
- data/lib/fog/google/models/storage/file.rb +144 -0
- data/lib/fog/google/models/storage/files.rb +104 -0
- data/lib/fog/google/monitoring.rb +87 -0
- data/lib/fog/google/parsers/storage/access_control_list.rb +44 -0
- data/lib/fog/google/parsers/storage/copy_object.rb +18 -0
- data/lib/fog/google/parsers/storage/get_bucket.rb +58 -0
- data/lib/fog/google/parsers/storage/get_bucket_logging.rb +36 -0
- data/lib/fog/google/parsers/storage/get_bucket_object_versions.rb +84 -0
- data/lib/fog/google/parsers/storage/get_bucket_versioning.rb +20 -0
- data/lib/fog/google/parsers/storage/get_request_payment.rb +16 -0
- data/lib/fog/google/parsers/storage/get_service.rb +28 -0
- data/lib/fog/google/requests/compute/add_backend_service_backends.rb +29 -0
- data/lib/fog/google/requests/compute/add_region_view_resources.rb +27 -0
- data/lib/fog/google/requests/compute/add_server_access_config.rb +32 -0
- data/lib/fog/google/requests/compute/add_target_pool_health_checks.rb +27 -0
- data/lib/fog/google/requests/compute/add_target_pool_instances.rb +27 -0
- data/lib/fog/google/requests/compute/add_url_map_host_rules.rb +25 -0
- data/lib/fog/google/requests/compute/add_url_map_path_matchers.rb +29 -0
- data/lib/fog/google/requests/compute/add_zone_view_resources.rb +27 -0
- data/lib/fog/google/requests/compute/attach_disk.rb +34 -0
- data/lib/fog/google/requests/compute/delete_address.rb +24 -0
- data/lib/fog/google/requests/compute/delete_backend_service.rb +43 -0
- data/lib/fog/google/requests/compute/delete_disk.rb +48 -0
- data/lib/fog/google/requests/compute/delete_firewall.rb +23 -0
- data/lib/fog/google/requests/compute/delete_forwarding_rule.rb +49 -0
- data/lib/fog/google/requests/compute/delete_global_forwarding_rule.rb +48 -0
- data/lib/fog/google/requests/compute/delete_global_operation.rb +25 -0
- data/lib/fog/google/requests/compute/delete_http_health_check.rb +41 -0
- data/lib/fog/google/requests/compute/delete_image.rb +42 -0
- data/lib/fog/google/requests/compute/delete_network.rb +23 -0
- data/lib/fog/google/requests/compute/delete_region_operation.rb +29 -0
- data/lib/fog/google/requests/compute/delete_region_view.rb +24 -0
- data/lib/fog/google/requests/compute/delete_route.rb +23 -0
- data/lib/fog/google/requests/compute/delete_server.rb +69 -0
- data/lib/fog/google/requests/compute/delete_server_access_config.rb +26 -0
- data/lib/fog/google/requests/compute/delete_snapshot.rb +23 -0
- data/lib/fog/google/requests/compute/delete_target_http_proxy.rb +43 -0
- data/lib/fog/google/requests/compute/delete_target_instance.rb +48 -0
- data/lib/fog/google/requests/compute/delete_target_pool.rb +49 -0
- data/lib/fog/google/requests/compute/delete_url_map.rb +43 -0
- data/lib/fog/google/requests/compute/delete_zone_operation.rb +29 -0
- data/lib/fog/google/requests/compute/delete_zone_view.rb +24 -0
- data/lib/fog/google/requests/compute/detach_disk.rb +25 -0
- data/lib/fog/google/requests/compute/get_address.rb +24 -0
- data/lib/fog/google/requests/compute/get_backend_service.rb +26 -0
- data/lib/fog/google/requests/compute/get_backend_service_health.rb +27 -0
- data/lib/fog/google/requests/compute/get_backend_services.rb +23 -0
- data/lib/fog/google/requests/compute/get_disk.rb +52 -0
- data/lib/fog/google/requests/compute/get_disk_type.rb +42 -0
- data/lib/fog/google/requests/compute/get_firewall.rb +23 -0
- data/lib/fog/google/requests/compute/get_forwarding_rule.rb +46 -0
- data/lib/fog/google/requests/compute/get_global_forwarding_rule.rb +32 -0
- data/lib/fog/google/requests/compute/get_global_operation.rb +50 -0
- data/lib/fog/google/requests/compute/get_http_health_check.rb +39 -0
- data/lib/fog/google/requests/compute/get_image.rb +36 -0
- data/lib/fog/google/requests/compute/get_machine_type.rb +43 -0
- data/lib/fog/google/requests/compute/get_network.rb +23 -0
- data/lib/fog/google/requests/compute/get_project.rb +22 -0
- data/lib/fog/google/requests/compute/get_region.rb +37 -0
- data/lib/fog/google/requests/compute/get_region_operation.rb +55 -0
- data/lib/fog/google/requests/compute/get_region_view.rb +24 -0
- data/lib/fog/google/requests/compute/get_route.rb +23 -0
- data/lib/fog/google/requests/compute/get_server.rb +75 -0
- data/lib/fog/google/requests/compute/get_server_serial_port_output.rb +24 -0
- data/lib/fog/google/requests/compute/get_snapshot.rb +27 -0
- data/lib/fog/google/requests/compute/get_target_http_proxy.rb +27 -0
- data/lib/fog/google/requests/compute/get_target_instance.rb +32 -0
- data/lib/fog/google/requests/compute/get_target_pool.rb +40 -0
- data/lib/fog/google/requests/compute/get_target_pool_health.rb +29 -0
- data/lib/fog/google/requests/compute/get_url_map.rb +27 -0
- data/lib/fog/google/requests/compute/get_zone.rb +36 -0
- data/lib/fog/google/requests/compute/get_zone_operation.rb +55 -0
- data/lib/fog/google/requests/compute/get_zone_view.rb +24 -0
- data/lib/fog/google/requests/compute/insert_address.rb +25 -0
- data/lib/fog/google/requests/compute/insert_backend_service.rb +63 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +113 -0
- data/lib/fog/google/requests/compute/insert_firewall.rb +43 -0
- data/lib/fog/google/requests/compute/insert_forwarding_rule.rb +60 -0
- data/lib/fog/google/requests/compute/insert_global_forwarding_rule.rb +56 -0
- data/lib/fog/google/requests/compute/insert_http_health_check.rb +59 -0
- data/lib/fog/google/requests/compute/insert_image.rb +64 -0
- data/lib/fog/google/requests/compute/insert_network.rb +29 -0
- data/lib/fog/google/requests/compute/insert_region_view.rb +25 -0
- data/lib/fog/google/requests/compute/insert_route.rb +35 -0
- data/lib/fog/google/requests/compute/insert_server.rb +191 -0
- data/lib/fog/google/requests/compute/insert_snapshot.rb +40 -0
- data/lib/fog/google/requests/compute/insert_target_http_proxy.rb +52 -0
- data/lib/fog/google/requests/compute/insert_target_instance.rb +55 -0
- data/lib/fog/google/requests/compute/insert_target_pool.rb +58 -0
- data/lib/fog/google/requests/compute/insert_url_map.rb +55 -0
- data/lib/fog/google/requests/compute/insert_zone_view.rb +27 -0
- data/lib/fog/google/requests/compute/list_addresses.rb +23 -0
- data/lib/fog/google/requests/compute/list_aggregated_addresses.rb +23 -0
- data/lib/fog/google/requests/compute/list_aggregated_disk_types.rb +40 -0
- data/lib/fog/google/requests/compute/list_aggregated_disks.rb +40 -0
- data/lib/fog/google/requests/compute/list_aggregated_machine_types.rb +22 -0
- data/lib/fog/google/requests/compute/list_aggregated_servers.rb +40 -0
- data/lib/fog/google/requests/compute/list_backend_services.rb +29 -0
- data/lib/fog/google/requests/compute/list_disk_types.rb +46 -0
- data/lib/fog/google/requests/compute/list_disks.rb +29 -0
- data/lib/fog/google/requests/compute/list_firewalls.rb +22 -0
- data/lib/fog/google/requests/compute/list_forwarding_rules.rb +29 -0
- data/lib/fog/google/requests/compute/list_global_forwarding_rules.rb +30 -0
- data/lib/fog/google/requests/compute/list_global_operations.rb +24 -0
- data/lib/fog/google/requests/compute/list_http_health_checks.rb +29 -0
- data/lib/fog/google/requests/compute/list_images.rb +29 -0
- data/lib/fog/google/requests/compute/list_machine_types.rb +30 -0
- data/lib/fog/google/requests/compute/list_networks.rb +22 -0
- data/lib/fog/google/requests/compute/list_region_operations.rb +25 -0
- data/lib/fog/google/requests/compute/list_region_view_resources.rb +25 -0
- data/lib/fog/google/requests/compute/list_region_views.rb +23 -0
- data/lib/fog/google/requests/compute/list_regions.rb +85 -0
- data/lib/fog/google/requests/compute/list_routes.rb +22 -0
- data/lib/fog/google/requests/compute/list_servers.rb +31 -0
- data/lib/fog/google/requests/compute/list_snapshots.rb +23 -0
- data/lib/fog/google/requests/compute/list_target_http_proxies.rb +30 -0
- data/lib/fog/google/requests/compute/list_target_instances.rb +30 -0
- data/lib/fog/google/requests/compute/list_target_pools.rb +29 -0
- data/lib/fog/google/requests/compute/list_url_maps.rb +29 -0
- data/lib/fog/google/requests/compute/list_zone_operations.rb +25 -0
- data/lib/fog/google/requests/compute/list_zone_view_resources.rb +25 -0
- data/lib/fog/google/requests/compute/list_zone_views.rb +23 -0
- data/lib/fog/google/requests/compute/list_zones.rb +28 -0
- data/lib/fog/google/requests/compute/remove_target_pool_health_checks.rb +27 -0
- data/lib/fog/google/requests/compute/remove_target_pool_instance.rb +27 -0
- data/lib/fog/google/requests/compute/remove_target_pool_instances.rb +27 -0
- data/lib/fog/google/requests/compute/reset_server.rb +24 -0
- data/lib/fog/google/requests/compute/set_common_instance_metadata.rb +26 -0
- data/lib/fog/google/requests/compute/set_forwarding_rule_target.rb +27 -0
- data/lib/fog/google/requests/compute/set_global_forwarding_rule_target.rb +27 -0
- data/lib/fog/google/requests/compute/set_metadata.rb +39 -0
- data/lib/fog/google/requests/compute/set_server_disk_auto_delete.rb +26 -0
- data/lib/fog/google/requests/compute/set_server_scheduling.rb +29 -0
- data/lib/fog/google/requests/compute/set_tags.rb +24 -0
- data/lib/fog/google/requests/compute/set_target_http_proxy_url_map.rb +27 -0
- data/lib/fog/google/requests/compute/start_server.rb +24 -0
- data/lib/fog/google/requests/compute/stop_server.rb +24 -0
- data/lib/fog/google/requests/compute/update_url_map.rb +39 -0
- data/lib/fog/google/requests/compute/validate_url_map.rb +24 -0
- data/lib/fog/google/requests/dns/create_change.rb +64 -0
- data/lib/fog/google/requests/dns/create_managed_zone.rb +82 -0
- data/lib/fog/google/requests/dns/delete_managed_zone.rb +35 -0
- data/lib/fog/google/requests/dns/get_change.rb +42 -0
- data/lib/fog/google/requests/dns/get_managed_zone.rb +37 -0
- data/lib/fog/google/requests/dns/get_project.rb +42 -0
- data/lib/fog/google/requests/dns/list_changes.rb +41 -0
- data/lib/fog/google/requests/dns/list_managed_zones.rb +31 -0
- data/lib/fog/google/requests/dns/list_resource_record_sets.rb +50 -0
- data/lib/fog/google/requests/monitoring/list_metric_descriptors.rb +191 -0
- data/lib/fog/google/requests/monitoring/list_timeseries.rb +68 -0
- data/lib/fog/google/requests/monitoring/list_timeseries_descriptors.rb +87 -0
- data/lib/fog/google/requests/sql/clone_instance.rb +84 -0
- data/lib/fog/google/requests/sql/delete_instance.rb +67 -0
- data/lib/fog/google/requests/sql/delete_ssl_cert.rb +68 -0
- data/lib/fog/google/requests/sql/export_instance.rb +56 -0
- data/lib/fog/google/requests/sql/get_backup_run.rb +30 -0
- data/lib/fog/google/requests/sql/get_instance.rb +48 -0
- data/lib/fog/google/requests/sql/get_operation.rb +66 -0
- data/lib/fog/google/requests/sql/get_ssl_cert.rb +66 -0
- data/lib/fog/google/requests/sql/import_instance.rb +55 -0
- data/lib/fog/google/requests/sql/insert_instance.rb +165 -0
- data/lib/fog/google/requests/sql/insert_ssl_cert.rb +80 -0
- data/lib/fog/google/requests/sql/list_backup_runs.rb +30 -0
- data/lib/fog/google/requests/sql/list_flags.rb +143 -0
- data/lib/fog/google/requests/sql/list_instances.rb +32 -0
- data/lib/fog/google/requests/sql/list_operations.rb +52 -0
- data/lib/fog/google/requests/sql/list_ssl_certs.rb +51 -0
- data/lib/fog/google/requests/sql/list_tiers.rb +82 -0
- data/lib/fog/google/requests/sql/reset_instance_ssl_config.rb +49 -0
- data/lib/fog/google/requests/sql/restart_instance.rb +47 -0
- data/lib/fog/google/requests/sql/restore_instance_backup.rb +30 -0
- data/lib/fog/google/requests/sql/set_instance_root_password.rb +54 -0
- data/lib/fog/google/requests/sql/update_instance.rb +132 -0
- data/lib/fog/google/requests/storage/copy_object.rb +68 -0
- data/lib/fog/google/requests/storage/delete_bucket.rb +41 -0
- data/lib/fog/google/requests/storage/delete_object.rb +46 -0
- data/lib/fog/google/requests/storage/get_bucket.rb +106 -0
- data/lib/fog/google/requests/storage/get_bucket_acl.rb +59 -0
- data/lib/fog/google/requests/storage/get_object.rb +108 -0
- data/lib/fog/google/requests/storage/get_object_acl.rb +70 -0
- data/lib/fog/google/requests/storage/get_object_http_url.rb +44 -0
- data/lib/fog/google/requests/storage/get_object_https_url.rb +44 -0
- data/lib/fog/google/requests/storage/get_object_torrent.rb +45 -0
- data/lib/fog/google/requests/storage/get_object_url.rb +33 -0
- data/lib/fog/google/requests/storage/get_service.rb +48 -0
- data/lib/fog/google/requests/storage/head_object.rb +60 -0
- data/lib/fog/google/requests/storage/put_bucket.rb +71 -0
- data/lib/fog/google/requests/storage/put_bucket_acl.rb +58 -0
- data/lib/fog/google/requests/storage/put_object.rb +89 -0
- data/lib/fog/google/requests/storage/put_object_acl.rb +51 -0
- data/lib/fog/google/requests/storage/put_object_url.rb +50 -0
- data/lib/fog/google/sql.rb +130 -0
- data/lib/fog/google/storage.rb +298 -0
- data/lib/fog/google/version.rb +5 -0
- data/spec/minitest_helper.rb +31 -0
- data/tests/credentials_tests.rb +73 -0
- data/tests/helper.rb +126 -0
- data/tests/helpers/collection_helper.rb +97 -0
- data/tests/helpers/compute/flavors_helper.rb +32 -0
- data/tests/helpers/compute/server_helper.rb +25 -0
- data/tests/helpers/compute/servers_helper.rb +10 -0
- data/tests/helpers/formats_helper.rb +98 -0
- data/tests/helpers/formats_helper_tests.rb +110 -0
- data/tests/helpers/mock_helper.rb +18 -0
- data/tests/helpers/model_helper.rb +31 -0
- data/tests/helpers/responds_to_helper.rb +11 -0
- data/tests/helpers/schema_validator_tests.rb +107 -0
- data/tests/helpers/succeeds_helper.rb +9 -0
- data/tests/lorem.txt +1 -0
- data/tests/models/compute/backend_service_tests.rb +6 -0
- data/tests/models/compute/backend_services_tests.rb +8 -0
- data/tests/models/compute/disk_tests.rb +9 -0
- data/tests/models/compute/disk_types_tests.rb +22 -0
- data/tests/models/compute/disks_tests.rb +9 -0
- data/tests/models/compute/forwarding_rule_tests.rb +8 -0
- data/tests/models/compute/forwarding_rules_tests.rb +8 -0
- data/tests/models/compute/global_forwarding_rule_tests.rb +7 -0
- data/tests/models/compute/global_forwarding_rules_tests.rb +7 -0
- data/tests/models/compute/http_health_check_tests.rb +5 -0
- data/tests/models/compute/http_health_checks_tests.rb +5 -0
- data/tests/models/compute/image_tests.rb +6 -0
- data/tests/models/compute/images_tests.rb +6 -0
- data/tests/models/compute/region_tests.rb +10 -0
- data/tests/models/compute/regions_tests.rb +19 -0
- data/tests/models/compute/server_tests.rb +37 -0
- data/tests/models/compute/servers_tests.rb +14 -0
- data/tests/models/compute/target_http_proxies_tests.rb +7 -0
- data/tests/models/compute/target_http_proxy_test.rb +6 -0
- data/tests/models/compute/target_instance_tests.rb +7 -0
- data/tests/models/compute/target_instances_tests.rb +7 -0
- data/tests/models/compute/target_pool_tests.rb +12 -0
- data/tests/models/compute/target_pools_tests.rb +11 -0
- data/tests/models/compute/url_map_tests.rb +6 -0
- data/tests/models/compute/url_maps_tests.rb +7 -0
- data/tests/models/dns/change_tests.rb +28 -0
- data/tests/models/dns/changes_tests.rb +36 -0
- data/tests/models/dns/projects_tests.rb +12 -0
- data/tests/models/dns/record_tests.rb +42 -0
- data/tests/models/dns/records_tests.rb +36 -0
- data/tests/models/dns/zone_tests.rb +28 -0
- data/tests/models/dns/zones_tests.rb +14 -0
- data/tests/models/monitoring/metric_descriptors_tests.rb +12 -0
- data/tests/models/monitoring/timeseries_collection_tests.rb +12 -0
- data/tests/models/monitoring/timeseries_descriptors_tests.rb +13 -0
- data/tests/models/sql/flags_tests.rb +12 -0
- data/tests/models/sql/instance_tests.rb +56 -0
- data/tests/models/sql/instances_tests.rb +32 -0
- data/tests/models/sql/operation_tests.rb +25 -0
- data/tests/models/sql/operations_tests.rb +38 -0
- data/tests/models/sql/ssl_cert_tests.rb +24 -0
- data/tests/models/sql/ssl_certs_tests.rb +39 -0
- data/tests/models/sql/tiers_tests.rb +12 -0
- data/tests/requests/compute/backend_service_tests.rb +83 -0
- data/tests/requests/compute/disk_tests.rb +74 -0
- data/tests/requests/compute/disk_type_tests.rb +45 -0
- data/tests/requests/compute/firewall_tests.rb +88 -0
- data/tests/requests/compute/forwarding_rules_tests.rb +83 -0
- data/tests/requests/compute/global_forwarding_rules_tests.rb +83 -0
- data/tests/requests/compute/http_health_checks_tests.rb +83 -0
- data/tests/requests/compute/image_tests.rb +83 -0
- data/tests/requests/compute/network_tests.rb +75 -0
- data/tests/requests/compute/operation_tests.rb +20 -0
- data/tests/requests/compute/region_tests.rb +39 -0
- data/tests/requests/compute/server_tests.rb +84 -0
- data/tests/requests/compute/target_http_proxies_test.rb +79 -0
- data/tests/requests/compute/target_instances_tests.rb +83 -0
- data/tests/requests/compute/target_pools_tests.rb +82 -0
- data/tests/requests/compute/url_maps_tests.rb +82 -0
- data/tests/requests/compute/zone_tests.rb +37 -0
- data/tests/requests/dns/change_tests.rb +86 -0
- data/tests/requests/dns/managed_zone_tests.rb +66 -0
- data/tests/requests/dns/project_tests.rb +29 -0
- data/tests/requests/dns/record_tests.rb +49 -0
- data/tests/requests/monitoring/metric_descriptor_tests.rb +25 -0
- data/tests/requests/monitoring/timeseries_collection_tests.rb +25 -0
- data/tests/requests/monitoring/timeseries_descriptor_tests.rb +26 -0
- data/tests/requests/sql/flag_tests.rb +27 -0
- data/tests/requests/sql/instance_tests.rb +129 -0
- data/tests/requests/sql/operation_tests.rb +42 -0
- data/tests/requests/sql/ssl_cert_tests.rb +61 -0
- data/tests/requests/sql/tier_tests.rb +25 -0
- data/tests/requests/storage/bucket_tests.rb +77 -0
- data/tests/requests/storage/object_tests.rb +84 -0
- metadata +625 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
def test
|
2
|
+
connection = Fog::Google::SQL.new
|
3
|
+
|
4
|
+
puts 'Create a Instance...'
|
5
|
+
puts '--------------------'
|
6
|
+
instance = connection.instances.create(:instance => 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.instance, :common_name => Fog::Mock.random_letters(16))
|
12
|
+
|
13
|
+
puts 'Get the SSL certificate...'
|
14
|
+
puts '--------------------------'
|
15
|
+
connection.ssl_certs.get(instance.instance, ssl_cert.sha1_fingerprint)
|
16
|
+
|
17
|
+
puts 'List all SSL certificate...'
|
18
|
+
puts '---------------------------'
|
19
|
+
connection.ssl_certs.all(instance.instance)
|
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
|
data/fog-google.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fog/google/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fog-google"
|
8
|
+
spec.version = Fog::Google::VERSION
|
9
|
+
spec.authors = ["Nat Welch", "Daniel Broudy", "Isaac Hollander McCreery"]
|
10
|
+
spec.email = ["nat@natwelch.com", "broudy@google.com", "ihmccreery@google.com"]
|
11
|
+
spec.summary = %q{Module for the 'fog' gem to support Google.}
|
12
|
+
spec.description = %q{This library can be used as a module for `fog` or as standalone provider
|
13
|
+
to use the Google in applications.}
|
14
|
+
spec.homepage = "https://github.com/fog/fog-google"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'fog-xml'
|
23
|
+
spec.add_dependency 'fog-core'
|
24
|
+
spec.add_development_dependency 'google-api-client', '~> 0.6', '>= 0.6.2'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'shindo'
|
27
|
+
spec.add_development_dependency 'minitest'
|
28
|
+
spec.add_development_dependency 'turn'
|
29
|
+
spec.add_development_dependency 'pry'
|
30
|
+
spec.add_development_dependency 'vcr'
|
31
|
+
spec.add_development_dependency 'webmock'
|
32
|
+
|
33
|
+
if RUBY_VERSION.to_f > 1.9
|
34
|
+
spec.add_development_dependency 'coveralls'
|
35
|
+
spec.add_development_dependency 'rubocop'
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Google # deviates from other bin stuff to accomodate gem
|
2
|
+
class << self
|
3
|
+
def class_for(key)
|
4
|
+
case key
|
5
|
+
when :compute
|
6
|
+
Fog::Compute::Google
|
7
|
+
when :dns
|
8
|
+
Fog::DNS::Google
|
9
|
+
when :monitoring
|
10
|
+
Fog::Google::Monitoring
|
11
|
+
when :storage
|
12
|
+
Fog::Storage::Google
|
13
|
+
when :sql
|
14
|
+
Fog::Google::SQL
|
15
|
+
else
|
16
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](service)
|
21
|
+
@@connections ||= Hash.new do |hash, key|
|
22
|
+
hash[key] = case key
|
23
|
+
when :compute
|
24
|
+
Fog::Logger.warning("Google[:compute] is not recommended, use Compute[:google] for portability")
|
25
|
+
Fog::Compute.new(:provider => 'Google')
|
26
|
+
when :dns
|
27
|
+
Fog::Logger.warning("Google[:dns] is not recommended, use DNS[:google] for portability")
|
28
|
+
Fog::DNS.new(:provider => 'Google')
|
29
|
+
when :monitoring
|
30
|
+
Fog::Google::Monitoring.new
|
31
|
+
when :sql
|
32
|
+
Fog::Google::SQL.new
|
33
|
+
when :storage
|
34
|
+
Fog::Logger.warning("Google[:storage] is not recommended, use Storage[:google] for portability")
|
35
|
+
Fog::Storage.new(:provider => 'Google')
|
36
|
+
else
|
37
|
+
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@@connections[service]
|
41
|
+
end
|
42
|
+
|
43
|
+
def account
|
44
|
+
@@connections[:compute].account
|
45
|
+
end
|
46
|
+
|
47
|
+
def services
|
48
|
+
Fog::Google.services
|
49
|
+
end
|
50
|
+
|
51
|
+
# based off of virtual_box.rb
|
52
|
+
def available?
|
53
|
+
# Make sure the gem we use is enabled.
|
54
|
+
availability = if Gem::Specification.respond_to?(:find_all_by_name)
|
55
|
+
!Gem::Specification.find_all_by_name('google-api-client').empty? # newest rubygems
|
56
|
+
else
|
57
|
+
!Gem.source_index.find_name('google-api-client').empty? # legacy
|
58
|
+
end
|
59
|
+
# Then make sure we have all of the requirements
|
60
|
+
for service in services
|
61
|
+
begin
|
62
|
+
service = self.class_for(service)
|
63
|
+
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
|
64
|
+
rescue ArgumentError => e
|
65
|
+
Fog::Logger.warning(e.message)
|
66
|
+
availability = false
|
67
|
+
rescue => e
|
68
|
+
availability = false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if availability
|
73
|
+
for service in services
|
74
|
+
for collection in self.class_for(service).collections
|
75
|
+
unless self.respond_to?(collection)
|
76
|
+
self.class_eval <<-EOS, __FILE__, __LINE__
|
77
|
+
def self.#{collection}
|
78
|
+
self[:#{service}].#{collection}
|
79
|
+
end
|
80
|
+
EOS
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
availability
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/fog/google.rb
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
require "fog/core"
|
2
|
+
require "fog/xml"
|
3
|
+
require "fog/google/version"
|
4
|
+
|
5
|
+
module Fog
|
6
|
+
module Compute
|
7
|
+
autoload :Google, "fog/google/compute"
|
8
|
+
end
|
9
|
+
|
10
|
+
module DNS
|
11
|
+
autoload :Google, "fog/google/dns"
|
12
|
+
end
|
13
|
+
|
14
|
+
module Storage
|
15
|
+
autoload :Google, "fog/google/storage"
|
16
|
+
end
|
17
|
+
|
18
|
+
module Google
|
19
|
+
autoload :Monitoring, "fog/google/monitoring"
|
20
|
+
autoload :SQL, "fog/google/sql"
|
21
|
+
|
22
|
+
extend Fog::Provider
|
23
|
+
|
24
|
+
service(:compute, 'Compute')
|
25
|
+
service(:dns, 'DNS')
|
26
|
+
service(:monitoring, 'Monitoring')
|
27
|
+
service(:storage, 'Storage')
|
28
|
+
service(:sql, 'SQL')
|
29
|
+
|
30
|
+
class Mock
|
31
|
+
def self.etag
|
32
|
+
hex(32)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.hex(length)
|
36
|
+
max = ('f' * length).to_i(16)
|
37
|
+
rand(max).to_s(16)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module Shared
|
42
|
+
attr_reader :project, :api_version, :api_url
|
43
|
+
|
44
|
+
##
|
45
|
+
# Initializes shared attributes
|
46
|
+
#
|
47
|
+
# @param [String] project Google Cloud Project
|
48
|
+
# @param [String] api_version Google API version
|
49
|
+
# @param [String] base_url Google API base url
|
50
|
+
# @return [void]
|
51
|
+
def shared_initialize(project, api_version, base_url)
|
52
|
+
@project = project
|
53
|
+
@api_version = api_version
|
54
|
+
@api_url = base_url + api_version + '/projects/'
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Initializes the Google API Client
|
59
|
+
#
|
60
|
+
# @param [Hash] options Google API options
|
61
|
+
# @option options [String] :google_client_email A @developer.gserviceaccount.com email address to use
|
62
|
+
# @option options [String] :google_key_location The location of a pkcs12 key file
|
63
|
+
# @option options [String] :google_key_string The content of the pkcs12 key file
|
64
|
+
# @option options [String] :google_json_key_location The location of a JSON key file
|
65
|
+
# @option options [String] :google_json_key_string The content of the JSON key file
|
66
|
+
# @option options [String] :google_api_scope_url The access scope URLs
|
67
|
+
# @option options [String] :app_name The app name to set in the user agent
|
68
|
+
# @option options [String] :app_version The app version to set in the user agent
|
69
|
+
# @option options [Google::APIClient] :google_client Existing Google API Client
|
70
|
+
# @return [Google::APIClient] Google API Client
|
71
|
+
# @raises [ArgumentError] If there is any missing argument
|
72
|
+
def initialize_google_client(options)
|
73
|
+
# NOTE: loaded here to avoid requiring this as a core Fog dependency
|
74
|
+
begin
|
75
|
+
require 'google/api_client'
|
76
|
+
rescue LoadError => error
|
77
|
+
Fog::Logger.warning('Please install the google-api-client gem before using this provider')
|
78
|
+
raise error
|
79
|
+
end
|
80
|
+
|
81
|
+
# User can provide an existing Google API Client
|
82
|
+
client = options[:google_client]
|
83
|
+
return client unless client.nil?
|
84
|
+
|
85
|
+
# Create a signing key
|
86
|
+
signing_key = create_signing_key(options)
|
87
|
+
|
88
|
+
# Validate required arguments
|
89
|
+
unless options[:google_client_email]
|
90
|
+
raise ArgumentError.new('Missing required arguments: google_client_email')
|
91
|
+
end
|
92
|
+
|
93
|
+
unless options[:google_api_scope_url]
|
94
|
+
raise ArgumentError.new('Missing required arguments: google_api_scope_url')
|
95
|
+
end
|
96
|
+
|
97
|
+
# Create a new Google API Client
|
98
|
+
self.new_pk12_google_client(
|
99
|
+
options[:google_client_email],
|
100
|
+
signing_key,
|
101
|
+
options[:google_api_scope_url],
|
102
|
+
options[:app_name],
|
103
|
+
options[:app_version]
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Creates a Google signing key
|
109
|
+
#
|
110
|
+
def create_signing_key(options)
|
111
|
+
if options[:google_json_key_location] || options[:google_json_key_string]
|
112
|
+
if options[:google_json_key_location]
|
113
|
+
json_key_location = File.expand_path(options[:google_json_key_location])
|
114
|
+
json_key = File.open(json_key_location, 'r') { |file| file.read }
|
115
|
+
else
|
116
|
+
json_key = options[:google_json_key_string]
|
117
|
+
end
|
118
|
+
|
119
|
+
json_key_hash = Fog::JSON.decode(json_key)
|
120
|
+
unless json_key_hash.has_key?('client_email') || json_key_hash.has_key?('private_key')
|
121
|
+
raise ArgumentError.new('Invalid Google JSON key')
|
122
|
+
end
|
123
|
+
|
124
|
+
options[:google_client_email] = json_key_hash['client_email']
|
125
|
+
::Google::APIClient::KeyUtils.load_from_pem(json_key_hash['private_key'], 'notasecret')
|
126
|
+
elsif options[:google_key_location] || options[:google_key_string]
|
127
|
+
if options[:google_key_location]
|
128
|
+
google_key = File.expand_path(options[:google_key_location])
|
129
|
+
else
|
130
|
+
google_key = options[:google_key_string]
|
131
|
+
end
|
132
|
+
|
133
|
+
::Google::APIClient::KeyUtils.load_from_pkcs12(google_key, 'notasecret')
|
134
|
+
else
|
135
|
+
raise ArgumentError.new('Missing required arguments: google_key_location, google_key_string, ' \
|
136
|
+
'google_json_key_location or google_json_key_string')
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# Create a Google API Client with a user email and a pkcs12 key
|
142
|
+
#
|
143
|
+
# @param [String] google_client_email A @developer.gserviceaccount.com email address to use
|
144
|
+
# @param [OpenSSL::PKey] signing_key The private key for signing
|
145
|
+
# @param [String] google_api_scope_url Access scope URLs
|
146
|
+
# @param [String] app_name The app name to set in the user agent
|
147
|
+
# @param [String] app_version The app version to set in the user agent
|
148
|
+
# @return [Google::APIClient] Google API Client
|
149
|
+
def new_pk12_google_client(google_client_email, signing_key, google_api_scope_url, app_name = nil, app_version = nil)
|
150
|
+
application_name = app_name.nil? ? 'fog' : "#{app_name}/#{app_version || '0.0.0'} fog"
|
151
|
+
api_client_options = {
|
152
|
+
:application_name => application_name,
|
153
|
+
:application_version => Fog::VERSION,
|
154
|
+
}
|
155
|
+
client = ::Google::APIClient.new(api_client_options)
|
156
|
+
|
157
|
+
client.authorization = Signet::OAuth2::Client.new(
|
158
|
+
{
|
159
|
+
:audience => 'https://accounts.google.com/o/oauth2/token',
|
160
|
+
:auth_provider_x509_cert_url => 'https://www.googleapis.com/oauth2/v1/certs',
|
161
|
+
:client_x509_cert_url => "https://www.googleapis.com/robot/v1/metadata/x509/#{google_client_email}",
|
162
|
+
:issuer => google_client_email,
|
163
|
+
:scope => google_api_scope_url,
|
164
|
+
:signing_key => signing_key,
|
165
|
+
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
|
166
|
+
}
|
167
|
+
)
|
168
|
+
client.authorization.fetch_access_token!
|
169
|
+
|
170
|
+
client
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# Executes a request and wraps it in a result object
|
175
|
+
#
|
176
|
+
# @param [Google::APIClient::Method] api_method The method object or the RPC name of the method being executed
|
177
|
+
# @param [Hash] parameters The parameters to send to the method
|
178
|
+
# @param [Hash] body_object The body object of the request
|
179
|
+
# @return [Excon::Response] The result from the API
|
180
|
+
def request(api_method, parameters, body_object = nil)
|
181
|
+
client_parms = {
|
182
|
+
:api_method => api_method,
|
183
|
+
:parameters => parameters,
|
184
|
+
}
|
185
|
+
client_parms[:body_object] = body_object if body_object
|
186
|
+
|
187
|
+
result = @client.execute(client_parms)
|
188
|
+
|
189
|
+
build_excon_response(result.body.nil? || result.body.empty? ? nil : Fog::JSON.decode(result.body), result.status)
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# Builds an Excon response
|
194
|
+
#
|
195
|
+
# @param [Hash] Response body
|
196
|
+
# @param [Integer] Response status
|
197
|
+
# @return [Excon::Response] Excon response
|
198
|
+
def build_excon_response(body, status = 200)
|
199
|
+
response = Excon::Response.new(:body => body, :status => status)
|
200
|
+
if body && body.has_key?('error')
|
201
|
+
msg = 'Google Cloud did not return an error message'
|
202
|
+
|
203
|
+
if body['error'].kind_of?(Hash)
|
204
|
+
response.status = body['error']['code']
|
205
|
+
if body['error'].has_key?('errors')
|
206
|
+
msg = body['error']['errors'].map{ |error| error['message'] }.join(', ')
|
207
|
+
elsif body['error'].has_key?('message')
|
208
|
+
msg = body['error']['message']
|
209
|
+
end
|
210
|
+
elsif body['error'].kind_of?(Array)
|
211
|
+
msg = body['error'].map{ |error| error['code'] }.join(', ')
|
212
|
+
end
|
213
|
+
|
214
|
+
case response.status
|
215
|
+
when 404
|
216
|
+
raise Fog::Errors::NotFound.new(msg)
|
217
|
+
else
|
218
|
+
raise Fog::Errors::Error.new(msg)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
response
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,1068 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google < Fog::Service
|
4
|
+
requires :google_project
|
5
|
+
recognizes :app_name, :app_version, :google_client_email, :google_key_location, :google_key_string,
|
6
|
+
:google_client, :google_json_key_location, :google_json_key_string
|
7
|
+
|
8
|
+
GOOGLE_COMPUTE_API_VERSION = 'v1'
|
9
|
+
GOOGLE_COMPUTE_BASE_URL = 'https://www.googleapis.com/compute/'
|
10
|
+
GOOGLE_COMPUTE_API_SCOPE_URLS = %w(https://www.googleapis.com/auth/compute
|
11
|
+
https://www.googleapis.com/auth/devstorage.read_write
|
12
|
+
https://www.googleapis.com/auth/ndev.cloudman
|
13
|
+
https://www.googleapis.com/auth/cloud-platform)
|
14
|
+
GOOGLE_COMPUTE_DEFAULT_NETWORK = 'default'
|
15
|
+
|
16
|
+
request_path 'fog/google/requests/compute'
|
17
|
+
request :list_servers
|
18
|
+
request :list_aggregated_servers
|
19
|
+
request :list_addresses
|
20
|
+
request :list_aggregated_addresses
|
21
|
+
request :list_disks
|
22
|
+
request :list_aggregated_disks
|
23
|
+
request :list_disk_types
|
24
|
+
request :list_aggregated_disk_types
|
25
|
+
request :list_firewalls
|
26
|
+
request :list_images
|
27
|
+
request :list_machine_types
|
28
|
+
request :list_aggregated_machine_types
|
29
|
+
request :list_networks
|
30
|
+
request :list_zones
|
31
|
+
request :list_regions
|
32
|
+
request :list_global_operations
|
33
|
+
request :list_region_operations
|
34
|
+
request :list_zone_operations
|
35
|
+
request :list_snapshots
|
36
|
+
request :list_http_health_checks
|
37
|
+
request :list_target_pools
|
38
|
+
request :list_forwarding_rules
|
39
|
+
request :list_routes
|
40
|
+
request :list_backend_services
|
41
|
+
request :list_global_forwarding_rules
|
42
|
+
request :list_url_maps
|
43
|
+
request :list_target_http_proxies
|
44
|
+
request :list_zone_views
|
45
|
+
request :list_region_views
|
46
|
+
request :list_region_view_resources
|
47
|
+
request :list_zone_view_resources
|
48
|
+
request :list_target_instances
|
49
|
+
|
50
|
+
request :get_server
|
51
|
+
request :get_address
|
52
|
+
request :get_disk
|
53
|
+
request :get_disk_type
|
54
|
+
request :get_firewall
|
55
|
+
request :get_image
|
56
|
+
request :get_machine_type
|
57
|
+
request :get_network
|
58
|
+
request :get_zone
|
59
|
+
request :get_region
|
60
|
+
request :get_snapshot
|
61
|
+
request :get_global_operation
|
62
|
+
request :get_region_operation
|
63
|
+
request :get_zone_operation
|
64
|
+
request :get_http_health_check
|
65
|
+
request :get_target_pool
|
66
|
+
request :get_target_pool_health
|
67
|
+
request :get_forwarding_rule
|
68
|
+
request :get_project
|
69
|
+
request :get_route
|
70
|
+
request :get_backend_service
|
71
|
+
request :get_backend_service_health
|
72
|
+
request :get_url_map
|
73
|
+
request :get_global_forwarding_rule
|
74
|
+
request :get_target_http_proxy
|
75
|
+
request :get_zone_view
|
76
|
+
request :get_region_view
|
77
|
+
request :get_target_instance
|
78
|
+
|
79
|
+
request :delete_address
|
80
|
+
request :delete_disk
|
81
|
+
request :delete_snapshot
|
82
|
+
request :delete_firewall
|
83
|
+
request :delete_image
|
84
|
+
request :delete_network
|
85
|
+
request :delete_server
|
86
|
+
request :delete_global_operation
|
87
|
+
request :delete_region_operation
|
88
|
+
request :delete_zone_operation
|
89
|
+
request :delete_http_health_check
|
90
|
+
request :delete_target_pool
|
91
|
+
request :delete_forwarding_rule
|
92
|
+
request :delete_route
|
93
|
+
request :delete_backend_service
|
94
|
+
request :delete_url_map
|
95
|
+
request :delete_target_http_proxy
|
96
|
+
request :delete_global_forwarding_rule
|
97
|
+
request :delete_zone_view
|
98
|
+
request :delete_region_view
|
99
|
+
request :delete_target_instance
|
100
|
+
|
101
|
+
request :insert_address
|
102
|
+
request :insert_disk
|
103
|
+
request :insert_firewall
|
104
|
+
request :insert_image
|
105
|
+
request :insert_network
|
106
|
+
request :insert_server
|
107
|
+
request :insert_snapshot
|
108
|
+
request :insert_http_health_check
|
109
|
+
request :insert_target_pool
|
110
|
+
request :insert_forwarding_rule
|
111
|
+
request :insert_route
|
112
|
+
request :insert_backend_service
|
113
|
+
request :insert_url_map
|
114
|
+
request :insert_target_http_proxy
|
115
|
+
request :insert_global_forwarding_rule
|
116
|
+
request :insert_zone_view
|
117
|
+
request :insert_region_view
|
118
|
+
request :insert_target_instance
|
119
|
+
|
120
|
+
request :set_metadata
|
121
|
+
request :set_tags
|
122
|
+
request :set_forwarding_rule_target
|
123
|
+
request :set_global_forwarding_rule_target
|
124
|
+
request :set_target_http_proxy_url_map
|
125
|
+
|
126
|
+
request :add_target_pool_instances
|
127
|
+
request :add_target_pool_health_checks
|
128
|
+
request :add_backend_service_backends
|
129
|
+
request :add_url_map_host_rules
|
130
|
+
request :add_url_map_path_matchers
|
131
|
+
request :add_zone_view_resources
|
132
|
+
request :add_region_view_resources
|
133
|
+
|
134
|
+
request :remove_target_pool_instances
|
135
|
+
request :remove_target_pool_health_checks
|
136
|
+
request :set_common_instance_metadata
|
137
|
+
|
138
|
+
request :attach_disk
|
139
|
+
request :detach_disk
|
140
|
+
request :get_server_serial_port_output
|
141
|
+
request :reset_server
|
142
|
+
request :set_server_disk_auto_delete
|
143
|
+
request :set_server_scheduling
|
144
|
+
request :add_server_access_config
|
145
|
+
request :delete_server_access_config
|
146
|
+
request :update_url_map
|
147
|
+
request :validate_url_map
|
148
|
+
request :start_server
|
149
|
+
request :stop_server
|
150
|
+
|
151
|
+
model_path 'fog/google/models/compute'
|
152
|
+
model :server
|
153
|
+
collection :servers
|
154
|
+
|
155
|
+
model :image
|
156
|
+
collection :images
|
157
|
+
|
158
|
+
model :flavor
|
159
|
+
collection :flavors
|
160
|
+
|
161
|
+
model :disk
|
162
|
+
collection :disks
|
163
|
+
|
164
|
+
model :disk_type
|
165
|
+
collection :disk_types
|
166
|
+
|
167
|
+
model :address
|
168
|
+
collection :addresses
|
169
|
+
|
170
|
+
model :operation
|
171
|
+
collection :operations
|
172
|
+
|
173
|
+
model :snapshot
|
174
|
+
collection :snapshots
|
175
|
+
|
176
|
+
model :zone
|
177
|
+
collection :zones
|
178
|
+
|
179
|
+
model :region
|
180
|
+
collection :regions
|
181
|
+
|
182
|
+
model :http_health_check
|
183
|
+
collection :http_health_checks
|
184
|
+
|
185
|
+
model :target_pool
|
186
|
+
collection :target_pools
|
187
|
+
|
188
|
+
model :forwarding_rule
|
189
|
+
collection :forwarding_rules
|
190
|
+
|
191
|
+
model :project
|
192
|
+
collection :projects
|
193
|
+
|
194
|
+
model :firewall
|
195
|
+
collection :firewalls
|
196
|
+
|
197
|
+
model :network
|
198
|
+
collection :networks
|
199
|
+
|
200
|
+
model :route
|
201
|
+
collection :routes
|
202
|
+
|
203
|
+
model :backend_service
|
204
|
+
collection :backend_services
|
205
|
+
|
206
|
+
model :target_http_proxy
|
207
|
+
collection :target_http_proxies
|
208
|
+
|
209
|
+
model :url_map
|
210
|
+
collection :url_maps
|
211
|
+
|
212
|
+
model :global_forwarding_rule
|
213
|
+
collection :global_forwarding_rules
|
214
|
+
|
215
|
+
model :resource_view
|
216
|
+
collection :resource_views
|
217
|
+
|
218
|
+
model :target_instance
|
219
|
+
collection :target_instances
|
220
|
+
|
221
|
+
class Mock
|
222
|
+
include Fog::Google::Shared
|
223
|
+
|
224
|
+
def initialize(options)
|
225
|
+
shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL)
|
226
|
+
end
|
227
|
+
|
228
|
+
def self.data(api_version)
|
229
|
+
@data ||= Hash.new do |hash, key|
|
230
|
+
case key
|
231
|
+
when 'debian-cloud'
|
232
|
+
hash[key] = {
|
233
|
+
:images => {
|
234
|
+
"debian-6-squeeze-v20130816" => {
|
235
|
+
"kind" => "compute#image",
|
236
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-6-squeeze-v20130816",
|
237
|
+
"id" => "14841592146580482051",
|
238
|
+
"creationTimestamp" => "2013-09-04T13:21:53.292-07:00",
|
239
|
+
"name" => "debian-6-squeeze-v20130816",
|
240
|
+
"description" => "Debian GNU/Linux 6.0.7 (squeeze) built on 2013-08-16",
|
241
|
+
"sourceType" => "RAW",
|
242
|
+
"rawDisk" => {
|
243
|
+
"containerType" => "TAR",
|
244
|
+
"source" => ""
|
245
|
+
},
|
246
|
+
"status" => "READY"
|
247
|
+
},
|
248
|
+
"debian-7-wheezy-v20130816" => {
|
249
|
+
"kind" => "compute#image",
|
250
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20130816",
|
251
|
+
"id" => "4213305957435180899",
|
252
|
+
"creationTimestamp" => "2013-09-04T13:24:30.479-07:00",
|
253
|
+
"name" => "debian-7-wheezy-v20130816",
|
254
|
+
"description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-08-16",
|
255
|
+
"sourceType" => "RAW",
|
256
|
+
"rawDisk" => {
|
257
|
+
"containerType" => "TAR",
|
258
|
+
"source" => ""
|
259
|
+
},
|
260
|
+
"status" => "READY"
|
261
|
+
},
|
262
|
+
"debian-7-wheezy-v20131014" => {
|
263
|
+
"kind" => "compute#image",
|
264
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131014",
|
265
|
+
"id" => "4213305957435180899",
|
266
|
+
"creationTimestamp" => "2013-09-04T13:24:30.479-07:00",
|
267
|
+
"name" => "debian-7-wheezy-v20131014",
|
268
|
+
"description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-10-14",
|
269
|
+
"sourceType" => "RAW",
|
270
|
+
"rawDisk" => {
|
271
|
+
"containerType" => "TAR",
|
272
|
+
"source" => ""
|
273
|
+
},
|
274
|
+
"status" => "READY"
|
275
|
+
},
|
276
|
+
"debian-7-wheezy-v20140408" => {
|
277
|
+
"kind" => "compute#image",
|
278
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20140408",
|
279
|
+
"id" => "17312518942796567788",
|
280
|
+
"creationTimestamp" => "2013-11-25T15:17:00.436-08:00",
|
281
|
+
"name" => "debian-7-wheezy-v20131120",
|
282
|
+
"description" => "Debian GNU/Linux 7.2 (wheezy) built on 2013-11-20",
|
283
|
+
"sourceType" => "RAW",
|
284
|
+
"rawDisk" => {
|
285
|
+
"containerType" => "TAR",
|
286
|
+
"source" => ""
|
287
|
+
},
|
288
|
+
"status" => "READY",
|
289
|
+
"archiveSizeBytes" => "341857472"
|
290
|
+
}
|
291
|
+
}
|
292
|
+
}
|
293
|
+
when 'centos-cloud'
|
294
|
+
hash[key] = {
|
295
|
+
:images => {
|
296
|
+
"centos-6-v20130813" => {
|
297
|
+
"kind" => "compute#image",
|
298
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/centos-cloud/global/images/centos-6-v20130813",
|
299
|
+
"id" => "4670523370938782739",
|
300
|
+
"creationTimestamp" => "2013-08-19T11:56:47.004-07:00",
|
301
|
+
"name" => "centos-6-v20130813",
|
302
|
+
"description" => "SCSI-enabled CentOS 6; Created Tue, 13 Aug 2013 00:00:00 +0000",
|
303
|
+
"sourceType" => "RAW",
|
304
|
+
"rawDisk" => {
|
305
|
+
"containerType" => "TAR",
|
306
|
+
"source" => ""
|
307
|
+
},
|
308
|
+
"status" => "READY"
|
309
|
+
}
|
310
|
+
}
|
311
|
+
}
|
312
|
+
else
|
313
|
+
hash[key] = {
|
314
|
+
:target_http_proxies => {
|
315
|
+
"test-target-http-proxy" => {
|
316
|
+
"kind" => "compute#targetHttpProxy",
|
317
|
+
"id" => "1361932147851415729",
|
318
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
319
|
+
"name" => "test-target-http-proxy",
|
320
|
+
"description" => '',
|
321
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/test-target-http-proxy",
|
322
|
+
"urlMap" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/test-url-map"
|
323
|
+
}
|
324
|
+
},
|
325
|
+
:url_maps => {
|
326
|
+
"test-url-map" => {
|
327
|
+
"kind" => "compute#urlMap",
|
328
|
+
"id" => "1361932147851415729",
|
329
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
330
|
+
"name" => 'test-url-map',
|
331
|
+
"description" => '',
|
332
|
+
"hostRules" => [],
|
333
|
+
"pathMatchers" => [],
|
334
|
+
"tests" => [],
|
335
|
+
"defaultService" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/fog-backend-service-test",
|
336
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/test-url-map"
|
337
|
+
}
|
338
|
+
},
|
339
|
+
:target_pools => {
|
340
|
+
"test-target-pool" => {
|
341
|
+
'kind' => "compute#targetPool",
|
342
|
+
"id" => "1361932147851415729",
|
343
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/targetPools/test-target-pool",
|
344
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
345
|
+
'name' => "test-target-pool",
|
346
|
+
"region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1",
|
347
|
+
"healthChecks" => ["https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/test-check"],
|
348
|
+
"instances" => ["https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/instances/test-instance"],
|
349
|
+
}
|
350
|
+
},
|
351
|
+
|
352
|
+
:http_health_checks => {
|
353
|
+
"test-http-health-check" => {
|
354
|
+
"checkIntervalSec" => 5,
|
355
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
356
|
+
"healthyThreshold" => 2,
|
357
|
+
"id" => "1361932147851415729",
|
358
|
+
"kind" => "compute#httphealthCheck",
|
359
|
+
"name" => "test-http-health-check",
|
360
|
+
"port" => 80,
|
361
|
+
"requestPath" => '/',
|
362
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/test-http-health-check",
|
363
|
+
"timeoutSec" => 5,
|
364
|
+
"unhealthyThreshold" => 2
|
365
|
+
}
|
366
|
+
},
|
367
|
+
:global_forwarding_rules => {
|
368
|
+
"test-global-forwarding-rule" => {
|
369
|
+
"kind" => "compute#forwardingRule",
|
370
|
+
"id" => "1361932147851415729",
|
371
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
372
|
+
"name" => 'test-global-forwarding-rule',
|
373
|
+
"IPAddress" => '107.178.255.155',
|
374
|
+
"IPProtocol" => 'TCP',
|
375
|
+
"portRange" => '80-80',
|
376
|
+
"target" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/proxy",
|
377
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardngRules/test-global-forwarding-rule"
|
378
|
+
}
|
379
|
+
},
|
380
|
+
:forwarding_rules => {
|
381
|
+
"test-forwarding-rule" => {
|
382
|
+
"kind" => "compute#forwardingRule",
|
383
|
+
"id" => "1361932147851415729",
|
384
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
385
|
+
"name" => 'test-forwarding-rule',
|
386
|
+
"IPAddress" => '107.178.255.155',
|
387
|
+
"IPProtocol" => 'TCP',
|
388
|
+
"portRange" => '80-80',
|
389
|
+
"target" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/targetPools/target_pool",
|
390
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/forwardngRules/test-forwarding-rule",
|
391
|
+
"region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1"
|
392
|
+
}
|
393
|
+
},
|
394
|
+
:target_instances => {
|
395
|
+
"test-target-instance" => {
|
396
|
+
"kind" => "compute#targetInstance",
|
397
|
+
"name" => "test-target-instance",
|
398
|
+
"natPolicy" => "NO_NAT",
|
399
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a",
|
400
|
+
"instance" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/instances/test-instance",
|
401
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/targetInstances/test-target-instance",
|
402
|
+
"id" => "1361932147851415729",
|
403
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
404
|
+
|
405
|
+
}
|
406
|
+
},
|
407
|
+
:backend_services =>{
|
408
|
+
"test-backend-service" => {
|
409
|
+
"kind" => "compute#backend_service",
|
410
|
+
"id" => "1361932147851415729",
|
411
|
+
"creationTimestamp" => '2014-08-23T10:06:13.951-07:00',
|
412
|
+
"name" => "test-backend-service",
|
413
|
+
"description" => '',
|
414
|
+
"backends" => [
|
415
|
+
{
|
416
|
+
"description" => '',
|
417
|
+
"group" => "https://www.googleapis.com/resourceviews/v1beta1/projects#{@project}/zones/us-central1-a/zoneViews/name",
|
418
|
+
"balancingMode" => "RATE",
|
419
|
+
"capacityScaler" => 1.1,
|
420
|
+
"maxRate" => 0.5,
|
421
|
+
}],
|
422
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/test-backend-service"
|
423
|
+
}
|
424
|
+
},
|
425
|
+
:servers => {
|
426
|
+
"fog-1" => {
|
427
|
+
"kind" => "compute#instance",
|
428
|
+
"id" => "1361932147851415727",
|
429
|
+
"creationTimestamp" => "2013-09-26T04:55:43.881-07:00",
|
430
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
|
431
|
+
"status" => "RUNNING",
|
432
|
+
"name" => "fog-1380196541",
|
433
|
+
"tags" => { "fingerprint" => "42WmSpB8rSM=" },
|
434
|
+
"machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/machineTypes/n1-standard-1",
|
435
|
+
"canIpForward" => false,
|
436
|
+
"networkInterfaces" => [
|
437
|
+
{
|
438
|
+
"network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/global/networks/default",
|
439
|
+
"networkIP" => "10.240.121.54",
|
440
|
+
"name" => "nic0",
|
441
|
+
"accessConfigs" => [
|
442
|
+
{
|
443
|
+
"kind" => "compute#accessConfig",
|
444
|
+
"type" => "ONE_TO_ONE_NAT",
|
445
|
+
"name" => "External NAT",
|
446
|
+
"natIP" => "108.59.81.28"
|
447
|
+
}
|
448
|
+
]
|
449
|
+
}
|
450
|
+
],
|
451
|
+
"disks" => [
|
452
|
+
{
|
453
|
+
"kind" => "compute#attachedDisk",
|
454
|
+
"index" => 0,
|
455
|
+
"type" => "PERSISTENT",
|
456
|
+
"mode" => "READ_WRITE",
|
457
|
+
"source" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1",
|
458
|
+
"deviceName" => "persistent-disk-0",
|
459
|
+
"boot" => true
|
460
|
+
}
|
461
|
+
],
|
462
|
+
"metadata" => {
|
463
|
+
"kind" => "compute#metadata",
|
464
|
+
"fingerprint" => "5_hasd_gC3E=",
|
465
|
+
"items" => [
|
466
|
+
{
|
467
|
+
"key" => "sshKeys",
|
468
|
+
"value" => "sysadmin:ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA1zc7mx+0H8Roywet/L0aVX6MUdkDfzd/17kZhprAbpUXYOILv9AG4lIzQk6xGxDIltghytjfVGme/4A42Sb0Z9LN0pxB4KnWTNoOSHPJtp6jbXpq6PdN9r3Z5NKQg0A/Tfw7gt2N0GDsj6vpK8VbHHdW78JAVUxql18ootJxjaksdocsiHNK8iA6/v9qiLRhX3fOgtK7KpxxdZxLRzFg9vkp8jcGISgpZt27kOgXWhR5YLhi8pRJookzphO5O4yhflgoHoAE65XkfrsRCe0HU5QTbY2jH88rBVkq0KVlZh/lEsuwfmG4d77kEqaCGGro+j1Wrvo2K3DSQ+rEcvPp2CYRUySjhaeLF18UzQLtxNeoN14QOYqlm9ITdkCnmq5w4Wn007MjSOFp8LEq2RekrnddGXjg1/vgmXtaVSGzJAlXwtVfZor3dTRmF0JCpr7DsiupBaDFtLUlGFFlSKmPDVMPOOB5wajexmcvSp2Vu4U3yP8Lai/9/ZxMdsGPhpdCsWVL83B5tF4oYj1HVIycbYIxIIfFqOxZcCru3CMfe9jmzKgKLv2UtkfOS8jpS/Os2gAiB3wPweH3agvtwYAYBVMDwt5cnrhgHYWoOz7ABD8KgmCrD7Y9HikiCqIUNkgUFd9YmjcYi5FkU5rFXIawN7efs341lsdf923lsdf923fs= johndoe@acme"
|
469
|
+
}
|
470
|
+
]
|
471
|
+
},
|
472
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/instances/fog-1380196541"
|
473
|
+
}
|
474
|
+
},
|
475
|
+
:zones => {
|
476
|
+
"europe-west1-a" => {
|
477
|
+
"kind" => "compute#zone",
|
478
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-a",
|
479
|
+
"id" => "10419676573632995924",
|
480
|
+
"creationTimestamp" => "2013-09-26T02:56:13.115-07:00",
|
481
|
+
"name" => "europe-west1-a",
|
482
|
+
"description" => "europe-west1-a",
|
483
|
+
"status" => "UP",
|
484
|
+
"maintenanceWindows" => [
|
485
|
+
{
|
486
|
+
"name" => "2014-01-18-planned-outage",
|
487
|
+
"description" => "maintenance zone",
|
488
|
+
"beginTime" => "2014-01-18T12:00:00.000-08:00",
|
489
|
+
"endTime" => "2014-02-02T12:00:00.000-08:00"
|
490
|
+
}
|
491
|
+
],
|
492
|
+
"quotas" => [
|
493
|
+
{"metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0},
|
494
|
+
{"metric" => "CPUS", "limit" => 24.0, "usage" => 0.0},
|
495
|
+
{"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0},
|
496
|
+
{"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0}
|
497
|
+
],
|
498
|
+
"region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/europe-west1"
|
499
|
+
},
|
500
|
+
"us-central1-a" => {
|
501
|
+
"kind" => "compute#zone",
|
502
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
|
503
|
+
"id" => "6562457277909136262",
|
504
|
+
"creationTimestamp" => "2013-09-26T02:56:13.116-07:00",
|
505
|
+
"name" => "us-central1-a",
|
506
|
+
"description" => "us-central1-a",
|
507
|
+
"status" => "UP",
|
508
|
+
"maintenanceWindows" => nil,
|
509
|
+
"quotas" => [
|
510
|
+
{"metric" => "INSTANCES", "limit" => 16.0, "usage" => 1.0},
|
511
|
+
{"metric" => "CPUS", "limit" => 24.0, "usage" => 1.0},
|
512
|
+
{"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0},
|
513
|
+
{"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0}
|
514
|
+
],
|
515
|
+
"region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1"
|
516
|
+
},
|
517
|
+
"us-central1-b" => {
|
518
|
+
"kind" => "compute#zone",
|
519
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-b",
|
520
|
+
"id" => "8701502109626061015",
|
521
|
+
"creationTimestamp" => "2013-09-26T02:56:13.124-07:00",
|
522
|
+
"name" => "us-central1-b",
|
523
|
+
"description" => "us-central1-b",
|
524
|
+
"status" => "UP",
|
525
|
+
"maintenanceWindows" => [{"name" => "2013-10-26-planned-outage",
|
526
|
+
"description" => "maintenance zone",
|
527
|
+
"beginTime" => "2013-10-26T12:00:00.000-07:00",
|
528
|
+
"endTime" => "2013-11-10T12:00:00.000-08:00"}],
|
529
|
+
"quotas" => [
|
530
|
+
{"metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0},
|
531
|
+
{"metric" => "CPUS", "limit" => 24.0, "usage" => 0.0},
|
532
|
+
{"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0},
|
533
|
+
{"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0}
|
534
|
+
],
|
535
|
+
"region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1"
|
536
|
+
},
|
537
|
+
"us-central2-a" => {
|
538
|
+
"kind" => "compute#zone",
|
539
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central2-a",
|
540
|
+
"id" => "13611654493253680292",
|
541
|
+
"creationTimestamp" => "2013-09-26T02:56:13.125-07:00",
|
542
|
+
"name" => "us-central2-a",
|
543
|
+
"description" => "us-central2-a",
|
544
|
+
"status" => "UP",
|
545
|
+
"maintenanceWindows" => [
|
546
|
+
{
|
547
|
+
"name" => "2013-10-12-planned-outage",
|
548
|
+
"description" => "maintenance zone",
|
549
|
+
"beginTime" => "2013-10-12T12:00:00.000-07:00",
|
550
|
+
"endTime" => "2013-10-27T12:00:00.000-07:00"
|
551
|
+
}
|
552
|
+
],
|
553
|
+
"quotas" => [
|
554
|
+
{"metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0},
|
555
|
+
{"metric" => "CPUS", "limit" => 24.0, "usage" => 0.0},
|
556
|
+
{"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0},
|
557
|
+
{"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0}
|
558
|
+
],
|
559
|
+
"region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central2"
|
560
|
+
}
|
561
|
+
},
|
562
|
+
:regions => {
|
563
|
+
"us-central1" => {
|
564
|
+
"creationTimestamp" => '2014-01-21T10:30:54.895-08:00',
|
565
|
+
"description" => 'us-central1',
|
566
|
+
"id" => '18201118976141502843',
|
567
|
+
"kind" => "compute#region",
|
568
|
+
"name" =>"us-central1",
|
569
|
+
"quotas" => [
|
570
|
+
{"metric" =>"CPUS", "limit" => 1050.0, "usage" => 28.0},
|
571
|
+
{"metric" =>"DISKS_TOTAL_GB", "limit" => 10000.0, "usage" => 292.0},
|
572
|
+
{"metric" =>"STATIC_ADDRESSES", "limit" => 10.0, "usage" => 0.0},
|
573
|
+
{"metric" =>"IN_USE_ADDRESSES", "limit" => 1050.0, "usage" => 30.0},
|
574
|
+
{"metric" =>"SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0}
|
575
|
+
],
|
576
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1",
|
577
|
+
"status" => "UP",
|
578
|
+
"zones" => [
|
579
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
|
580
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-b",
|
581
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-f",
|
582
|
+
]
|
583
|
+
},
|
584
|
+
"europe-west1" => {
|
585
|
+
"creationTimestamp" => '2014-01-21T10:30:54.891-08:00',
|
586
|
+
"description" => 'europe-west1',
|
587
|
+
"id" => '18201118976141502843',
|
588
|
+
"kind" => "compute#region",
|
589
|
+
"name" =>"europe-west1",
|
590
|
+
"quotas" => [
|
591
|
+
{"metric" =>"CPUS", "limit" => 24.0, "usage" => 0.0},
|
592
|
+
{"metric" =>"DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0},
|
593
|
+
{"metric" =>"STATIC_ADDRESSES", "limit" => 7.0, "usage" => 0.0},
|
594
|
+
{"metric" =>"IN_USE_ADDRESSES", "limit" => 23.0, "usage" => 0.0},
|
595
|
+
{"metric" =>"SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0}
|
596
|
+
],
|
597
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/erope-west1",
|
598
|
+
"status" => "UP",
|
599
|
+
"zones" => [
|
600
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-a",
|
601
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-b",
|
602
|
+
]
|
603
|
+
},
|
604
|
+
"asia-east1" => {
|
605
|
+
"creationTimestamp" => '2014-01-21T10:30:54.895-08:00',
|
606
|
+
"description" => 'asia-east1',
|
607
|
+
"id" => '18201118976141502843',
|
608
|
+
"kind" => "compute#region",
|
609
|
+
"name" =>"asia-east1",
|
610
|
+
"quotas" => [
|
611
|
+
{"metric" =>"CPUS", "limit" => 1050.0, "usage" => 28.0},
|
612
|
+
{"metric" =>"DISKS_TOTAL_GB", "limit" => 10000.0, "usage" => 292.0},
|
613
|
+
{"metric" =>"STATIC_ADDRESSES", "limit" => 10.0, "usage" => 0.0},
|
614
|
+
{"metric" =>"IN_USE_ADDRESSES", "limit" => 1050.0, "usage" => 30.0},
|
615
|
+
{"metric" =>"SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0}
|
616
|
+
],
|
617
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/asia-east1",
|
618
|
+
"status" => "UP",
|
619
|
+
"zones" => [
|
620
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-a",
|
621
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-b",
|
622
|
+
"https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-c",
|
623
|
+
]
|
624
|
+
}
|
625
|
+
},
|
626
|
+
|
627
|
+
:machine_types => Hash.new do |machine_types_hash, zone|
|
628
|
+
machine_types_hash[zone] = {
|
629
|
+
"f1-micro" => {
|
630
|
+
"kind" => "compute#machineType",
|
631
|
+
"id" => "4618642685664990776",
|
632
|
+
"creationTimestamp" => "2013-04-25T13:32:49.088-07:00",
|
633
|
+
"name" => "f1-micro",
|
634
|
+
"description" => "1 vCPU (shared physical core) and 0.6 GB RAM",
|
635
|
+
"guestCpus" => 1,
|
636
|
+
"memoryMb" => 614,
|
637
|
+
"imageSpaceGb" => 0,
|
638
|
+
"maximumPersistentDisks" => 4,
|
639
|
+
"maximumPersistentDisksSizeGb" => "3072",
|
640
|
+
"zone" => zone,
|
641
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/f1-micro"
|
642
|
+
},
|
643
|
+
"g1-small" => {
|
644
|
+
"kind" => "compute#machineType",
|
645
|
+
"id" => "7224129552184485774",
|
646
|
+
"creationTimestamp" => "2013-04-25T13:32:45.550-07:00",
|
647
|
+
"name" => "g1-small",
|
648
|
+
"description" => "1 vCPU (shared physical core) and 1.7 GB RAM",
|
649
|
+
"guestCpus" => 1,
|
650
|
+
"memoryMb" => 1740,
|
651
|
+
"imageSpaceGb" => 0,
|
652
|
+
"maximumPersistentDisks" => 4,
|
653
|
+
"maximumPersistentDisksSizeGb" => "3072",
|
654
|
+
"zone" => zone,
|
655
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/g1-small"
|
656
|
+
},
|
657
|
+
"n1-highcpu-2" => {
|
658
|
+
"kind" => "compute#machineType",
|
659
|
+
"id" => "13043554592196512955",
|
660
|
+
"creationTimestamp" => "2012-11-16T11:46:10.572-08:00",
|
661
|
+
"name" => "n1-highcpu-2",
|
662
|
+
"description" => "2 vCPUs, 1.8 GB RAM",
|
663
|
+
"guestCpus" => 2,
|
664
|
+
"memoryMb" => 1843,
|
665
|
+
"imageSpaceGb" => 10,
|
666
|
+
"maximumPersistentDisks" => 16,
|
667
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
668
|
+
"zone" => zone,
|
669
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-2"
|
670
|
+
},
|
671
|
+
"n1-highcpu-2-d" => {
|
672
|
+
"kind" => "compute#machineType",
|
673
|
+
"id" => "13043555176034896271",
|
674
|
+
"creationTimestamp" => "2012-11-16T11:47:07.825-08:00",
|
675
|
+
"name" => "n1-highcpu-2-d",
|
676
|
+
"description" => "2 vCPUs, 1.8 GB RAM, 1 scratch disk (870 GB)",
|
677
|
+
"guestCpus" => 2,
|
678
|
+
"memoryMb" => 1843,
|
679
|
+
"imageSpaceGb" => 10,
|
680
|
+
"scratchDisks" => [
|
681
|
+
{
|
682
|
+
"diskGb" => 870
|
683
|
+
}
|
684
|
+
],
|
685
|
+
"maximumPersistentDisks" => 16,
|
686
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
687
|
+
"zone" => zone,
|
688
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-2-d"
|
689
|
+
},
|
690
|
+
"n1-highcpu-4" => {
|
691
|
+
"kind" => "compute#machineType",
|
692
|
+
"id" => "13043555705736970382",
|
693
|
+
"creationTimestamp" => "2012-11-16T11:48:06.087-08:00",
|
694
|
+
"name" => "n1-highcpu-4",
|
695
|
+
"description" => "4 vCPUs, 3.6 GB RAM",
|
696
|
+
"guestCpus" => 4,
|
697
|
+
"memoryMb" => 3686,
|
698
|
+
"imageSpaceGb" => 10,
|
699
|
+
"maximumPersistentDisks" => 16,
|
700
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
701
|
+
"zone" => zone,
|
702
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-4"
|
703
|
+
},
|
704
|
+
"n1-highcpu-4-d" => {
|
705
|
+
"kind" => "compute#machineType",
|
706
|
+
"id" => "13043556330284250611",
|
707
|
+
"creationTimestamp" => "2012-11-16T11:49:07.563-08:00",
|
708
|
+
"name" => "n1-highcpu-4-d",
|
709
|
+
"description" => "4 vCPUS, 3.6 GB RAM, 1 scratch disk (1770 GB)",
|
710
|
+
"guestCpus" => 4,
|
711
|
+
"memoryMb" => 3686,
|
712
|
+
"imageSpaceGb" => 10,
|
713
|
+
"scratchDisks" => [
|
714
|
+
{
|
715
|
+
"diskGb" => 1770
|
716
|
+
}
|
717
|
+
],
|
718
|
+
"maximumPersistentDisks" => 16,
|
719
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
720
|
+
"zone" => zone,
|
721
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-4-d"
|
722
|
+
},
|
723
|
+
"n1-highcpu-8" => {
|
724
|
+
"kind" => "compute#machineType",
|
725
|
+
"id" => "13043556949665240937",
|
726
|
+
"creationTimestamp" => "2012-11-16T11:50:15.128-08:00",
|
727
|
+
"name" => "n1-highcpu-8",
|
728
|
+
"description" => "8 vCPUs, 7.2 GB RAM",
|
729
|
+
"guestCpus" => 8,
|
730
|
+
"memoryMb" => 7373,
|
731
|
+
"imageSpaceGb" => 10,
|
732
|
+
"maximumPersistentDisks" => 16,
|
733
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
734
|
+
"zone" => zone,
|
735
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-8"
|
736
|
+
},
|
737
|
+
"n1-highcpu-8-d" => {
|
738
|
+
"kind" => "compute#machineType",
|
739
|
+
"id" => "13043557458004959701",
|
740
|
+
"creationTimestamp" => "2012-11-16T11:51:04.549-08:00",
|
741
|
+
"name" => "n1-highcpu-8-d",
|
742
|
+
"description" => "8 vCPUS, 7.2 GB RAM, 2 scratch disks (1770 GB, 1770 GB)",
|
743
|
+
"guestCpus" => 8,
|
744
|
+
"memoryMb" => 7373,
|
745
|
+
"imageSpaceGb" => 10,
|
746
|
+
"scratchDisks" => [
|
747
|
+
{
|
748
|
+
"diskGb" => 1770
|
749
|
+
},
|
750
|
+
{
|
751
|
+
"diskGb" => 1770
|
752
|
+
}
|
753
|
+
],
|
754
|
+
"maximumPersistentDisks" => 16,
|
755
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
756
|
+
"zone" => zone,
|
757
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-8-d"
|
758
|
+
},
|
759
|
+
"n1-highmem-2" => {
|
760
|
+
"kind" => "compute#machineType",
|
761
|
+
"id" => "13043551079318055993",
|
762
|
+
"creationTimestamp" => "2012-11-16T11:40:06.129-08:00",
|
763
|
+
"name" => "n1-highmem-2",
|
764
|
+
"description" => "2 vCPUs, 13 GB RAM",
|
765
|
+
"guestCpus" => 2,
|
766
|
+
"memoryMb" => 13312,
|
767
|
+
"imageSpaceGb" => 10,
|
768
|
+
"maximumPersistentDisks" => 16,
|
769
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
770
|
+
"zone" => zone,
|
771
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-2"
|
772
|
+
},
|
773
|
+
"n1-highmem-2-d" => {
|
774
|
+
"kind" => "compute#machineType",
|
775
|
+
"id" => "13043551625558644085",
|
776
|
+
"creationTimestamp" => "2012-11-16T11:40:59.630-08:00",
|
777
|
+
"name" => "n1-highmem-2-d",
|
778
|
+
"description" => "2 vCPUs, 13 GB RAM, 1 scratch disk (870 GB)",
|
779
|
+
"guestCpus" => 2,
|
780
|
+
"memoryMb" => 13312,
|
781
|
+
"imageSpaceGb" => 10,
|
782
|
+
"scratchDisks" => [
|
783
|
+
{
|
784
|
+
"diskGb" => 870
|
785
|
+
}
|
786
|
+
],
|
787
|
+
"maximumPersistentDisks" => 16,
|
788
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
789
|
+
"zone" => zone,
|
790
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-2-d"
|
791
|
+
},
|
792
|
+
"n1-highmem-4" => {
|
793
|
+
"kind" => "compute#machineType",
|
794
|
+
"id" => "13043552263604939569",
|
795
|
+
"creationTimestamp" => "2012-11-16T11:42:08.983-08:00",
|
796
|
+
"name" => "n1-highmem-4",
|
797
|
+
"description" => "4 vCPUs, 26 GB RAM",
|
798
|
+
"guestCpus" => 4,
|
799
|
+
"memoryMb" => 26624,
|
800
|
+
"imageSpaceGb" => 10,
|
801
|
+
"maximumPersistentDisks" => 16,
|
802
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
803
|
+
"zone" => zone,
|
804
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-4"
|
805
|
+
},
|
806
|
+
"n1-highmem-4-d" => {
|
807
|
+
"kind" => "compute#machineType",
|
808
|
+
"id" => "13043552953632709737",
|
809
|
+
"creationTimestamp" => "2012-11-16T11:43:17.400-08:00",
|
810
|
+
"name" => "n1-highmem-4-d",
|
811
|
+
"description" => "4 vCPUs, 26 GB RAM, 1 scratch disk (1770 GB)",
|
812
|
+
"guestCpus" => 4,
|
813
|
+
"memoryMb" => 26624,
|
814
|
+
"imageSpaceGb" => 10,
|
815
|
+
"scratchDisks" => [
|
816
|
+
{
|
817
|
+
"diskGb" => 1770
|
818
|
+
}
|
819
|
+
],
|
820
|
+
"maximumPersistentDisks" => 16,
|
821
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
822
|
+
"zone" => zone,
|
823
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-4-d"
|
824
|
+
},
|
825
|
+
"n1-highmem-8" => {
|
826
|
+
"kind" => "compute#machineType",
|
827
|
+
"id" => "13043553584275586275",
|
828
|
+
"creationTimestamp" => "2012-11-16T11:44:25.985-08:00",
|
829
|
+
"name" => "n1-highmem-8",
|
830
|
+
"description" => "8 vCPUs, 52 GB RAM",
|
831
|
+
"guestCpus" => 8,
|
832
|
+
"memoryMb" => 53248,
|
833
|
+
"imageSpaceGb" => 10,
|
834
|
+
"maximumPersistentDisks" => 16,
|
835
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
836
|
+
"zone" => zone,
|
837
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-8"
|
838
|
+
},
|
839
|
+
"n1-highmem-8-d" => {
|
840
|
+
"kind" => "compute#machineType",
|
841
|
+
"id" => "13043554021673472746",
|
842
|
+
"creationTimestamp" => "2012-11-16T11:45:08.195-08:00",
|
843
|
+
"name" => "n1-highmem-8-d",
|
844
|
+
"description" => "8 vCPUs, 52 GB RAM, 2 scratch disks (1770 GB, 1770 GB)",
|
845
|
+
"guestCpus" => 8,
|
846
|
+
"memoryMb" => 53248,
|
847
|
+
"imageSpaceGb" => 10,
|
848
|
+
"scratchDisks" => [
|
849
|
+
{
|
850
|
+
"diskGb" => 1770
|
851
|
+
},
|
852
|
+
{
|
853
|
+
"diskGb" => 1770
|
854
|
+
}
|
855
|
+
],
|
856
|
+
"maximumPersistentDisks" => 16,
|
857
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
858
|
+
"zone" => zone,
|
859
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-8-d"
|
860
|
+
},
|
861
|
+
"n1-standard-1" => {
|
862
|
+
"kind" => "compute#machineType",
|
863
|
+
"id" => "12907738072351752276",
|
864
|
+
"creationTimestamp" => "2012-06-07T13:48:14.670-07:00",
|
865
|
+
"name" => "n1-standard-1",
|
866
|
+
"description" => "1 vCPU, 3.75 GB RAM",
|
867
|
+
"guestCpus" => 1,
|
868
|
+
"memoryMb" => 3840,
|
869
|
+
"imageSpaceGb" => 10,
|
870
|
+
"maximumPersistentDisks" => 16,
|
871
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
872
|
+
"zone" => zone,
|
873
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-1"
|
874
|
+
},
|
875
|
+
"n1-standard-1-d" => {
|
876
|
+
"kind" => "compute#machineType",
|
877
|
+
"id" => "12908559201265214706",
|
878
|
+
"creationTimestamp" => "2012-06-07T13:48:34.258-07:00",
|
879
|
+
"name" => "n1-standard-1-d",
|
880
|
+
"description" => "1 vCPU, 3.75 GB RAM, 1 scratch disk (420 GB)",
|
881
|
+
"guestCpus" => 1,
|
882
|
+
"memoryMb" => 3840,
|
883
|
+
"imageSpaceGb" => 10,
|
884
|
+
"scratchDisks" => [
|
885
|
+
{
|
886
|
+
"diskGb" => 420
|
887
|
+
}
|
888
|
+
],
|
889
|
+
"maximumPersistentDisks" => 16,
|
890
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
891
|
+
"zone" => zone,
|
892
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-1-d"
|
893
|
+
},
|
894
|
+
"n1-standard-2" => {
|
895
|
+
"kind" => "compute#machineType",
|
896
|
+
"id" => "12908559320241551184",
|
897
|
+
"creationTimestamp" => "2012-06-07T13:48:56.867-07:00",
|
898
|
+
"name" => "n1-standard-2",
|
899
|
+
"description" => "2 vCPUs, 7.5 GB RAM",
|
900
|
+
"guestCpus" => 2,
|
901
|
+
"memoryMb" => 7680,
|
902
|
+
"imageSpaceGb" => 10,
|
903
|
+
"maximumPersistentDisks" => 16,
|
904
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
905
|
+
"zone" => zone,
|
906
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-2"
|
907
|
+
},
|
908
|
+
"n1-standard-2-d" => {
|
909
|
+
"kind" => "compute#machineType",
|
910
|
+
"id" => "12908559582417967837",
|
911
|
+
"creationTimestamp" => "2012-06-07T13:49:19.448-07:00",
|
912
|
+
"name" => "n1-standard-2-d",
|
913
|
+
"description" => "2 vCPUs, 7.5 GB RAM, 1 scratch disk (870 GB)",
|
914
|
+
"guestCpus" => 2,
|
915
|
+
"memoryMb" => 7680,
|
916
|
+
"imageSpaceGb" => 10,
|
917
|
+
"scratchDisks" => [
|
918
|
+
{
|
919
|
+
"diskGb" => 870
|
920
|
+
}
|
921
|
+
],
|
922
|
+
"maximumPersistentDisks" => 16,
|
923
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
924
|
+
"zone" => zone,
|
925
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-2-d"
|
926
|
+
},
|
927
|
+
"n1-standard-4" => {
|
928
|
+
"kind" => "compute#machineType",
|
929
|
+
"id" => "12908559692070444049",
|
930
|
+
"creationTimestamp" => "2012-06-07T13:49:40.050-07:00",
|
931
|
+
"name" => "n1-standard-4",
|
932
|
+
"description" => "4 vCPUs, 15 GB RAM",
|
933
|
+
"guestCpus" => 4,
|
934
|
+
"memoryMb" => 15360,
|
935
|
+
"imageSpaceGb" => 10,
|
936
|
+
"maximumPersistentDisks" => 16,
|
937
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
938
|
+
"zone" => zone,
|
939
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-4"
|
940
|
+
},
|
941
|
+
"n1-standard-4-d" => {
|
942
|
+
"kind" => "compute#machineType",
|
943
|
+
"id" => "12908559991903153608",
|
944
|
+
"creationTimestamp" => "2012-06-07T13:50:05.677-07:00",
|
945
|
+
"name" => "n1-standard-4-d",
|
946
|
+
"description" => "4 vCPUs, 15 GB RAM, 1 scratch disk (1770 GB)",
|
947
|
+
"guestCpus" => 4,
|
948
|
+
"memoryMb" => 15360,
|
949
|
+
"imageSpaceGb" => 10,
|
950
|
+
"scratchDisks" => [
|
951
|
+
{
|
952
|
+
"diskGb" => 1770
|
953
|
+
}
|
954
|
+
],
|
955
|
+
"maximumPersistentDisks" => 16,
|
956
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
957
|
+
"zone" => zone,
|
958
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-4-d"
|
959
|
+
},
|
960
|
+
"n1-standard-8" => {
|
961
|
+
"kind" => "compute#machineType",
|
962
|
+
"id" => "12908560197989714867",
|
963
|
+
"creationTimestamp" => "2012-06-07T13:50:42.334-07:00",
|
964
|
+
"name" => "n1-standard-8",
|
965
|
+
"description" => "8 vCPUs, 30 GB RAM",
|
966
|
+
"guestCpus" => 8,
|
967
|
+
"memoryMb" => 30720,
|
968
|
+
"imageSpaceGb" => 10,
|
969
|
+
"maximumPersistentDisks" => 16,
|
970
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
971
|
+
"zone" => zone,
|
972
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-8"
|
973
|
+
},
|
974
|
+
"n1-standard-8-d" => {
|
975
|
+
"kind" => "compute#machineType",
|
976
|
+
"id" => "12908560709887590691",
|
977
|
+
"creationTimestamp" => "2012-06-07T13:51:19.936-07:00",
|
978
|
+
"name" => "n1-standard-8-d",
|
979
|
+
"description" => "8 vCPUs, 30 GB RAM, 2 scratch disks (1770 GB, 1770 GB)",
|
980
|
+
"guestCpus" => 8,
|
981
|
+
"memoryMb" => 30720,
|
982
|
+
"imageSpaceGb" => 10,
|
983
|
+
"scratchDisks" => [
|
984
|
+
{
|
985
|
+
"diskGb" => 1770
|
986
|
+
},
|
987
|
+
{
|
988
|
+
"diskGb" => 1770
|
989
|
+
}
|
990
|
+
],
|
991
|
+
"maximumPersistentDisks" => 16,
|
992
|
+
"maximumPersistentDisksSizeGb" => "10240",
|
993
|
+
"zone" => zone,
|
994
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-8-d"
|
995
|
+
}
|
996
|
+
}
|
997
|
+
end,
|
998
|
+
:images => {},
|
999
|
+
:disks => {
|
1000
|
+
"fog-1" => {
|
1001
|
+
"kind" => "compute#disk",
|
1002
|
+
"id" => "3338131294770784461",
|
1003
|
+
"creationTimestamp" => "2013-12-18T19:47:10.583-08:00",
|
1004
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
|
1005
|
+
"status" => "READY",
|
1006
|
+
"name" => "fog-1",
|
1007
|
+
"sizeGb" => "10",
|
1008
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1",
|
1009
|
+
"sourceImage" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131120",
|
1010
|
+
"sourceImageId" => "17312518942796567788",
|
1011
|
+
"type" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/diskTypes/pd-standard",
|
1012
|
+
},
|
1013
|
+
"fog-2" => {
|
1014
|
+
"kind" => "compute#disk",
|
1015
|
+
"id" => "3338131294770784462",
|
1016
|
+
"creationTimestamp" => "2013-12-18T19:47:10.583-08:00",
|
1017
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
|
1018
|
+
"status" => "READY",
|
1019
|
+
"name" => "fog-2",
|
1020
|
+
"sizeGb" => "10",
|
1021
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1",
|
1022
|
+
"type" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/diskTypes/pd-ssd",
|
1023
|
+
}
|
1024
|
+
},
|
1025
|
+
:operations => {}
|
1026
|
+
}
|
1027
|
+
end
|
1028
|
+
end
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
def self.reset
|
1032
|
+
@data = nil
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
def data(project=@project)
|
1036
|
+
self.class.data(api_version)[project]
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
def reset_data
|
1040
|
+
# not particularly useful because it deletes zones
|
1041
|
+
self.class.data(api_version).delete(@project)
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
def random_operation
|
1045
|
+
"operation-#{Fog::Mock.random_numbers(13)}-#{Fog::Mock.random_hex(13)}-#{Fog::Mock.random_hex(8)}"
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
class Real
|
1050
|
+
include Fog::Google::Shared
|
1051
|
+
|
1052
|
+
attr_accessor :client
|
1053
|
+
attr_reader :compute
|
1054
|
+
|
1055
|
+
def initialize(options)
|
1056
|
+
shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL)
|
1057
|
+
options.merge!(:google_api_scope_url => GOOGLE_COMPUTE_API_SCOPE_URLS.join(' '))
|
1058
|
+
|
1059
|
+
@client = initialize_google_client(options)
|
1060
|
+
@compute = @client.discovered_api('compute', api_version)
|
1061
|
+
@resourceviews = @client.discovered_api('resourceviews', 'v1beta1')
|
1062
|
+
end
|
1063
|
+
end
|
1064
|
+
|
1065
|
+
RUNNING = 'RUNNING'
|
1066
|
+
end
|
1067
|
+
end
|
1068
|
+
end
|