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,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class GoogleXML
|
4
|
+
class Real
|
5
|
+
# Get an expiring object url from Google Storage for putting an object
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * bucket_name<~String> - Name of bucket containing object
|
9
|
+
# * object_name<~String> - Name of object to get expiring url for
|
10
|
+
# * expires<~Time> - An expiry time for this url
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~String> - url for object
|
15
|
+
#
|
16
|
+
def put_object_url(bucket_name, object_name, expires, headers = {})
|
17
|
+
raise ArgumentError.new("bucket_name is required") unless bucket_name
|
18
|
+
raise ArgumentError.new("object_name is required") unless object_name
|
19
|
+
https_url({
|
20
|
+
:headers => headers,
|
21
|
+
:host => @host,
|
22
|
+
:method => "PUT",
|
23
|
+
:path => "#{bucket_name}/#{object_name}"
|
24
|
+
}, expires)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
def put_object_url(bucket_name, object_name, expires, headers = {})
|
30
|
+
raise ArgumentError.new("bucket_name is required") unless bucket_name
|
31
|
+
raise ArgumentError.new("object_name is required") unless object_name
|
32
|
+
https_url({
|
33
|
+
:headers => headers,
|
34
|
+
:host => @host,
|
35
|
+
:method => "PUT",
|
36
|
+
:path => "#{bucket_name}/#{object_name}"
|
37
|
+
}, expires)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class GoogleXML
|
4
|
+
module Utils
|
5
|
+
# https://cloud.google.com/storage/docs/access-control#predefined-acl
|
6
|
+
VALID_ACLS = [
|
7
|
+
"authenticated-read",
|
8
|
+
"bucket-owner-full-control",
|
9
|
+
"bucket-owner-read",
|
10
|
+
"private",
|
11
|
+
"project-private",
|
12
|
+
"public-read",
|
13
|
+
"public-read-write"
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
def http_url(params, expires)
|
17
|
+
"http://" << host_path_query(params, expires)
|
18
|
+
end
|
19
|
+
|
20
|
+
def https_url(params, expires)
|
21
|
+
"https://" << host_path_query(params, expires)
|
22
|
+
end
|
23
|
+
|
24
|
+
def url(params, expires)
|
25
|
+
Fog::Logger.deprecation("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
|
26
|
+
https_url(params, expires)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def host_path_query(params, expires)
|
32
|
+
params[:headers]["Date"] = expires.to_i
|
33
|
+
params[:path] = Fog::Google.escape(params[:path]).gsub("%2F", "/")
|
34
|
+
query = []
|
35
|
+
|
36
|
+
if params[:query]
|
37
|
+
filtered = params[:query].reject { |k, v| k.nil? || v.nil? }
|
38
|
+
query = filtered.map { |k, v| [k.to_s, Fog::Google.escape(v)].join("=") }
|
39
|
+
end
|
40
|
+
|
41
|
+
query << "GoogleAccessId=#{@google_storage_access_key_id}"
|
42
|
+
query << "Signature=#{CGI.escape(signature(params))}"
|
43
|
+
query << "Expires=#{params[:headers]['Date']}"
|
44
|
+
"#{params[:host]}/#{params[:path]}?#{query.join('&')}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def request_params(params)
|
48
|
+
subdomain = params[:host].split(".#{@host}").first
|
49
|
+
if @path_style || subdomain !~ /^(?!goog)(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
50
|
+
if subdomain =~ /_/
|
51
|
+
# https://github.com/fog/fog/pull/1258#issuecomment-10248620.
|
52
|
+
Fog::Logger.warning("fog: the specified google storage bucket name (#{subdomain}) is not DNS compliant (only characters a through z, digits 0 through 9, and the hyphen).")
|
53
|
+
else
|
54
|
+
# - Bucket names must contain only lowercase letters, numbers, dashes (-), underscores (_), and dots (.). Names containing dots require verification.
|
55
|
+
# - Bucket names must start and end with a number or letter.
|
56
|
+
# - Bucket names must contain 3 to 63 characters. Names containing dots can contain up to 222 characters, but each dot-separated component can be no longer than 63 characters.
|
57
|
+
# - Bucket names cannot be represented as an IP address in dotted-decimal notation (for example, 192.168.5.4).
|
58
|
+
# - Bucket names cannot begin with the "goog" prefix.
|
59
|
+
# - Also, for DNS compliance, you should not have a period adjacent to another period or dash. For example, ".." or "-." or ".-" are not acceptable.
|
60
|
+
Fog::Logger.warning("fog: the specified google storage bucket name (#{subdomain}) is not a valid dns name. See: https://developers.google.com/storage/docs/bucketnaming") unless @path_style
|
61
|
+
end
|
62
|
+
|
63
|
+
params[:host] = params[:host].split("#{subdomain}.")[-1]
|
64
|
+
params[:path] =
|
65
|
+
if params[:path]
|
66
|
+
"#{subdomain}/#{params[:path]}"
|
67
|
+
else
|
68
|
+
subdomain.to_s
|
69
|
+
end
|
70
|
+
|
71
|
+
subdomain = nil
|
72
|
+
end
|
73
|
+
|
74
|
+
params[:subdomain] = subdomain if subdomain && subdomain != @host
|
75
|
+
|
76
|
+
params[:scheme] ||= @scheme
|
77
|
+
params[:port] ||= @port
|
78
|
+
params
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/tasks/bundler.rake
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
3
|
+
# Helper method to insert text after a line that matches the regex
|
4
|
+
def insert_after_line(file, insert, regex = /^## Next/)
|
5
|
+
tempfile = File.open("#{file}.tmp", "w")
|
6
|
+
f = File.new(file)
|
7
|
+
f.each do |line|
|
8
|
+
tempfile << line
|
9
|
+
next unless line =~ regex
|
10
|
+
|
11
|
+
tempfile << "\n"
|
12
|
+
tempfile << insert
|
13
|
+
tempfile << "\n"
|
14
|
+
end
|
15
|
+
f.close
|
16
|
+
tempfile.close
|
17
|
+
|
18
|
+
FileUtils.mv("#{file}.tmp", file)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Extracts all changes that have been made after the latest pushed tag
|
22
|
+
def changes_since_last_tag
|
23
|
+
`git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%t - %s%n%b%n"`
|
24
|
+
end
|
25
|
+
|
26
|
+
# Extracts all github users contributed since last tag
|
27
|
+
def users_since_last_tag
|
28
|
+
`git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%s" | cut -d' ' -f 6 | cut -d/ -f1 | sort | uniq`
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace :changelog do
|
32
|
+
task :generate do
|
33
|
+
insert_after_line("CHANGELOG.md", changes_since_last_tag, /^## Next/)
|
34
|
+
contributors = users_since_last_tag.split("\n").map { |name| "@" + name }
|
35
|
+
printf("Huge thanks to all our contributors 🎆\n")
|
36
|
+
printf("Special thanks to: " + contributors.join(" ") + "\n")
|
37
|
+
printf("\nI'll merge this and release the gem once all tests pass.\n")
|
38
|
+
end
|
39
|
+
end
|
data/tasks/console.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# From http://erniemiller.org/2014/02/05/7-lines-every-gems-rakefile-should-have/
|
2
|
+
# with some modification.
|
3
|
+
|
4
|
+
desc "Project IRB console"
|
5
|
+
task :console do
|
6
|
+
require "bundler"
|
7
|
+
Bundler.require(:default, :development)
|
8
|
+
|
9
|
+
# Reload helper to avoid resetting the environment when debugging
|
10
|
+
def reload!
|
11
|
+
files = $LOADED_FEATURES.select { |feat| feat =~ /\/fog-google\// }
|
12
|
+
files.each { |file| load file }
|
13
|
+
end
|
14
|
+
|
15
|
+
ARGV.clear
|
16
|
+
Pry.start
|
17
|
+
end
|
data/tasks/lint.rake
ADDED
data/tasks/test.rake
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require "rake/testtask"
|
2
|
+
|
3
|
+
Rake::TestTask.new do |t|
|
4
|
+
t.description = "Run integration and unit tests"
|
5
|
+
t.libs << "test"
|
6
|
+
t.pattern = File.join("test", "**", "test_*.rb")
|
7
|
+
t.warning = false
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :test do
|
11
|
+
mock = ENV["FOG_MOCK"] || "true"
|
12
|
+
task :travis do
|
13
|
+
sh("bundle exec rake test:unit")
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Run all integration tests in parallel"
|
17
|
+
multitask :parallel => ["test:compute",
|
18
|
+
"test:monitoring",
|
19
|
+
"test:pubsub",
|
20
|
+
"test:sql",
|
21
|
+
"test:storage"]
|
22
|
+
|
23
|
+
Rake::TestTask.new do |t|
|
24
|
+
t.name = "unit"
|
25
|
+
t.description = "Run Unit tests"
|
26
|
+
t.libs << "test"
|
27
|
+
t.pattern = FileList["test/unit/**/test_*.rb"]
|
28
|
+
t.warning = false
|
29
|
+
t.verbose = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# This autogenerates rake tasks based on test folder structures
|
33
|
+
# This is done to simplify running many test suites in parallel
|
34
|
+
COMPUTE_TEST_TASKS = []
|
35
|
+
Dir.glob("test/integration/compute/**").each do |task|
|
36
|
+
suite_collection = task.gsub(/test\/integration\/compute\//, "")
|
37
|
+
component_name = task.gsub(/test\/integration\//, "").split("/").first
|
38
|
+
Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
|
39
|
+
t.libs << "test"
|
40
|
+
t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
|
41
|
+
t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
|
42
|
+
t.warning = false
|
43
|
+
t.verbose = true
|
44
|
+
end
|
45
|
+
COMPUTE_TEST_TASKS << "#{component_name}-#{suite_collection}"
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Run Compute API tests"
|
49
|
+
task :compute => COMPUTE_TEST_TASKS
|
50
|
+
|
51
|
+
desc "Run Compute API tests in parallel"
|
52
|
+
multitask :compute_parallel => COMPUTE_TEST_TASKS
|
53
|
+
|
54
|
+
Rake::TestTask.new do |t|
|
55
|
+
t.name = "monitoring"
|
56
|
+
t.description = "Run Monitoring API tests"
|
57
|
+
t.libs << "test"
|
58
|
+
t.pattern = FileList["test/integration/monitoring/test_*.rb"]
|
59
|
+
t.warning = false
|
60
|
+
t.verbose = true
|
61
|
+
end
|
62
|
+
|
63
|
+
Rake::TestTask.new do |t|
|
64
|
+
t.name = "pubsub"
|
65
|
+
t.description = "Run PubSub API tests"
|
66
|
+
t.libs << "test"
|
67
|
+
t.pattern = FileList["test/integration/pubsub/test_*.rb"]
|
68
|
+
t.warning = false
|
69
|
+
t.verbose = true
|
70
|
+
end
|
71
|
+
|
72
|
+
# This autogenerates rake tasks based on test folder structures
|
73
|
+
# This is done to simplify running many test suites in parallel
|
74
|
+
SQL_TEST_TASKS = []
|
75
|
+
Dir.glob("test/integration/sql/**").each do |task|
|
76
|
+
suite_collection = task.gsub(/test\/integration\/sql\//, "")
|
77
|
+
component_name = task.gsub(/test\/integration\//, "").split("/").first
|
78
|
+
Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
|
79
|
+
t.libs << "test"
|
80
|
+
t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
|
81
|
+
t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
|
82
|
+
t.warning = false
|
83
|
+
t.verbose = true
|
84
|
+
end
|
85
|
+
SQL_TEST_TASKS << "#{component_name}-#{suite_collection}"
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "Run SQL API tests"
|
89
|
+
task :sql => SQL_TEST_TASKS
|
90
|
+
|
91
|
+
desc "Run SQL API tests in parallel"
|
92
|
+
multitask :sql_parallel => SQL_TEST_TASKS
|
93
|
+
|
94
|
+
# TODO(temikus): Remove after v1 is renamed in pipeline
|
95
|
+
desc "Run SQL API tests - v1 compat alias"
|
96
|
+
task :"sql-sqlv2" => :sql
|
97
|
+
|
98
|
+
Rake::TestTask.new do |t|
|
99
|
+
t.name = "sql"
|
100
|
+
t.description = "Run SQL API tests"
|
101
|
+
t.libs << "test"
|
102
|
+
t.pattern = FileList["test/integration/sql/test_*.rb"]
|
103
|
+
t.warning = false
|
104
|
+
t.verbose = true
|
105
|
+
end
|
106
|
+
|
107
|
+
Rake::TestTask.new do |t|
|
108
|
+
t.name = "storage"
|
109
|
+
t.description = "Run Storage API tests"
|
110
|
+
t.libs << "test"
|
111
|
+
t.pattern = FileList["test/integration/storage/test_*.rb"]
|
112
|
+
t.warning = false
|
113
|
+
t.verbose = true
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
##
|
2
|
+
# Helper mixin for tests (especially compute-based ones). Provide access to the
|
3
|
+
# client in use via the #client method to use.
|
4
|
+
|
5
|
+
module ClientHelper
|
6
|
+
# Check to see if an compute operation is finished.
|
7
|
+
#
|
8
|
+
# @param op [Google::Apis::ComputeV1::Operation] the operation object returned from an api call
|
9
|
+
# @return [Bolean] true if the operation is no longer executing, false
|
10
|
+
# otherwise
|
11
|
+
def operation_finished?(op)
|
12
|
+
region = op.region
|
13
|
+
zone = op.zone
|
14
|
+
name = op.name
|
15
|
+
|
16
|
+
if zone.nil?
|
17
|
+
result = client.get_region_operation(region, name)
|
18
|
+
else
|
19
|
+
result = client.get_zone_operation(zone, name)
|
20
|
+
end
|
21
|
+
!%w(PENDING RUNNING).include?(result.status)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Check to see if an SQL operation is finished.
|
25
|
+
#
|
26
|
+
# @param op [Google::Apis::SqladminV1beta4::Operation] the operation object
|
27
|
+
# returned from an SQL Admin api call
|
28
|
+
# @return [Boolean] true if the operation is no longer executing, false
|
29
|
+
# otherwise
|
30
|
+
def sql_operation_finished?(op)
|
31
|
+
result = client.get_operation(op.name)
|
32
|
+
!%w(PENDING RUNNING).include?(result.status)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Pause execution until an operation (compute or sql) returned
|
36
|
+
# from a passed block is finished.
|
37
|
+
#
|
38
|
+
# @example Pause until server is provisioned
|
39
|
+
# @result = wait_until_complete { client.insert_server(name, zone, opts) }
|
40
|
+
# @yieldreturn The resulting operation object from a block.
|
41
|
+
# @return the result of the operation
|
42
|
+
|
43
|
+
def wait_until_complete
|
44
|
+
result = yield
|
45
|
+
|
46
|
+
case result.kind
|
47
|
+
when "compute#operation"
|
48
|
+
region = result.region
|
49
|
+
zone = result.zone
|
50
|
+
Fog.wait_for { operation_finished?(result) }
|
51
|
+
if zone.nil?
|
52
|
+
client.get_region_operation(region, result.name)
|
53
|
+
else
|
54
|
+
client.get_zone_operation(zone, result.name)
|
55
|
+
end
|
56
|
+
when "sql#operation"
|
57
|
+
Fog.wait_for { sql_operation_finished?(result) }
|
58
|
+
client.get_operation(result.name)
|
59
|
+
else
|
60
|
+
result
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
require "helpers/test_collection"
|
3
|
+
require "retriable"
|
4
|
+
|
5
|
+
# Use :test credentials in ~/.fog for live integration testing
|
6
|
+
# XXX not sure if this will work on Travis CI or not
|
7
|
+
Fog.credential = :test
|
8
|
+
|
9
|
+
# Enable test debugging, providing additional information in some methods
|
10
|
+
DEBUG = ENV['FOG_TEST_DEBUG'] || false
|
11
|
+
|
12
|
+
# Helpers
|
13
|
+
|
14
|
+
TEST_PROJECT = Fog.credentials[:google_project]
|
15
|
+
|
16
|
+
TEST_ZONE = "us-central1-f".freeze
|
17
|
+
TEST_REGION = "us-central1".freeze
|
18
|
+
TEST_SIZE_GB = 10
|
19
|
+
TEST_MACHINE_TYPE = "n1-standard-1".freeze
|
20
|
+
TEST_IMAGE = "debian-9-stretch-v20180611".freeze
|
21
|
+
TEST_IMAGE_PROJECT = "debian-cloud".freeze
|
22
|
+
TEST_IMAGE_FAMILY = "debian-9".freeze
|
23
|
+
|
24
|
+
# XXX This depends on a public image in gs://fog-test-bucket; there may be a better way to do this
|
25
|
+
# The image was created like so: https://cloud.google.com/compute/docs/images#export_an_image_to_google_cloud_storage
|
26
|
+
TEST_RAW_DISK_SOURCE = "https://storage.googleapis.com/fog-testing-bucket/fog-test-raw-disk-source.image.tar.gz".freeze
|
27
|
+
|
28
|
+
TEST_SQL_TIER = "db-n1-standard-1".freeze
|
29
|
+
TEST_SQL_REGION = TEST_REGION
|
30
|
+
|
31
|
+
# Test certificate/key for SSL Proxy tests, generated via:
|
32
|
+
# $ openssl genrsa -out example.key 2048
|
33
|
+
# $ openssl req -new -key example.key -out example.csr
|
34
|
+
# ...
|
35
|
+
# Common Name (eg, fully qualified host name) []:example.com
|
36
|
+
# Email Address []:admin@example.com
|
37
|
+
# ...
|
38
|
+
# $ openssl x509 -req -in example.csr -signkey example.key -out example.crt
|
39
|
+
|
40
|
+
TEST_PEM_CERTIFICATE = <<CERT
|
41
|
+
-----BEGIN CERTIFICATE-----
|
42
|
+
MIIC7DCCAdQCCQCDSZQ3PYJW6zANBgkqhkiG9w0BAQUFADA4MRQwEgYDVQQDDAtl
|
43
|
+
eGFtcGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wHhcN
|
44
|
+
MTgwNjI4MDEzMzA5WhcNMTgwNzI4MDEzMzA5WjA4MRQwEgYDVQQDDAtleGFtcGxl
|
45
|
+
LmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wggEiMA0GCSqG
|
46
|
+
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2DQkr6HBIoVsi7I+uHtmmge1KvbWP4nwg
|
47
|
+
tmKe8FtprjyaBcY729Sc0LTgkOh0krVem9nsxd/Lea47jHTV/vM03xsOuEKRKy3S
|
48
|
+
Horlr0TBRvB7tSmZCH0jn4x+V/k2qdLKhiDAtbLZ1UC3SWu3OjbE9ozf3fNPmssT
|
49
|
+
bK2sNesa2XlydzL8wyZMajGLs8CEHVqpZwLSPTeGB3LAhdRjfzJLijqe124otVIb
|
50
|
+
3+tbxYZVY5GLVQIIR/DlwRzZLxptPALvHq3t3eOfC3eZImXqUzGmoug6nDrdKuEs
|
51
|
+
C8yaoCNC3sSecoaV5Kyy70Hae+wFV7ocZGejm9AtuHXF1pgM4outAgMBAAEwDQYJ
|
52
|
+
KoZIhvcNAQEFBQADggEBAFRYuOe7nwR8Sn7TDyzPcqau3yF2qYATtrDIzo7xmh3o
|
53
|
+
T18FYCeX9gu/M9ytziM2lb/+WRqvcu55FrQiBz434E4wYH/IGUZK849V03dCro10
|
54
|
+
Po5Hhayt5+tv5Ti0JqmJoC/HN0hNF+WQA8kikiteTTohIDj9rVX2uULA61rnHXSZ
|
55
|
+
h6ZZRce3PdRKIUjOcQ4pIoI8QXSIToBsdY+Cieg9PHCt8mZhevU7COE1lfPFtdlY
|
56
|
+
HJhg5xhHVUt40qsahpvUjnPBU8rJPPE06ougf5qjr0D8ZoYeuUQT0VJYwwacfpeb
|
57
|
+
hs6AFOH5IAj6gjdIRhOWzYSxBYeyzJGfiPSbK4rowFM=
|
58
|
+
-----END CERTIFICATE-----
|
59
|
+
CERT
|
60
|
+
|
61
|
+
TEST_PEM_CERTIFICATE_PRIVATE_KEY = <<KEY
|
62
|
+
-----BEGIN RSA PRIVATE KEY-----
|
63
|
+
MIIEpAIBAAKCAQEAtg0JK+hwSKFbIuyPrh7ZpoHtSr21j+J8ILZinvBbaa48mgXG
|
64
|
+
O9vUnNC04JDodJK1XpvZ7MXfy3muO4x01f7zNN8bDrhCkSst0h6K5a9EwUbwe7Up
|
65
|
+
mQh9I5+Mflf5NqnSyoYgwLWy2dVAt0lrtzo2xPaM393zT5rLE2ytrDXrGtl5cncy
|
66
|
+
/MMmTGoxi7PAhB1aqWcC0j03hgdywIXUY38yS4o6ntduKLVSG9/rW8WGVWORi1UC
|
67
|
+
CEfw5cEc2S8abTwC7x6t7d3jnwt3mSJl6lMxpqLoOpw63SrhLAvMmqAjQt7EnnKG
|
68
|
+
leSssu9B2nvsBVe6HGRno5vQLbh1xdaYDOKLrQIDAQABAoIBAD5GA0cjwZT2rQgr
|
69
|
+
R5LWNrmAZD1W246WeMNv4BhiO8LQuSYup3q+XeIuelD/AKUvsh7kzQzzOvSNcQ4p
|
70
|
+
o6W4ClWho83LNeoWjRv9GqIq7Cf5LjYC6HHSt4vB/fsR+Mu8F8DzVKzW+pENI5AO
|
71
|
+
62vH3AhQFixV7e7jEmhYmqf34a5S9U3+0OkzRRbFVA5rBxKK4xLqrX/app4/TKs6
|
72
|
+
msn+qCJUAVxggcKIACF0slzbGuKfCSOyfPM4dmKV1n857wDu2YB9QwaaI+aHtR9S
|
73
|
+
rassm1TCcqirUIOsTcAaZ5szjkhAhH+pg/xVjl/2ppz1W/m9cfNQ4zwle1YuUmpS
|
74
|
+
OxyqUcECgYEA8jQ0zZG4J7MOX29o2F+D4VI5I1kp6uLsfhb8KztEgpgdMy+nGNsK
|
75
|
+
wlOd2fJU3hK51dg82HKSSEzHHPud7O39pWEo3iSmgdZ+pXhjXe95x+bVPfP01eSp
|
76
|
+
CSyMP8t6c9RxVtpVU1IbrjMXROuwEIxaIzMhT4YYDGOoSj2xLn43N9kCgYEAwGuv
|
77
|
+
MJeCDMI2Zr+OA1N3FUk6Py8q1zxJN3Wt3CwSjp57K3g2LaqN6gwgIbN3d1fEV9cM
|
78
|
+
ATtjjsFC+toFrP8BZ1wj3DY8Q4OsOmXng1V4bw4Y5xsT6SxXh7E0gU2L8MCjUdri
|
79
|
+
WUUu++yRRcUpWUGRRMYx6cN529HPNbAPm5Y8QfUCgYAGpCHShS1cgU9ilIZ2cGAI
|
80
|
+
XJ3Od1Jr6176shyl/tEJF6ytS6A0UUVBQNOyNy/WiwLndy9r6/BQ5TIMfGW/KmNr
|
81
|
+
FnftZ2ndY4lDdkKbP8bCEXVFZpwPBV8RLlSGJ0krReb5r7DpQPYbV7FKpX/FZGPQ
|
82
|
+
VUWTjaS5Kj5iEsD5+mH/OQKBgQCKhftc8/V/0eDwHz7RTikQfeMc0Yv530CmWGWN
|
83
|
+
d3z0h0sMhEIcpgf8UjZfjJ+YnuqOghX2XRbTEnZxuLsVS49rJX37bl/8CrLWZ74/
|
84
|
+
YiyNZoyu82NmHbH10bCG1ZjE/SmWKAmDUrb8TdZXcBTQWM+Hv1b3fu4fPe/6KoFR
|
85
|
+
9Nn0cQKBgQC8BViTyfPTSuTEb8z7uzLEQk13MH+LTHFngFevWoq3OStEsmsIYK1K
|
86
|
+
GcF1N9ZzPH024uwdcLjjwpul/avUHqzfp5ZILuI83Z/OqYYLiCQ0BbAQno7Cp5Be
|
87
|
+
wLjafhPTSAIS0jijglJ7uzaSbFUW11fw1/EIqIFNe0R0Xf9lsyPxFA==
|
88
|
+
-----END RSA PRIVATE KEY-----
|
89
|
+
KEY
|
90
|
+
|
91
|
+
# Retry module config - standard retriable gem settings
|
92
|
+
# see: https://github.com/kamui/retriable
|
93
|
+
RETRIABLE_TRIES = 3
|
94
|
+
RETRIABLE_BASE_INTERVAL = 50
|
95
|
+
|
96
|
+
class FogIntegrationTest < MiniTest::Test
|
97
|
+
def namespaced_name
|
98
|
+
"#{self.class}_#{name}"
|
99
|
+
end
|
100
|
+
|
101
|
+
def retry_on(klass)
|
102
|
+
Retriable.retriable(on: klass,
|
103
|
+
tries: RETRIABLE_TRIES,
|
104
|
+
base_interval: RETRIABLE_BASE_INTERVAL) do
|
105
|
+
yield
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|