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,75 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "securerandom"
|
3
|
+
require "base64"
|
4
|
+
|
5
|
+
class PubSubShared < FogIntegrationTest
|
6
|
+
def setup
|
7
|
+
@client = Fog::Google::Pubsub.new
|
8
|
+
# Ensure any resources we create with test prefixes are removed
|
9
|
+
Minitest.after_run do
|
10
|
+
delete_test_resources
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_test_resources
|
15
|
+
topics_result = @client.list_topics
|
16
|
+
unless topics_result.topics.nil?
|
17
|
+
begin
|
18
|
+
topics_result.topics
|
19
|
+
.map(&:name)
|
20
|
+
.select { |t| t.start_with?(topic_resource_prefix) }
|
21
|
+
.each { |t| @client.delete_topic(t) }
|
22
|
+
# We ignore errors here as list operations may not represent changes applied recently.
|
23
|
+
# Hence, list operations can return a topic which has already been deleted but which we
|
24
|
+
# will attempt to delete again.
|
25
|
+
rescue Google::Apis::Error
|
26
|
+
Fog::Logger.warning("ignoring Google Api error during delete_test_resources")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
subscriptions_result = @client.list_subscriptions
|
31
|
+
unless subscriptions_result.subscriptions.nil?
|
32
|
+
begin
|
33
|
+
subscriptions_result.subscriptions
|
34
|
+
.map(&:name)
|
35
|
+
.select { |s| s.start_with?(subscription_resource_prefix) }
|
36
|
+
.each { |s| @client.delete_subscription(s) }
|
37
|
+
# We ignore errors here as list operations may not represent changes applied recently.
|
38
|
+
# Hence, list operations can return a topic which has already been deleted but which we
|
39
|
+
# will attempt to delete again.
|
40
|
+
rescue Google::Apis::Error
|
41
|
+
Fog::Logger.warning("ignoring Google Api error during delete_test_resources")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def topic_resource_prefix
|
47
|
+
"projects/#{@client.project}/topics/fog-integration-test"
|
48
|
+
end
|
49
|
+
|
50
|
+
def subscription_resource_prefix
|
51
|
+
"projects/#{@client.project}/subscriptions/fog-integration-test"
|
52
|
+
end
|
53
|
+
|
54
|
+
def new_topic_name
|
55
|
+
"#{topic_resource_prefix}-#{SecureRandom.uuid}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def new_subscription_name
|
59
|
+
"#{subscription_resource_prefix}-#{SecureRandom.uuid}"
|
60
|
+
end
|
61
|
+
|
62
|
+
def some_topic_name
|
63
|
+
# create lazily to speed tests up
|
64
|
+
@some_topic ||= new_topic_name.tap do |t|
|
65
|
+
@client.create_topic(t)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def some_subscription_name
|
70
|
+
# create lazily to speed tests up
|
71
|
+
@some_subscription ||= new_subscription_name.tap do |s|
|
72
|
+
@client.create_subscription(s, some_topic_name)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
# This is a simple coverage helper that helps differentiate
|
4
|
+
# the tests when run in parallel so the final coverage report
|
5
|
+
# can be properly combined together from multiple runners
|
6
|
+
SimpleCov.command_name "test:pubsub" if ENV["COVERAGE"]
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/pubsub/pubsub_shared"
|
3
|
+
require "securerandom"
|
4
|
+
require "base64"
|
5
|
+
|
6
|
+
class TestPubsubModels < PubSubShared
|
7
|
+
def test_topics_create
|
8
|
+
name = new_topic_name
|
9
|
+
result = @client.topics.create(:name => name)
|
10
|
+
assert_equal(result.name, name)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_topics_get
|
14
|
+
result = @client.topics.get(some_topic_name)
|
15
|
+
assert_equal(result.name, some_topic_name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_topics_all
|
19
|
+
# Force a topic to be created just so we have at least 1 to list
|
20
|
+
name = new_topic_name
|
21
|
+
@client.create_topic(name)
|
22
|
+
|
23
|
+
Fog.wait_for(5) do
|
24
|
+
result = @client.topics.all
|
25
|
+
if result.nil?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
result.any? { |topic| topic.name == name }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_topic_publish_string
|
34
|
+
@client.topics.get(some_topic_name)
|
35
|
+
message_ids = @client.topics.get(some_topic_name).publish(["apples"])
|
36
|
+
assert_operator(message_ids.length, :>, 0)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_topic_publish_hash
|
40
|
+
@client.topics.get(some_topic_name)
|
41
|
+
message_ids = @client.topics.get(some_topic_name).publish(["data" => "apples"])
|
42
|
+
assert_operator(message_ids.length, :>, 0)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_topic_delete
|
46
|
+
topic_to_delete = new_topic_name
|
47
|
+
topic = @client.topics.create(:name => topic_to_delete)
|
48
|
+
|
49
|
+
topic.destroy
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_subscriptions_create
|
53
|
+
push_config = {}
|
54
|
+
ack_deadline_seconds = 18
|
55
|
+
|
56
|
+
subscription_name = new_subscription_name
|
57
|
+
result = @client.subscriptions.create(:name => subscription_name,
|
58
|
+
:topic => some_topic_name,
|
59
|
+
:push_config => push_config,
|
60
|
+
:ack_deadline_seconds => ack_deadline_seconds)
|
61
|
+
assert_equal(result.name, subscription_name)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_subscriptions_get
|
65
|
+
subscription_name = some_subscription_name
|
66
|
+
result = @client.subscriptions.get(subscription_name)
|
67
|
+
|
68
|
+
assert_equal(result.name, subscription_name)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_subscriptions_list
|
72
|
+
# Force a subscription to be created just so we have at least 1 to list
|
73
|
+
subscription_name = new_subscription_name
|
74
|
+
@client.subscriptions.create(:name => subscription_name, :topic => some_topic_name)
|
75
|
+
|
76
|
+
Fog.wait_for(5) do
|
77
|
+
result = @client.subscriptions.all
|
78
|
+
if result.nil?
|
79
|
+
false
|
80
|
+
end
|
81
|
+
|
82
|
+
result.any? { |subscription| subscription.name == subscription_name }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_subscription_delete
|
87
|
+
push_config = {}
|
88
|
+
ack_deadline_seconds = 18
|
89
|
+
|
90
|
+
subscription_name = new_subscription_name
|
91
|
+
subscription = @client.subscriptions.create(:name => subscription_name,
|
92
|
+
:topic => some_topic_name,
|
93
|
+
:push_config => push_config,
|
94
|
+
:ack_deadline_seconds => ack_deadline_seconds)
|
95
|
+
subscription.destroy
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_subscription_pull
|
99
|
+
subscription_name = new_subscription_name
|
100
|
+
message_bytes = Base64.strict_encode64("some message")
|
101
|
+
subscription = @client.subscriptions.create(:name => subscription_name,
|
102
|
+
:topic => some_topic_name)
|
103
|
+
@client.topics.get(some_topic_name).publish(["data" => message_bytes])
|
104
|
+
|
105
|
+
result = subscription.pull(:return_immediately => false)
|
106
|
+
assert_operator(result.length, :>, 0)
|
107
|
+
|
108
|
+
contained = result.any? { |received| received.message[:data] == message_bytes }
|
109
|
+
assert_equal(true, contained, "sent messsage not contained within pulled responses")
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_subscription_acknowledge
|
113
|
+
subscription_name = new_subscription_name
|
114
|
+
subscription = @client.subscriptions.create(:name => subscription_name,
|
115
|
+
:topic => some_topic_name)
|
116
|
+
@client.topics.get(some_topic_name).publish(["data" => Base64.strict_encode64("some message")])
|
117
|
+
|
118
|
+
result = subscription.pull(:return_immediately => false)
|
119
|
+
assert_operator(result.length, :>, 0)
|
120
|
+
|
121
|
+
subscription.acknowledge([result[0].ack_id])
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_message_acknowledge
|
125
|
+
subscription_name = new_subscription_name
|
126
|
+
subscription = @client.subscriptions.create(:name => subscription_name,
|
127
|
+
:topic => some_topic_name)
|
128
|
+
@client.topics.get(some_topic_name).publish(["data" => Base64.strict_encode64("some message")])
|
129
|
+
|
130
|
+
result = subscription.pull(:return_immediately => false)
|
131
|
+
assert_operator(result.length, :>, 0)
|
132
|
+
|
133
|
+
result[0].acknowledge
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/pubsub/pubsub_shared"
|
3
|
+
require "securerandom"
|
4
|
+
require "base64"
|
5
|
+
|
6
|
+
class TestPubsubRequests < PubSubShared
|
7
|
+
def test_create_topic
|
8
|
+
name = new_topic_name
|
9
|
+
result = @client.create_topic(name)
|
10
|
+
assert_equal(result.name, name)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_get_topic
|
14
|
+
result = @client.get_topic(some_topic_name)
|
15
|
+
assert_equal(result.name, some_topic_name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_list_topics
|
19
|
+
# Force a topic to be created just so we have at least 1 to list
|
20
|
+
name = new_topic_name
|
21
|
+
@client.create_topic(name)
|
22
|
+
|
23
|
+
Fog.wait_for(5) do
|
24
|
+
result = @client.list_topics
|
25
|
+
if result.topics.nil?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
result.topics.any? { |topic| topic.name == name }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_delete_topic
|
34
|
+
topic_to_delete = new_topic_name
|
35
|
+
@client.create_topic(topic_to_delete)
|
36
|
+
|
37
|
+
@client.delete_topic(topic_to_delete)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_publish_topic
|
41
|
+
@client.publish_topic(some_topic_name, [:data => Base64.strict_encode64("some message")])
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_create_subscription
|
45
|
+
push_config = {}
|
46
|
+
ack_deadline_seconds = 18
|
47
|
+
|
48
|
+
subscription_name = new_subscription_name
|
49
|
+
result = @client.create_subscription(subscription_name, some_topic_name,
|
50
|
+
push_config, ack_deadline_seconds)
|
51
|
+
assert_equal(result.name, subscription_name)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_get_subscription
|
55
|
+
subscription_name = some_subscription_name
|
56
|
+
result = @client.get_subscription(subscription_name)
|
57
|
+
|
58
|
+
assert_equal(result.name, subscription_name)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_list_subscriptions
|
62
|
+
# Force a subscription to be created just so we have at least 1 to list
|
63
|
+
subscription_name = new_subscription_name
|
64
|
+
@client.create_subscription(subscription_name, some_topic_name)
|
65
|
+
|
66
|
+
Fog.wait_for(5) do
|
67
|
+
result = @client.list_subscriptions
|
68
|
+
if result.subscriptions.nil?
|
69
|
+
false
|
70
|
+
end
|
71
|
+
|
72
|
+
result.subscriptions.any? { |sub| sub.name == subscription_name }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_delete_subscription
|
77
|
+
subscription_to_delete = new_subscription_name
|
78
|
+
@client.create_subscription(subscription_to_delete, some_topic_name)
|
79
|
+
|
80
|
+
@client.delete_subscription(subscription_to_delete)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_pull_subscription
|
84
|
+
subscription_name = new_subscription_name
|
85
|
+
message_bytes = Base64.strict_encode64("some message")
|
86
|
+
@client.create_subscription(subscription_name, some_topic_name)
|
87
|
+
@client.publish_topic(some_topic_name, [:data => message_bytes])
|
88
|
+
|
89
|
+
result = @client.pull_subscription(subscription_name, {:return_immediately => false})
|
90
|
+
|
91
|
+
contained = result.received_messages.any? { |received| received.message.data == message_bytes }
|
92
|
+
assert_equal(true, contained, "sent messsage not contained within pulled responses")
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_acknowledge_subscription
|
96
|
+
subscription_name = new_subscription_name
|
97
|
+
@client.create_subscription(subscription_name, some_topic_name)
|
98
|
+
@client.publish_topic(some_topic_name, [:data => Base64.strict_encode64("some message")])
|
99
|
+
pull_result = @client.pull_subscription(subscription_name, {:return_immediately => false})
|
100
|
+
assert_operator(pull_result.received_messages.length, :>, 0)
|
101
|
+
|
102
|
+
@client.acknowledge_subscription(subscription_name,
|
103
|
+
pull_result.received_messages[0].ack_id)
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/factories/sql_certs_factory"
|
3
|
+
|
4
|
+
class TestSQLCerts < FogIntegrationTest
|
5
|
+
# This test doesn't include TestCollection as certs are not an independent resource.
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@subject = Fog::Google[:sql].ssl_certs
|
9
|
+
@factory = SqlCertsFactory.new(namespaced_name)
|
10
|
+
@client = Fog::Google::SQL.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
@factory.cleanup
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_ssl_certs
|
18
|
+
# Create an instance and an SSL cert
|
19
|
+
ssl_cert = @factory.create
|
20
|
+
instance_name = ssl_cert.instance
|
21
|
+
|
22
|
+
# Create a second cert and attach to the same instance
|
23
|
+
ssl_cert2 = @subject.new(:common_name => "#{ssl_cert.common_name}-2",
|
24
|
+
:instance => instance_name)
|
25
|
+
ssl_cert2.save
|
26
|
+
|
27
|
+
# Verify it can be retrieved
|
28
|
+
@subject.get(instance_name, ssl_cert2.sha1_fingerprint).tap do |result|
|
29
|
+
assert_equal(ssl_cert2.common_name, result.common_name)
|
30
|
+
assert_equal("sql#sslCert", result.kind)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Verify instance returns 2 certs
|
34
|
+
list_result = @subject.all(instance_name)
|
35
|
+
assert_equal(2, list_result.size,
|
36
|
+
"expected 2 SSL certs")
|
37
|
+
|
38
|
+
# Delete one cert
|
39
|
+
ssl_cert2.destroy(:async => false)
|
40
|
+
list_result = @subject.all(instance_name)
|
41
|
+
assert_equal(1, list_result.size,
|
42
|
+
"expected one less SSL cert after deletion")
|
43
|
+
|
44
|
+
# Test if SSL config is reset correctly
|
45
|
+
instance = @client.instances.get(instance_name)
|
46
|
+
instance.reset_ssl_config(:async => false)
|
47
|
+
assert_equal(0, @subject.all(instance_name).size,
|
48
|
+
"expected no SSL certs after reset")
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
class TestCommonFlags < FogIntegrationTest
|
4
|
+
def setup
|
5
|
+
@client = Fog::Google::SQL.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_list
|
9
|
+
resp = @client.list_flags
|
10
|
+
|
11
|
+
assert_operator(resp.items.size, :>, 0,
|
12
|
+
"resource descriptor count should be positive")
|
13
|
+
|
14
|
+
_sanity_check_flag(resp.items.first)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_all
|
18
|
+
resp = @client.flags.all
|
19
|
+
|
20
|
+
assert_operator(resp.size, :>, 0,
|
21
|
+
"resource descriptor count should be positive")
|
22
|
+
|
23
|
+
_sanity_check_flag(resp.first)
|
24
|
+
end
|
25
|
+
|
26
|
+
def _sanity_check_flag(flag)
|
27
|
+
assert_equal(flag.kind, "sql#flag")
|
28
|
+
refute(flag.name.nil?, "flag name should not be empty")
|
29
|
+
refute_empty(flag.applies_to, "flag should apply to some database version")
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
class TestCommonTiers < FogIntegrationTest
|
4
|
+
def setup
|
5
|
+
@subject = Fog::Google[:sql].tiers
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_all
|
9
|
+
tiers = @subject.all
|
10
|
+
|
11
|
+
assert_operator(tiers.size, :>, 0,
|
12
|
+
"tier count should be positive")
|
13
|
+
_sanity_check_tier(tiers.first)
|
14
|
+
end
|
15
|
+
|
16
|
+
def _sanity_check_tier(tier)
|
17
|
+
assert_equal(tier.kind, "sql#tier")
|
18
|
+
refute(tier.tier.nil?, "tier name should not be empty")
|
19
|
+
assert_operator(tier.disk_quota, :>, 0,
|
20
|
+
"tier disk quota should be positive")
|
21
|
+
assert_operator(tier.ram, :>, 0,
|
22
|
+
"tier ram should be positive")
|
23
|
+
assert_operator(tier.region.size, :>, 0,
|
24
|
+
"tier should have regions")
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
# This is a simple coverage helper that helps differentiate
|
4
|
+
# the tests when run in parallel so the final coverage report
|
5
|
+
# can be properly combined together from multiple runners
|
6
|
+
SimpleCov.command_name "test:sql" if ENV["COVERAGE"]
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/factories/sql_instances_factory"
|
3
|
+
# Client helper is imported for `wait_until_complete`
|
4
|
+
# TODO: Remove when fog-google#339 or fog-google#340 is resolved
|
5
|
+
require "helpers/client_helper"
|
6
|
+
|
7
|
+
class TestSQLV2Instances < FogIntegrationTest
|
8
|
+
include TestCollection
|
9
|
+
# TODO: Remove when fog-google#339 or fog-google#340 is resolved
|
10
|
+
include ClientHelper
|
11
|
+
attr_reader :client
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@subject = Fog::Google[:sql].instances
|
15
|
+
@factory = SqlInstancesFactory.new(namespaced_name)
|
16
|
+
@backup_runs = Fog::Google[:sql].backup_runs
|
17
|
+
# TODO: Remove after BackupRuns get save/reload - fog-google#339
|
18
|
+
# See https://github.com/fog/fog-google/issues/339
|
19
|
+
@client = Fog::Google::SQL.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_update
|
23
|
+
instance = @factory.create
|
24
|
+
|
25
|
+
settings_version = instance.settings_version
|
26
|
+
labels = {
|
27
|
+
:foo => "bar"
|
28
|
+
}
|
29
|
+
instance.settings[:user_labels] = labels
|
30
|
+
instance.save
|
31
|
+
|
32
|
+
updated = @subject.get(instance.name)
|
33
|
+
assert_equal(labels, updated.settings[:user_labels])
|
34
|
+
assert_operator(updated.settings_version, :>, settings_version)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_default_settings
|
38
|
+
instance = @factory.create
|
39
|
+
assert_equal([], instance.ssl_certs, "new instance should have 0 initial ssl certs")
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_restore_backup_run
|
43
|
+
instance = @factory.create
|
44
|
+
|
45
|
+
data = { :description => "test", :instance => instance.name }
|
46
|
+
wait_until_complete { @client.insert_backup_run(instance.name, data) }
|
47
|
+
|
48
|
+
backup_run = @backup_runs.all(instance.name).first
|
49
|
+
|
50
|
+
# Wait for backup operation to be finished
|
51
|
+
# or fail if it never finishes.
|
52
|
+
instance.restore_backup(backup_run.id, :async => false)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_backup_runs
|
56
|
+
# TODO: This probably can get pulled into the test above as those tests
|
57
|
+
# very expensive time-wize (5 minutes or so each)
|
58
|
+
instance = @factory.create
|
59
|
+
|
60
|
+
description = "test backup run"
|
61
|
+
operation = wait_until_complete do
|
62
|
+
@client.insert_backup_run(
|
63
|
+
instance.name,
|
64
|
+
:description => description
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
assert_equal(operation.operation_type, "BACKUP_VOLUME")
|
69
|
+
runs = @backup_runs.all(instance.name)
|
70
|
+
assert_operator(runs.size, :>, 0, "expected at least one backup run")
|
71
|
+
assert_equal(description, runs.first.description)
|
72
|
+
|
73
|
+
created_run = @backup_runs.get(instance.name, runs.first.id)
|
74
|
+
assert_equal(created_run, runs.first)
|
75
|
+
|
76
|
+
wait_until_complete do
|
77
|
+
@client.delete_backup_run(instance.name, runs.first.id)
|
78
|
+
end
|
79
|
+
|
80
|
+
deleted_run = @backup_runs.get(instance.name, runs.first.id)
|
81
|
+
assert_equal("DELETED", deleted_run.status)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_clone
|
85
|
+
instance = @factory.create
|
86
|
+
instance.clone("#{instance.name}-clone", :async => false)
|
87
|
+
cloned = @client.instances.get("#{instance.name}-clone")
|
88
|
+
|
89
|
+
# Sanity check some attributes
|
90
|
+
compare = %i(current_disk_size project region ip_configuration_require_ssl activation_policy)
|
91
|
+
compare.each do |k|
|
92
|
+
v = instance.attributes[k]
|
93
|
+
cloned_v = cloned.attributes[k]
|
94
|
+
if v.nil?
|
95
|
+
assert_nil(cloned_v)
|
96
|
+
else
|
97
|
+
assert_equal(v, cloned_v, "attribute #{k} in original instance is #{v}, cloned = #{cloned_v}")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|