gitlab-fog-google 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codecov.yml +2 -0
- data/.editorconfig +11 -0
- data/.fog.example +25 -0
- data/.gitignore +20 -0
- data/.gitlab-ci.yml +13 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +255 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +33 -0
- data/CHANGELOG.md +464 -0
- data/CONTRIBUTING.md +175 -0
- data/CONTRIBUTORS.md +95 -0
- data/Gemfile +13 -0
- data/LICENSE.md +20 -0
- data/MIGRATING.md +1 -0
- data/README.md +177 -0
- data/Rakefile +19 -0
- data/SECURITY.md +16 -0
- data/ci/.gitignore +1 -0
- data/ci/README.md +65 -0
- data/ci/build-head-pipeline.yml +173 -0
- data/ci/credentials.yml.template +28 -0
- data/ci/docker-image/Dockerfile +18 -0
- data/ci/integration-pipeline.yml +226 -0
- data/ci/pipeline-dev.yml +58 -0
- data/ci/tasks/run-int.sh +53 -0
- data/ci/tasks/run-int.yml +18 -0
- data/ci/tasks/utils.sh +10 -0
- data/examples/backend_services.rb +23 -0
- data/examples/bootstrap.rb +27 -0
- data/examples/create_instance.rb +73 -0
- data/examples/create_instance_with_attached_disk.rb +53 -0
- data/examples/dns/project.rb +7 -0
- data/examples/dns/zones.rb +43 -0
- data/examples/get_list_images.rb +42 -0
- data/examples/get_list_snapshots.rb +28 -0
- data/examples/image_create.rb +17 -0
- data/examples/l7_load_balance.rb +79 -0
- data/examples/load-balance.rb +116 -0
- data/examples/metadata.rb +40 -0
- data/examples/monitoring/metric_descriptors.rb +24 -0
- data/examples/monitoring/monitored_resource_descriptors.rb +24 -0
- data/examples/monitoring/timeseries_collection.rb +32 -0
- data/examples/network.rb +55 -0
- data/examples/precreated_client.rb +24 -0
- data/examples/pubsub/subscriptions.rb +54 -0
- data/examples/pubsub/topics.rb +33 -0
- data/examples/sql/flags.rb +11 -0
- data/examples/sql/instances.rb +38 -0
- data/examples/sql/operations.rb +24 -0
- data/examples/sql/ssl_certs.rb +32 -0
- data/examples/sql/tiers.rb +11 -0
- data/examples/storage.rb +49 -0
- data/examples/storage_json.rb +37 -0
- data/gitlab-fog-google.gemspec +44 -0
- data/lib/fog/bin/google.rb +97 -0
- data/lib/fog/compute/google.rb +304 -0
- data/lib/fog/compute/google/mock.rb +845 -0
- data/lib/fog/compute/google/models/address.rb +133 -0
- data/lib/fog/compute/google/models/addresses.rb +63 -0
- data/lib/fog/compute/google/models/backend_service.rb +86 -0
- data/lib/fog/compute/google/models/backend_services.rb +24 -0
- data/lib/fog/compute/google/models/disk.rb +155 -0
- data/lib/fog/compute/google/models/disk_type.rb +27 -0
- data/lib/fog/compute/google/models/disk_types.rb +42 -0
- data/lib/fog/compute/google/models/disks.rb +88 -0
- data/lib/fog/compute/google/models/firewall.rb +94 -0
- data/lib/fog/compute/google/models/firewalls.rb +24 -0
- data/lib/fog/compute/google/models/forwarding_rule.rb +79 -0
- data/lib/fog/compute/google/models/forwarding_rules.rb +44 -0
- data/lib/fog/compute/google/models/global_address.rb +58 -0
- data/lib/fog/compute/google/models/global_addresses.rb +46 -0
- data/lib/fog/compute/google/models/global_forwarding_rule.rb +78 -0
- data/lib/fog/compute/google/models/global_forwarding_rules.rb +24 -0
- data/lib/fog/compute/google/models/http_health_check.rb +104 -0
- data/lib/fog/compute/google/models/http_health_checks.rb +24 -0
- data/lib/fog/compute/google/models/image.rb +81 -0
- data/lib/fog/compute/google/models/images.rb +109 -0
- data/lib/fog/compute/google/models/instance_group.rb +90 -0
- data/lib/fog/compute/google/models/instance_group_manager.rb +51 -0
- data/lib/fog/compute/google/models/instance_group_managers.rb +45 -0
- data/lib/fog/compute/google/models/instance_groups.rb +63 -0
- data/lib/fog/compute/google/models/instance_template.rb +47 -0
- data/lib/fog/compute/google/models/instance_templates.rb +24 -0
- data/lib/fog/compute/google/models/machine_type.rb +23 -0
- data/lib/fog/compute/google/models/machine_types.rb +46 -0
- data/lib/fog/compute/google/models/network.rb +60 -0
- data/lib/fog/compute/google/models/networks.rb +24 -0
- data/lib/fog/compute/google/models/operation.rb +73 -0
- data/lib/fog/compute/google/models/operations.rb +45 -0
- data/lib/fog/compute/google/models/project.rb +28 -0
- data/lib/fog/compute/google/models/projects.rb +19 -0
- data/lib/fog/compute/google/models/region.rb +30 -0
- data/lib/fog/compute/google/models/regions.rb +24 -0
- data/lib/fog/compute/google/models/route.rb +49 -0
- data/lib/fog/compute/google/models/routes.rb +24 -0
- data/lib/fog/compute/google/models/server.rb +604 -0
- data/lib/fog/compute/google/models/servers.rb +120 -0
- data/lib/fog/compute/google/models/snapshot.rb +62 -0
- data/lib/fog/compute/google/models/snapshots.rb +32 -0
- data/lib/fog/compute/google/models/ssl_certificate.rb +42 -0
- data/lib/fog/compute/google/models/ssl_certificates.rb +24 -0
- data/lib/fog/compute/google/models/subnetwork.rb +83 -0
- data/lib/fog/compute/google/models/subnetworks.rb +43 -0
- data/lib/fog/compute/google/models/target_http_proxies.rb +24 -0
- data/lib/fog/compute/google/models/target_http_proxy.rb +73 -0
- data/lib/fog/compute/google/models/target_https_proxies.rb +24 -0
- data/lib/fog/compute/google/models/target_https_proxy.rb +105 -0
- data/lib/fog/compute/google/models/target_instance.rb +67 -0
- data/lib/fog/compute/google/models/target_instances.rb +46 -0
- data/lib/fog/compute/google/models/target_pool.rb +171 -0
- data/lib/fog/compute/google/models/target_pools.rb +43 -0
- data/lib/fog/compute/google/models/url_map.rb +121 -0
- data/lib/fog/compute/google/models/url_maps.rb +24 -0
- data/lib/fog/compute/google/models/zone.rb +25 -0
- data/lib/fog/compute/google/models/zones.rb +24 -0
- data/lib/fog/compute/google/real.rb +24 -0
- data/lib/fog/compute/google/requests/abandon_instances.rb +28 -0
- data/lib/fog/compute/google/requests/add_backend_service_backends.rb +19 -0
- data/lib/fog/compute/google/requests/add_instance_group_instances.rb +37 -0
- data/lib/fog/compute/google/requests/add_server_access_config.rb +32 -0
- data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +32 -0
- data/lib/fog/compute/google/requests/add_target_pool_instances.rb +30 -0
- data/lib/fog/compute/google/requests/attach_disk.rb +22 -0
- data/lib/fog/compute/google/requests/create_disk_snapshot.rb +24 -0
- data/lib/fog/compute/google/requests/delete_address.rb +24 -0
- data/lib/fog/compute/google/requests/delete_backend_service.rb +19 -0
- data/lib/fog/compute/google/requests/delete_disk.rb +25 -0
- data/lib/fog/compute/google/requests/delete_firewall.rb +19 -0
- data/lib/fog/compute/google/requests/delete_forwarding_rule.rb +20 -0
- data/lib/fog/compute/google/requests/delete_global_address.rb +19 -0
- data/lib/fog/compute/google/requests/delete_global_forwarding_rule.rb +19 -0
- data/lib/fog/compute/google/requests/delete_global_operation.rb +20 -0
- data/lib/fog/compute/google/requests/delete_http_health_check.rb +19 -0
- data/lib/fog/compute/google/requests/delete_image.rb +19 -0
- data/lib/fog/compute/google/requests/delete_instance_group.rb +19 -0
- data/lib/fog/compute/google/requests/delete_instance_group_manager.rb +19 -0
- data/lib/fog/compute/google/requests/delete_instance_template.rb +19 -0
- data/lib/fog/compute/google/requests/delete_network.rb +19 -0
- data/lib/fog/compute/google/requests/delete_region_operation.rb +22 -0
- data/lib/fog/compute/google/requests/delete_route.rb +23 -0
- data/lib/fog/compute/google/requests/delete_server.rb +19 -0
- data/lib/fog/compute/google/requests/delete_server_access_config.rb +22 -0
- data/lib/fog/compute/google/requests/delete_snapshot.rb +19 -0
- data/lib/fog/compute/google/requests/delete_ssl_certificate.rb +19 -0
- data/lib/fog/compute/google/requests/delete_subnetwork.rb +31 -0
- data/lib/fog/compute/google/requests/delete_target_http_proxy.rb +19 -0
- data/lib/fog/compute/google/requests/delete_target_https_proxy.rb +19 -0
- data/lib/fog/compute/google/requests/delete_target_instance.rb +20 -0
- data/lib/fog/compute/google/requests/delete_target_pool.rb +20 -0
- data/lib/fog/compute/google/requests/delete_url_map.rb +19 -0
- data/lib/fog/compute/google/requests/delete_zone_operation.rb +22 -0
- data/lib/fog/compute/google/requests/deprecate_image.rb +22 -0
- data/lib/fog/compute/google/requests/detach_disk.rb +20 -0
- data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +38 -0
- data/lib/fog/compute/google/requests/get_address.rb +24 -0
- data/lib/fog/compute/google/requests/get_backend_service.rb +19 -0
- data/lib/fog/compute/google/requests/get_backend_service_health.rb +24 -0
- data/lib/fog/compute/google/requests/get_disk.rb +24 -0
- data/lib/fog/compute/google/requests/get_disk_type.rb +19 -0
- data/lib/fog/compute/google/requests/get_firewall.rb +19 -0
- data/lib/fog/compute/google/requests/get_forwarding_rule.rb +22 -0
- data/lib/fog/compute/google/requests/get_global_address.rb +19 -0
- data/lib/fog/compute/google/requests/get_global_forwarding_rule.rb +19 -0
- data/lib/fog/compute/google/requests/get_global_operation.rb +23 -0
- data/lib/fog/compute/google/requests/get_http_health_check.rb +19 -0
- data/lib/fog/compute/google/requests/get_image.rb +20 -0
- data/lib/fog/compute/google/requests/get_image_from_family.rb +26 -0
- data/lib/fog/compute/google/requests/get_instance_group.rb +19 -0
- data/lib/fog/compute/google/requests/get_instance_group_manager.rb +19 -0
- data/lib/fog/compute/google/requests/get_instance_template.rb +19 -0
- data/lib/fog/compute/google/requests/get_machine_type.rb +20 -0
- data/lib/fog/compute/google/requests/get_network.rb +19 -0
- data/lib/fog/compute/google/requests/get_project.rb +19 -0
- data/lib/fog/compute/google/requests/get_region.rb +19 -0
- data/lib/fog/compute/google/requests/get_region_operation.rb +20 -0
- data/lib/fog/compute/google/requests/get_route.rb +22 -0
- data/lib/fog/compute/google/requests/get_server.rb +19 -0
- data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +38 -0
- data/lib/fog/compute/google/requests/get_snapshot.rb +20 -0
- data/lib/fog/compute/google/requests/get_ssl_certificate.rb +19 -0
- data/lib/fog/compute/google/requests/get_subnetwork.rb +29 -0
- data/lib/fog/compute/google/requests/get_target_http_proxy.rb +19 -0
- data/lib/fog/compute/google/requests/get_target_https_proxy.rb +19 -0
- data/lib/fog/compute/google/requests/get_target_instance.rb +20 -0
- data/lib/fog/compute/google/requests/get_target_pool.rb +20 -0
- data/lib/fog/compute/google/requests/get_target_pool_health.rb +24 -0
- data/lib/fog/compute/google/requests/get_url_map.rb +19 -0
- data/lib/fog/compute/google/requests/get_zone.rb +19 -0
- data/lib/fog/compute/google/requests/get_zone_operation.rb +25 -0
- data/lib/fog/compute/google/requests/insert_address.rb +30 -0
- data/lib/fog/compute/google/requests/insert_backend_service.rb +23 -0
- data/lib/fog/compute/google/requests/insert_disk.rb +48 -0
- data/lib/fog/compute/google/requests/insert_firewall.rb +65 -0
- data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +29 -0
- data/lib/fog/compute/google/requests/insert_global_address.rb +25 -0
- data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +26 -0
- data/lib/fog/compute/google/requests/insert_http_health_check.rb +24 -0
- data/lib/fog/compute/google/requests/insert_image.rb +23 -0
- data/lib/fog/compute/google/requests/insert_instance_group.rb +37 -0
- data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +31 -0
- data/lib/fog/compute/google/requests/insert_instance_template.rb +38 -0
- data/lib/fog/compute/google/requests/insert_network.rb +34 -0
- data/lib/fog/compute/google/requests/insert_route.rb +35 -0
- data/lib/fog/compute/google/requests/insert_server.rb +122 -0
- data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +27 -0
- data/lib/fog/compute/google/requests/insert_subnetwork.rb +61 -0
- data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +26 -0
- data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +29 -0
- data/lib/fog/compute/google/requests/insert_target_instance.rb +25 -0
- data/lib/fog/compute/google/requests/insert_target_pool.rb +22 -0
- data/lib/fog/compute/google/requests/insert_url_map.rb +37 -0
- data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +24 -0
- data/lib/fog/compute/google/requests/list_addresses.rb +28 -0
- data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +23 -0
- data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +24 -0
- data/lib/fog/compute/google/requests/list_aggregated_disks.rb +32 -0
- data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +24 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +26 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +19 -0
- data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +24 -0
- data/lib/fog/compute/google/requests/list_aggregated_servers.rb +24 -0
- data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +36 -0
- data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +26 -0
- data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +26 -0
- data/lib/fog/compute/google/requests/list_backend_services.rb +22 -0
- data/lib/fog/compute/google/requests/list_disk_types.rb +24 -0
- data/lib/fog/compute/google/requests/list_disks.rb +28 -0
- data/lib/fog/compute/google/requests/list_firewalls.rb +24 -0
- data/lib/fog/compute/google/requests/list_forwarding_rules.rb +25 -0
- data/lib/fog/compute/google/requests/list_global_addresses.rb +26 -0
- data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +24 -0
- data/lib/fog/compute/google/requests/list_global_operations.rb +27 -0
- data/lib/fog/compute/google/requests/list_http_health_checks.rb +24 -0
- data/lib/fog/compute/google/requests/list_images.rb +25 -0
- data/lib/fog/compute/google/requests/list_instance_group_instances.rb +21 -0
- data/lib/fog/compute/google/requests/list_instance_group_managers.rb +22 -0
- data/lib/fog/compute/google/requests/list_instance_groups.rb +19 -0
- data/lib/fog/compute/google/requests/list_instance_templates.rb +26 -0
- data/lib/fog/compute/google/requests/list_machine_types.rb +25 -0
- data/lib/fog/compute/google/requests/list_networks.rb +24 -0
- data/lib/fog/compute/google/requests/list_region_operations.rb +29 -0
- data/lib/fog/compute/google/requests/list_regions.rb +23 -0
- data/lib/fog/compute/google/requests/list_routes.rb +28 -0
- data/lib/fog/compute/google/requests/list_servers.rb +24 -0
- data/lib/fog/compute/google/requests/list_snapshots.rb +22 -0
- data/lib/fog/compute/google/requests/list_ssl_certificates.rb +26 -0
- data/lib/fog/compute/google/requests/list_subnetworks.rb +39 -0
- data/lib/fog/compute/google/requests/list_target_http_proxies.rb +25 -0
- data/lib/fog/compute/google/requests/list_target_https_proxies.rb +24 -0
- data/lib/fog/compute/google/requests/list_target_instances.rb +27 -0
- data/lib/fog/compute/google/requests/list_target_pools.rb +26 -0
- data/lib/fog/compute/google/requests/list_url_maps.rb +25 -0
- data/lib/fog/compute/google/requests/list_zone_operations.rb +28 -0
- data/lib/fog/compute/google/requests/list_zones.rb +26 -0
- data/lib/fog/compute/google/requests/patch_firewall.rb +27 -0
- data/lib/fog/compute/google/requests/patch_url_map.rb +21 -0
- data/lib/fog/compute/google/requests/recreate_instances.rb +28 -0
- data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +37 -0
- data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +30 -0
- data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +30 -0
- data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +30 -0
- data/lib/fog/compute/google/requests/reset_server.rb +19 -0
- data/lib/fog/compute/google/requests/reset_windows_password.rb +154 -0
- data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +23 -0
- data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +23 -0
- data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +22 -0
- data/lib/fog/compute/google/requests/set_instance_template.rb +28 -0
- data/lib/fog/compute/google/requests/set_server_disk_auto_delete.rb +26 -0
- data/lib/fog/compute/google/requests/set_server_machine_type.rb +23 -0
- data/lib/fog/compute/google/requests/set_server_metadata.rb +39 -0
- data/lib/fog/compute/google/requests/set_server_scheduling.rb +24 -0
- data/lib/fog/compute/google/requests/set_server_tags.rb +25 -0
- data/lib/fog/compute/google/requests/set_snapshot_labels.rb +25 -0
- data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +42 -0
- data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +24 -0
- data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +24 -0
- data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +24 -0
- data/lib/fog/compute/google/requests/set_target_pool_backup.rb +31 -0
- data/lib/fog/compute/google/requests/start_server.rb +19 -0
- data/lib/fog/compute/google/requests/stop_server.rb +19 -0
- data/lib/fog/compute/google/requests/update_firewall.rb +49 -0
- data/lib/fog/compute/google/requests/update_http_health_check.rb +25 -0
- data/lib/fog/compute/google/requests/update_url_map.rb +28 -0
- data/lib/fog/compute/google/requests/validate_url_map.rb +24 -0
- data/lib/fog/dns/google.rb +67 -0
- data/lib/fog/dns/google/mock.rb +33 -0
- data/lib/fog/dns/google/models/change.rb +38 -0
- data/lib/fog/dns/google/models/changes.rb +50 -0
- data/lib/fog/dns/google/models/project.rb +73 -0
- data/lib/fog/dns/google/models/projects.rb +23 -0
- data/lib/fog/dns/google/models/record.rb +108 -0
- data/lib/fog/dns/google/models/records.rb +53 -0
- data/lib/fog/dns/google/models/zone.rb +72 -0
- data/lib/fog/dns/google/models/zones.rb +32 -0
- data/lib/fog/dns/google/real.rb +19 -0
- data/lib/fog/dns/google/requests/create_change.rb +29 -0
- data/lib/fog/dns/google/requests/create_managed_zone.rb +29 -0
- data/lib/fog/dns/google/requests/delete_managed_zone.rb +23 -0
- data/lib/fog/dns/google/requests/get_change.rb +23 -0
- data/lib/fog/dns/google/requests/get_managed_zone.rb +23 -0
- data/lib/fog/dns/google/requests/get_project.rb +24 -0
- data/lib/fog/dns/google/requests/list_changes.rb +30 -0
- data/lib/fog/dns/google/requests/list_managed_zones.rb +26 -0
- data/lib/fog/dns/google/requests/list_resource_record_sets.rb +30 -0
- data/lib/fog/google.rb +53 -0
- data/lib/fog/google/mock.rb +14 -0
- data/lib/fog/google/models/monitoring/metric_descriptor.rb +23 -0
- data/lib/fog/google/models/monitoring/metric_descriptors.rb +43 -0
- data/lib/fog/google/models/monitoring/monitored_resource_descriptor.rb +20 -0
- data/lib/fog/google/models/monitoring/monitored_resource_descriptors.rb +37 -0
- data/lib/fog/google/models/monitoring/timeseries.rb +19 -0
- data/lib/fog/google/models/monitoring/timeseries_collection.rb +48 -0
- data/lib/fog/google/models/pubsub/received_message.rb +40 -0
- data/lib/fog/google/models/pubsub/subscription.rb +86 -0
- data/lib/fog/google/models/pubsub/subscriptions.rb +33 -0
- data/lib/fog/google/models/pubsub/topic.rb +71 -0
- data/lib/fog/google/models/pubsub/topics.rb +32 -0
- data/lib/fog/google/models/sql/backup_run.rb +37 -0
- data/lib/fog/google/models/sql/backup_runs.rb +38 -0
- data/lib/fog/google/models/sql/flag.rb +23 -0
- data/lib/fog/google/models/sql/flags.rb +21 -0
- data/lib/fog/google/models/sql/instance.rb +339 -0
- data/lib/fog/google/models/sql/instances.rb +39 -0
- data/lib/fog/google/models/sql/operation.rb +67 -0
- data/lib/fog/google/models/sql/operations.rb +47 -0
- data/lib/fog/google/models/sql/ssl_cert.rb +77 -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/sql/user.rb +52 -0
- data/lib/fog/google/models/sql/users.rb +21 -0
- data/lib/fog/google/monitoring.rb +60 -0
- data/lib/fog/google/monitoring/mock.rb +35 -0
- data/lib/fog/google/monitoring/real.rb +20 -0
- data/lib/fog/google/pubsub.rb +69 -0
- data/lib/fog/google/pubsub/mock.rb +34 -0
- data/lib/fog/google/pubsub/real.rb +21 -0
- data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +51 -0
- data/lib/fog/google/requests/monitoring/create_timeseries.rb +29 -0
- data/lib/fog/google/requests/monitoring/delete_metric_descriptor.rb +19 -0
- data/lib/fog/google/requests/monitoring/get_metric_descriptor.rb +19 -0
- data/lib/fog/google/requests/monitoring/get_monitored_resource_descriptor.rb +19 -0
- data/lib/fog/google/requests/monitoring/list_metric_descriptors.rb +26 -0
- data/lib/fog/google/requests/monitoring/list_monitored_resource_descriptors.rb +29 -0
- data/lib/fog/google/requests/monitoring/list_timeseries.rb +55 -0
- data/lib/fog/google/requests/pubsub/acknowledge_subscription.rb +29 -0
- data/lib/fog/google/requests/pubsub/create_subscription.rb +37 -0
- data/lib/fog/google/requests/pubsub/create_topic.rb +23 -0
- data/lib/fog/google/requests/pubsub/delete_subscription.rb +21 -0
- data/lib/fog/google/requests/pubsub/delete_topic.rb +21 -0
- data/lib/fog/google/requests/pubsub/get_subscription.rb +21 -0
- data/lib/fog/google/requests/pubsub/get_topic.rb +21 -0
- data/lib/fog/google/requests/pubsub/list_subscriptions.rb +29 -0
- data/lib/fog/google/requests/pubsub/list_topics.rb +29 -0
- data/lib/fog/google/requests/pubsub/publish_topic.rb +28 -0
- data/lib/fog/google/requests/pubsub/pull_subscription.rb +40 -0
- data/lib/fog/google/requests/sql/clone_instance.rb +42 -0
- data/lib/fog/google/requests/sql/delete_backup_run.rb +23 -0
- data/lib/fog/google/requests/sql/delete_instance.rb +24 -0
- data/lib/fog/google/requests/sql/delete_ssl_cert.rb +24 -0
- data/lib/fog/google/requests/sql/delete_user.rb +24 -0
- data/lib/fog/google/requests/sql/export_instance.rb +55 -0
- data/lib/fog/google/requests/sql/get_backup_run.rb +23 -0
- data/lib/fog/google/requests/sql/get_instance.rb +24 -0
- data/lib/fog/google/requests/sql/get_operation.rb +24 -0
- data/lib/fog/google/requests/sql/get_ssl_cert.rb +24 -0
- data/lib/fog/google/requests/sql/import_instance.rb +44 -0
- data/lib/fog/google/requests/sql/insert_backup_run.rb +28 -0
- data/lib/fog/google/requests/sql/insert_instance.rb +28 -0
- data/lib/fog/google/requests/sql/insert_ssl_cert.rb +30 -0
- data/lib/fog/google/requests/sql/insert_user.rb +25 -0
- data/lib/fog/google/requests/sql/list_backup_runs.rb +27 -0
- data/lib/fog/google/requests/sql/list_flags.rb +24 -0
- data/lib/fog/google/requests/sql/list_instances.rb +27 -0
- data/lib/fog/google/requests/sql/list_operations.rb +28 -0
- data/lib/fog/google/requests/sql/list_ssl_certs.rb +24 -0
- data/lib/fog/google/requests/sql/list_tiers.rb +24 -0
- data/lib/fog/google/requests/sql/list_users.rb +24 -0
- data/lib/fog/google/requests/sql/reset_instance_ssl_config.rb +26 -0
- data/lib/fog/google/requests/sql/restart_instance.rb +24 -0
- data/lib/fog/google/requests/sql/restore_instance_backup.rb +31 -0
- data/lib/fog/google/requests/sql/update_instance.rb +31 -0
- data/lib/fog/google/requests/sql/update_user.rb +27 -0
- data/lib/fog/google/shared.rb +253 -0
- data/lib/fog/google/sql.rb +104 -0
- data/lib/fog/google/sql/mock.rb +40 -0
- data/lib/fog/google/sql/real.rb +21 -0
- data/lib/fog/google/version.rb +5 -0
- data/lib/fog/parsers/storage/google.rb +15 -0
- data/lib/fog/parsers/storage/google/access_control_list.rb +44 -0
- data/lib/fog/parsers/storage/google/copy_object.rb +18 -0
- data/lib/fog/parsers/storage/google/get_bucket.rb +58 -0
- data/lib/fog/parsers/storage/google/get_bucket_logging.rb +36 -0
- data/lib/fog/parsers/storage/google/get_bucket_object_versions.rb +88 -0
- data/lib/fog/parsers/storage/google/get_bucket_versioning.rb +20 -0
- data/lib/fog/parsers/storage/google/get_request_payment.rb +16 -0
- data/lib/fog/parsers/storage/google/get_service.rb +28 -0
- data/lib/fog/storage/google.rb +20 -0
- data/lib/fog/storage/google_json.rb +74 -0
- data/lib/fog/storage/google_json/mock.rb +27 -0
- data/lib/fog/storage/google_json/models/directories.rb +41 -0
- data/lib/fog/storage/google_json/models/directory.rb +61 -0
- data/lib/fog/storage/google_json/models/file.rb +126 -0
- data/lib/fog/storage/google_json/models/files.rb +64 -0
- data/lib/fog/storage/google_json/real.rb +171 -0
- data/lib/fog/storage/google_json/requests/copy_object.rb +34 -0
- data/lib/fog/storage/google_json/requests/delete_bucket.rb +23 -0
- data/lib/fog/storage/google_json/requests/delete_object.rb +24 -0
- data/lib/fog/storage/google_json/requests/delete_object_url.rb +39 -0
- data/lib/fog/storage/google_json/requests/get_bucket.rb +43 -0
- data/lib/fog/storage/google_json/requests/get_bucket_acl.rb +32 -0
- data/lib/fog/storage/google_json/requests/get_object.rb +85 -0
- data/lib/fog/storage/google_json/requests/get_object_acl.rb +35 -0
- data/lib/fog/storage/google_json/requests/get_object_http_url.rb +32 -0
- data/lib/fog/storage/google_json/requests/get_object_https_url.rb +33 -0
- data/lib/fog/storage/google_json/requests/get_object_metadata.rb +32 -0
- data/lib/fog/storage/google_json/requests/get_object_url.rb +21 -0
- data/lib/fog/storage/google_json/requests/list_bucket_acl.rb +26 -0
- data/lib/fog/storage/google_json/requests/list_buckets.rb +30 -0
- data/lib/fog/storage/google_json/requests/list_object_acl.rb +29 -0
- data/lib/fog/storage/google_json/requests/list_objects.rb +48 -0
- data/lib/fog/storage/google_json/requests/put_bucket.rb +42 -0
- data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +29 -0
- data/lib/fog/storage/google_json/requests/put_object.rb +102 -0
- data/lib/fog/storage/google_json/requests/put_object_acl.rb +35 -0
- data/lib/fog/storage/google_json/requests/put_object_url.rb +42 -0
- data/lib/fog/storage/google_json/utils.rb +40 -0
- data/lib/fog/storage/google_xml.rb +38 -0
- data/lib/fog/storage/google_xml/mock.rb +102 -0
- data/lib/fog/storage/google_xml/models/directories.rb +34 -0
- data/lib/fog/storage/google_xml/models/directory.rb +65 -0
- data/lib/fog/storage/google_xml/models/file.rb +130 -0
- data/lib/fog/storage/google_xml/models/files.rb +95 -0
- data/lib/fog/storage/google_xml/real.rb +108 -0
- data/lib/fog/storage/google_xml/requests/copy_object.rb +62 -0
- data/lib/fog/storage/google_xml/requests/delete_bucket.rb +39 -0
- data/lib/fog/storage/google_xml/requests/delete_object.rb +44 -0
- data/lib/fog/storage/google_xml/requests/delete_object_url.rb +42 -0
- data/lib/fog/storage/google_xml/requests/get_bucket.rb +95 -0
- data/lib/fog/storage/google_xml/requests/get_bucket_acl.rb +53 -0
- data/lib/fog/storage/google_xml/requests/get_object.rb +96 -0
- data/lib/fog/storage/google_xml/requests/get_object_acl.rb +62 -0
- data/lib/fog/storage/google_xml/requests/get_object_http_url.rb +37 -0
- data/lib/fog/storage/google_xml/requests/get_object_https_url.rb +37 -0
- data/lib/fog/storage/google_xml/requests/get_object_url.rb +31 -0
- data/lib/fog/storage/google_xml/requests/get_service.rb +44 -0
- data/lib/fog/storage/google_xml/requests/head_object.rb +55 -0
- data/lib/fog/storage/google_xml/requests/put_bucket.rb +71 -0
- data/lib/fog/storage/google_xml/requests/put_bucket_acl.rb +58 -0
- data/lib/fog/storage/google_xml/requests/put_object.rb +85 -0
- data/lib/fog/storage/google_xml/requests/put_object_acl.rb +58 -0
- data/lib/fog/storage/google_xml/requests/put_object_url.rb +42 -0
- data/lib/fog/storage/google_xml/utils.rb +83 -0
- data/tasks/bundler.rake +3 -0
- data/tasks/changelog.rake +39 -0
- data/tasks/console.rake +17 -0
- data/tasks/lint.rake +9 -0
- data/tasks/test.rake +115 -0
- data/test/helpers/client_helper.rb +63 -0
- data/test/helpers/integration_test_helper.rb +108 -0
- data/test/helpers/test_collection.rb +60 -0
- data/test/helpers/test_helper.rb +24 -0
- data/test/integration/compute/core_compute/test_client_options.rb +12 -0
- data/test/integration/compute/core_compute/test_coverage.rb +6 -0
- data/test/integration/compute/core_compute/test_disk_types.rb +43 -0
- data/test/integration/compute/core_compute/test_disks.rb +53 -0
- data/test/integration/compute/core_compute/test_images.rb +32 -0
- data/test/integration/compute/core_compute/test_machine_types.rb +55 -0
- data/test/integration/compute/core_compute/test_operations.rb +45 -0
- data/test/integration/compute/core_compute/test_projects.rb +19 -0
- data/test/integration/compute/core_compute/test_regions.rb +33 -0
- data/test/integration/compute/core_compute/test_servers.rb +149 -0
- data/test/integration/compute/core_compute/test_snapshots.rb +21 -0
- data/test/integration/compute/core_compute/test_zones.rb +35 -0
- data/test/integration/compute/core_networking/test_addresses.rb +107 -0
- data/test/integration/compute/core_networking/test_coverage.rb +6 -0
- data/test/integration/compute/core_networking/test_firewalls.rb +11 -0
- data/test/integration/compute/core_networking/test_networks.rb +41 -0
- data/test/integration/compute/core_networking/test_routes.rb +26 -0
- data/test/integration/compute/core_networking/test_subnetworks.rb +11 -0
- data/test/integration/compute/instance_groups/test_coverage.rb +6 -0
- data/test/integration/compute/instance_groups/test_instance_group_managers.rb +11 -0
- data/test/integration/compute/instance_groups/test_instance_groups.rb +11 -0
- data/test/integration/compute/instance_groups/test_instance_templates.rb +11 -0
- data/test/integration/compute/loadbalancing/test_backend_services.rb +11 -0
- data/test/integration/compute/loadbalancing/test_coverage.rb +6 -0
- data/test/integration/compute/loadbalancing/test_forwarding_rules.rb +11 -0
- data/test/integration/compute/loadbalancing/test_global_addresses.rb +11 -0
- data/test/integration/compute/loadbalancing/test_global_forwarding_rules.rb +11 -0
- data/test/integration/compute/loadbalancing/test_http_health_checks.rb +11 -0
- data/test/integration/compute/loadbalancing/test_ssl_certificates.rb +11 -0
- data/test/integration/compute/loadbalancing/test_target_http_proxies.rb +11 -0
- data/test/integration/compute/loadbalancing/test_target_https_proxies.rb +11 -0
- data/test/integration/compute/loadbalancing/test_target_instances.rb +11 -0
- data/test/integration/compute/loadbalancing/test_target_pools.rb +55 -0
- data/test/integration/compute/loadbalancing/test_url_maps.rb +11 -0
- data/test/integration/factories/addresses_factory.rb +20 -0
- data/test/integration/factories/backend_services_factory.rb +19 -0
- data/test/integration/factories/collection_factory.rb +52 -0
- data/test/integration/factories/disks_factory.rb +22 -0
- data/test/integration/factories/firewalls_factory.rb +13 -0
- data/test/integration/factories/forwarding_rules_factory.rb +25 -0
- data/test/integration/factories/global_addresses_factory.rb +15 -0
- data/test/integration/factories/global_forwarding_rules_factory.rb +20 -0
- data/test/integration/factories/http_health_checks_factory.rb +11 -0
- data/test/integration/factories/images_factory.rb +16 -0
- data/test/integration/factories/instance_group_manager_factory.rb +30 -0
- data/test/integration/factories/instance_groups_factory.rb +20 -0
- data/test/integration/factories/instance_template_factory.rb +24 -0
- data/test/integration/factories/networks_factory.rb +16 -0
- data/test/integration/factories/servers_factory.rb +30 -0
- data/test/integration/factories/sql_certs_factory.rb +20 -0
- data/test/integration/factories/sql_instances_factory.rb +19 -0
- data/test/integration/factories/sql_users_factory.rb +23 -0
- data/test/integration/factories/ssl_certificates_factory.rb +13 -0
- data/test/integration/factories/subnetworks_factory.rb +26 -0
- data/test/integration/factories/target_http_proxies_factory.rb +19 -0
- data/test/integration/factories/target_https_proxies_factory.rb +26 -0
- data/test/integration/factories/target_instances_factory.rb +24 -0
- data/test/integration/factories/target_pools_factory.rb +28 -0
- data/test/integration/factories/url_maps_factory.rb +19 -0
- data/test/integration/monitoring/test_coverage.rb +6 -0
- data/test/integration/monitoring/test_metric_descriptors.rb +131 -0
- data/test/integration/monitoring/test_monitored_resource_descriptors.rb +37 -0
- data/test/integration/monitoring/test_timeseries.rb +238 -0
- data/test/integration/pubsub/pubsub_shared.rb +75 -0
- data/test/integration/pubsub/test_coverage.rb +6 -0
- data/test/integration/pubsub/test_pubsub_models.rb +135 -0
- data/test/integration/pubsub/test_pubsub_requests.rb +105 -0
- data/test/integration/sql/test_certs.rb +50 -0
- data/test/integration/sql/test_common_flags.rb +31 -0
- data/test/integration/sql/test_common_tiers.rb +26 -0
- data/test/integration/sql/test_coverage.rb +6 -0
- data/test/integration/sql/test_instances.rb +101 -0
- data/test/integration/sql/test_users.rb +37 -0
- data/test/integration/storage/storage_shared.rb +96 -0
- data/test/integration/storage/test_buckets.rb +112 -0
- data/test/integration/storage/test_coverage.rb +6 -0
- data/test/integration/storage/test_directories.rb +67 -0
- data/test/integration/storage/test_files.rb +168 -0
- data/test/integration/storage/test_objects.rb +203 -0
- data/test/integration/test_authentication.rb +38 -0
- data/test/unit/compute/test_common_collections.rb +42 -0
- data/test/unit/compute/test_common_models.rb +35 -0
- data/test/unit/compute/test_server.rb +29 -0
- data/test/unit/dns/test_common_collections.rb +43 -0
- data/test/unit/monitoring/test_comon_collections.rb +44 -0
- data/test/unit/pubsub/test_common_collections.rb +35 -0
- data/test/unit/sql/test_common_collections.rb +46 -0
- data/test/unit/storage/test_common_json_collections.rb +38 -0
- data/test/unit/storage/test_common_xml_collections.rb +50 -0
- data/test/unit/storage/test_json_requests.rb +44 -0
- data/test/unit/storage/test_xml_requests.rb +60 -0
- metadata +897 -0
@@ -0,0 +1,203 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/storage/storage_shared"
|
3
|
+
require "securerandom"
|
4
|
+
require "base64"
|
5
|
+
require "tempfile"
|
6
|
+
require "net/http"
|
7
|
+
|
8
|
+
class TestStorageRequests < StorageShared
|
9
|
+
def test_put_object_string
|
10
|
+
object_name = new_object_name
|
11
|
+
@client.put_object(some_bucket_name, object_name, some_temp_file)
|
12
|
+
|
13
|
+
object = @client.get_object(some_bucket_name, object_name)
|
14
|
+
|
15
|
+
assert_equal(object_name, object[:name])
|
16
|
+
assert_equal(temp_file_content, object[:body])
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_put_object_nil
|
20
|
+
assert_raises(ArgumentError) do
|
21
|
+
@client.put_object(some_bucket_name, new_object_name, nil)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_put_object_file
|
26
|
+
object_name = new_object_name
|
27
|
+
expected_body = "A file body"
|
28
|
+
@client.put_object(some_bucket_name, object_name, expected_body)
|
29
|
+
|
30
|
+
object = @client.get_object(some_bucket_name, object_name)
|
31
|
+
assert_equal(object_name, object[:name])
|
32
|
+
assert_equal(expected_body, object[:body])
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_put_object_paperclip
|
36
|
+
object_name = new_object_name
|
37
|
+
paperclip_file = OpenStruct.new(:path => some_temp_file,
|
38
|
+
:content_type => "image/png")
|
39
|
+
@client.put_object(some_bucket_name, object_name, paperclip_file, :content_type => "image/png")
|
40
|
+
|
41
|
+
object = @client.get_object(some_bucket_name, object_name)
|
42
|
+
|
43
|
+
assert_equal(object_name, object[:name])
|
44
|
+
assert_equal("image/png", object[:content_type])
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_put_object_contradictory_content_type
|
48
|
+
object_name = new_object_name
|
49
|
+
file = OpenStruct.new(:path => some_temp_file,
|
50
|
+
:content_type => "text/plain")
|
51
|
+
@client.put_object(some_bucket_name, object_name, file, :content_type => "image/png")
|
52
|
+
|
53
|
+
object = @client.get_object(some_bucket_name, object_name)
|
54
|
+
|
55
|
+
assert_equal(object_name, object[:name])
|
56
|
+
assert_equal("image/png", object[:content_type])
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_put_object_predefined_acl
|
60
|
+
@client.put_object(some_bucket_name, new_object_name, some_temp_file,
|
61
|
+
:predefined_acl => "publicRead")
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_put_object_invalid_predefined_acl
|
65
|
+
assert_raises(Google::Apis::ClientError) do
|
66
|
+
@client.put_object(some_bucket_name, new_object_name, some_temp_file,
|
67
|
+
:predefined_acl => "invalidAcl")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_get_object
|
72
|
+
object = @client.get_object(some_bucket_name, some_object_name)
|
73
|
+
assert_equal(temp_file_content, object[:body])
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_delete_object
|
77
|
+
object_name = new_object_name
|
78
|
+
@client.put_object(some_bucket_name, object_name, some_temp_file)
|
79
|
+
@client.delete_object(some_bucket_name, object_name)
|
80
|
+
|
81
|
+
assert_raises(Google::Apis::ClientError) do
|
82
|
+
@client.get_object(some_bucket_name, object_name)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_object_metadata
|
87
|
+
object = @client.get_object_metadata(some_bucket_name, some_object_name)
|
88
|
+
assert_equal(temp_file_content.length, object.size)
|
89
|
+
assert_equal(some_bucket_name, object.bucket)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_copy_object
|
93
|
+
target_object_name = new_object_name
|
94
|
+
|
95
|
+
@client.copy_object(some_bucket_name, some_object_name,
|
96
|
+
some_bucket_name, target_object_name)
|
97
|
+
|
98
|
+
object = @client.get_object(some_bucket_name, target_object_name)
|
99
|
+
|
100
|
+
assert_equal(temp_file_content, object[:body])
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_copy_object_predefined_acl
|
104
|
+
target_object_name = new_object_name
|
105
|
+
|
106
|
+
res = @client.copy_object(some_bucket_name, some_object_name,
|
107
|
+
some_bucket_name, target_object_name, destination_predefined_acl: "publicRead")
|
108
|
+
|
109
|
+
result = @client.get_object(some_bucket_name, target_object_name)
|
110
|
+
|
111
|
+
response = Net::HTTP.get_response(URI(result[:self_link]))
|
112
|
+
|
113
|
+
assert_kind_of(Net::HTTPOK, response)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_list_objects
|
117
|
+
expected_object = some_object_name
|
118
|
+
|
119
|
+
result = @client.list_objects(some_bucket_name)
|
120
|
+
if result.items.nil?
|
121
|
+
raise StandardError.new("no objects found")
|
122
|
+
end
|
123
|
+
|
124
|
+
contained = result.items.any? { |object| object.name == expected_object }
|
125
|
+
assert_equal(true, contained, "expected object not present")
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_put_object_acl
|
129
|
+
object_name = new_object_name
|
130
|
+
@client.put_object(some_bucket_name, object_name, some_temp_file)
|
131
|
+
|
132
|
+
acl = {
|
133
|
+
:entity => "allUsers",
|
134
|
+
:role => "READER"
|
135
|
+
}
|
136
|
+
@client.put_object_acl(some_bucket_name, object_name, acl)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_list_object_acl
|
140
|
+
object_name = new_object_name
|
141
|
+
acls = [
|
142
|
+
{
|
143
|
+
:entity => "allUsers",
|
144
|
+
:role => "READER"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
:entity => "allAuthenticatedUsers",
|
148
|
+
:role => "READER"
|
149
|
+
}
|
150
|
+
]
|
151
|
+
@client.put_object(some_bucket_name, object_name, some_temp_file, :acl => acls)
|
152
|
+
|
153
|
+
result = @client.list_object_acl(some_bucket_name, object_name)
|
154
|
+
if result.items.nil?
|
155
|
+
raise StandardError.new("no object access controls found")
|
156
|
+
end
|
157
|
+
|
158
|
+
assert_operator(acls.length, :<=, result.items.length,
|
159
|
+
"expected at least #{acls.length} ACL items")
|
160
|
+
|
161
|
+
expected_acls = Hash[acls.map { |acl| [acl[:entity], acl[:role]] }]
|
162
|
+
num_found = 0
|
163
|
+
|
164
|
+
result.items.each do |actual_acl|
|
165
|
+
if expected_acls[actual_acl.entity] == actual_acl.role
|
166
|
+
num_found += 1
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
assert_equal(acls.length, num_found, "only found #{num_found} of #{acls.length} expected ACLs")
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_get_object_acl
|
174
|
+
object_name = new_object_name
|
175
|
+
@client.put_object(some_bucket_name, object_name, some_temp_file)
|
176
|
+
|
177
|
+
data = {
|
178
|
+
:entity => "allUsers",
|
179
|
+
:role => "READER"
|
180
|
+
}
|
181
|
+
@client.put_object_acl(some_bucket_name, object_name, data)
|
182
|
+
|
183
|
+
result = @client.get_object_acl(some_bucket_name, object_name, "allUsers")
|
184
|
+
if result.nil?
|
185
|
+
raise StandardError.new("expected object access control not found")
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_get_object_https_url
|
190
|
+
result = @client.get_object_https_url(some_bucket_name, some_object_name, 0)
|
191
|
+
assert_operator(result.length, :>, 0)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_get_object_http_url
|
195
|
+
result = @client.get_object_http_url(some_bucket_name, some_object_name, 0)
|
196
|
+
assert_operator(result.length, :>, 0)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_put_object_url
|
200
|
+
result = @client.put_object_url(some_bucket_name, new_object_name, 0)
|
201
|
+
assert_operator(result.length, :>, 0)
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
# TODO: this is a port over from legacy tests. It shouldn't be scoped under Google, but under Google::Shared.
|
4
|
+
class TestAuthentication < FogIntegrationTest
|
5
|
+
def setup
|
6
|
+
@google_json_key_location = Fog.credentials[:google_json_key_location]
|
7
|
+
@google_json_key_string = File.open(File.expand_path(@google_json_key_location), "rb", &:read)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_authenticates_with_json_key_location
|
11
|
+
c = Fog::Compute::Google.new(:google_key_location => nil,
|
12
|
+
:google_key_string => nil,
|
13
|
+
:google_json_key_location => @google_json_key_location,
|
14
|
+
:google_json_key_string => nil)
|
15
|
+
assert_kind_of(Fog::Compute::Google::Real, c)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_authenticates_with_json_key_string
|
19
|
+
c = Fog::Compute::Google.new(:google_key_location => nil,
|
20
|
+
:google_key_string => nil,
|
21
|
+
:google_json_key_location => nil,
|
22
|
+
:google_json_key_string => @google_json_key_string)
|
23
|
+
assert_kind_of(Fog::Compute::Google::Real, c)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_raises_argument_error_when_google_project_is_missing
|
27
|
+
assert_raises(ArgumentError) { Fog::Compute::Google.new(:google_project => nil) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_raises_argument_error_when_google_keys_are_given
|
31
|
+
assert_raises(ArgumentError) do
|
32
|
+
Fog::Compute::Google.new(:google_key_location => nil,
|
33
|
+
:google_key_string => nil,
|
34
|
+
:google_json_key_location => nil,
|
35
|
+
:google_json_key_string => nil)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
class UnitTestCollections < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
Fog.mock!
|
6
|
+
|
7
|
+
@client = Fog::Compute.new(provider: "google",
|
8
|
+
google_project: "foo")
|
9
|
+
|
10
|
+
# Exceptions that do not pass test_common_methods:
|
11
|
+
#
|
12
|
+
# Projects do not have a "list" method in compute API, so 'all' is not implemented
|
13
|
+
@common_method_exceptions = [Fog::Compute::Google::Projects]
|
14
|
+
# Enumerate all descendants of Fog::Collection
|
15
|
+
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a
|
16
|
+
|
17
|
+
@collections = descendants.select { |d| d.name.match(/Fog::Compute::Google/) }
|
18
|
+
end
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
Fog.unmock!
|
22
|
+
end
|
23
|
+
|
24
|
+
# This tests whether Fog::Compute::Google collections have common lifecycle methods
|
25
|
+
def test_common_methods
|
26
|
+
subjects = @collections - @common_method_exceptions
|
27
|
+
subjects.each do |klass|
|
28
|
+
obj = klass.new
|
29
|
+
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
30
|
+
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
31
|
+
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_collection_get_arguments
|
36
|
+
@collections.each do |klass|
|
37
|
+
obj = klass.new
|
38
|
+
assert_operator(obj.method(:get).arity, :<=, 1,
|
39
|
+
"#{klass} should have at most 1 required parameter in get()")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
class UnitTestModels < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
Fog.mock!
|
6
|
+
@client = Fog::Compute.new(provider: "google",
|
7
|
+
google_project: "foo")
|
8
|
+
|
9
|
+
# Do not test models that do not have a create method in API
|
10
|
+
exceptions = [Fog::Compute::Google::MachineType,
|
11
|
+
Fog::Compute::Google::Region,
|
12
|
+
Fog::Compute::Google::DiskType,
|
13
|
+
Fog::Compute::Google::Operation,
|
14
|
+
Fog::Compute::Google::Zone,
|
15
|
+
Fog::Compute::Google::Snapshot,
|
16
|
+
Fog::Compute::Google::Project]
|
17
|
+
# Enumerate all descendants of Fog::Model
|
18
|
+
descendants = ObjectSpace.each_object(Fog::Model.singleton_class).to_a
|
19
|
+
|
20
|
+
@models = descendants.select { |d| d.name.match(/Fog::Compute::Google/) } - exceptions
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
Fog.unmock!
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_common_methods
|
28
|
+
# This tests whether Fog::Compute::Google models have common lifecycle methods
|
29
|
+
@models.each do |klass|
|
30
|
+
obj = klass.new
|
31
|
+
assert obj.respond_to?(:save), "#{klass} should have a .save method"
|
32
|
+
assert obj.respond_to?(:destroy), "#{klass} should have a .destroy method"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
class UnitTestServer < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
Fog.mock!
|
6
|
+
@client = Fog::Compute.new(provider: "google",
|
7
|
+
google_project: "foo")
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
Fog.unmock!
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_if_server_accepts_ssh_keys
|
15
|
+
key = "ssh-rsa IAMNOTAREALSSHKEYAMA== user@host.subdomain.example.com"
|
16
|
+
|
17
|
+
File.stub :read, key do
|
18
|
+
server = Fog::Compute::Google::Server.new(
|
19
|
+
:name => "foo",
|
20
|
+
:machine_type => "bar",
|
21
|
+
:disks => ["baz"],
|
22
|
+
:zone => "foo",
|
23
|
+
:public_key_path => key
|
24
|
+
)
|
25
|
+
assert_equal(server.public_key, key,
|
26
|
+
"Fog::Compute::Google::Server loads public_key properly")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
class UnitTestDNSCollections < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
Fog.mock!
|
6
|
+
@client = Fog::DNS.new(provider: "google",
|
7
|
+
google_project: "foo")
|
8
|
+
|
9
|
+
# Exceptions that do not pass test_common_methods:
|
10
|
+
#
|
11
|
+
# DNS Projects API does not support 'list', so 'all' method is not possible
|
12
|
+
@common_methods_exceptions = [Fog::DNS::Google::Projects]
|
13
|
+
# Enumerate all descendants of Fog::Collection
|
14
|
+
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
15
|
+
|
16
|
+
@collections = descendants.select { |d| d.name.match(/Fog::DNS::Google/) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def teardown
|
20
|
+
Fog.unmock!
|
21
|
+
end
|
22
|
+
|
23
|
+
# This tests whether Fog::Compute::Google collections have common lifecycle methods
|
24
|
+
def test_common_methods
|
25
|
+
subjects = @collections - @common_methods_exceptions
|
26
|
+
subjects.each do |klass|
|
27
|
+
obj = klass.new
|
28
|
+
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
29
|
+
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
30
|
+
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_collection_get_arguments
|
35
|
+
# TODO: Fixture for #352
|
36
|
+
skip
|
37
|
+
@collections.each do |klass|
|
38
|
+
obj = klass.new
|
39
|
+
assert_operator(obj.method(:get).arity, :<=, 1,
|
40
|
+
"#{klass} should have at most 1 required parameter in get()")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
class UnitTestMonitoringCollections < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
Fog.mock!
|
6
|
+
@client = Fog::Monitoring.new(provider: "google",
|
7
|
+
google_project: "foo")
|
8
|
+
|
9
|
+
# Exceptions that do not pass test_common_methods:
|
10
|
+
#
|
11
|
+
# TimeSeries API has no 'get' method
|
12
|
+
@common_method_exceptions = [Fog::Google::Monitoring::TimeseriesCollection]
|
13
|
+
# Enumerate all descendants of Fog::Collection
|
14
|
+
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a
|
15
|
+
|
16
|
+
@collections = descendants.select { |d| d.name.match(/Fog::Google::Monitoring/) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def teardown
|
20
|
+
Fog.unmock!
|
21
|
+
end
|
22
|
+
|
23
|
+
# This tests whether Fog::Compute::Google collections have common lifecycle methods
|
24
|
+
def test_common_methods
|
25
|
+
subjects = @collections - @common_method_exceptions
|
26
|
+
|
27
|
+
subjects.each do |klass|
|
28
|
+
obj = klass.new
|
29
|
+
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
30
|
+
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
31
|
+
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_collection_get_arguments
|
36
|
+
@collections.each do |klass|
|
37
|
+
obj = klass.new
|
38
|
+
if obj.respond_to?(:get)
|
39
|
+
assert_operator(obj.method(:get).arity, :<=, 1,
|
40
|
+
"#{klass} should have at most 1 required parameter in get()")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
class UnitTestPubsubCollections < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
Fog.mock!
|
6
|
+
@client = Fog::Google::Pubsub.new(google_project: "foo")
|
7
|
+
|
8
|
+
# Enumerate all descendants of Fog::Collection
|
9
|
+
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
10
|
+
|
11
|
+
@collections = descendants.select { |d| d.name.match(/Fog::Google::Pubsub/) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
Fog.unmock!
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_common_methods
|
19
|
+
# This tests whether Fog::Compute::Google collections have common lifecycle methods
|
20
|
+
@collections.each do |klass|
|
21
|
+
obj = klass.new
|
22
|
+
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
23
|
+
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
24
|
+
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_collection_get_arguments
|
29
|
+
@collections.each do |klass|
|
30
|
+
obj = klass.new
|
31
|
+
assert_operator(obj.method(:get).arity, :<=, 1,
|
32
|
+
"#{klass} should have at most 1 required parameter in get()")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|