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,19 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
|
3
|
+
class SqlInstancesFactory < CollectionFactory
|
4
|
+
def initialize(example)
|
5
|
+
super(Fog::Google[:sql].instances, example)
|
6
|
+
end
|
7
|
+
|
8
|
+
def cleanup
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def params
|
13
|
+
# Name has a time suffix due to SQL resources API objects having
|
14
|
+
# a _very_ long life on the backend (n(days)) after deletion.
|
15
|
+
{ :name => "#{resource_name}-#{Time.now.to_i}",
|
16
|
+
:region => TEST_SQL_REGION,
|
17
|
+
:tier => TEST_SQL_TIER }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/sql_instances_factory"
|
3
|
+
|
4
|
+
class SqlUsersFactory < CollectionFactory
|
5
|
+
def initialize(example)
|
6
|
+
@instances = SqlInstancesFactory.new(example)
|
7
|
+
super(Fog::Google[:sql].users, example)
|
8
|
+
end
|
9
|
+
|
10
|
+
def cleanup
|
11
|
+
# Users will be cleaned up with the test instance.
|
12
|
+
@instances.cleanup
|
13
|
+
end
|
14
|
+
|
15
|
+
def params
|
16
|
+
# Username should not be longer than 16 characters
|
17
|
+
{ :name => resource_name[0..15],
|
18
|
+
# TODO: Consider removing host when Users.list API issue is resolved
|
19
|
+
# See https://github.com/fog/fog-google/issues/462
|
20
|
+
:host => "%",
|
21
|
+
:instance => @instances.create.name }
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
|
3
|
+
class SslCertificatesFactory < CollectionFactory
|
4
|
+
def initialize(example)
|
5
|
+
super(Fog::Compute[:google].ssl_certificates, example)
|
6
|
+
end
|
7
|
+
|
8
|
+
def params
|
9
|
+
{ :name => resource_name,
|
10
|
+
:certificate => TEST_PEM_CERTIFICATE,
|
11
|
+
:private_key => TEST_PEM_CERTIFICATE_PRIVATE_KEY }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
|
3
|
+
class SubnetworksFactory < CollectionFactory
|
4
|
+
def initialize(example)
|
5
|
+
# We cannot have 2 subnetworks with the same CIDR range so instantiating a
|
6
|
+
# class variable holding a generator, ensuring that the factory gives us a
|
7
|
+
# new subnet every time it's called
|
8
|
+
@octet_generator = (0..255).each
|
9
|
+
super(Fog::Compute[:google].subnetworks, example)
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(identity)
|
13
|
+
@subject.get(identity, TEST_REGION)
|
14
|
+
end
|
15
|
+
|
16
|
+
def all
|
17
|
+
@subject.all(region: TEST_REGION)
|
18
|
+
end
|
19
|
+
|
20
|
+
def params
|
21
|
+
{ :name => resource_name,
|
22
|
+
:network => "default",
|
23
|
+
:region => TEST_REGION,
|
24
|
+
:ip_cidr_range => "192.168.#{@octet_generator.next}.0/24" }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/url_maps_factory"
|
3
|
+
|
4
|
+
class TargetHttpProxiesFactory < CollectionFactory
|
5
|
+
def initialize(example)
|
6
|
+
@url_maps = UrlMapsFactory.new(example)
|
7
|
+
super(Fog::Compute[:google].target_http_proxies, example)
|
8
|
+
end
|
9
|
+
|
10
|
+
def cleanup
|
11
|
+
super
|
12
|
+
@url_maps.cleanup
|
13
|
+
end
|
14
|
+
|
15
|
+
def params
|
16
|
+
{ :name => resource_name,
|
17
|
+
:url_map => @url_maps.create.self_link }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/url_maps_factory"
|
3
|
+
require "integration/factories/ssl_certificates_factory"
|
4
|
+
|
5
|
+
class TargetHttpsProxiesFactory < CollectionFactory
|
6
|
+
def initialize(example)
|
7
|
+
@ssl_certificates = SslCertificatesFactory.new(example)
|
8
|
+
@url_maps = UrlMapsFactory.new(example)
|
9
|
+
super(Fog::Compute[:google].target_https_proxies, example)
|
10
|
+
end
|
11
|
+
|
12
|
+
def cleanup
|
13
|
+
# Calling CollectionFactory#cleanup with forced async as
|
14
|
+
# Url Maps need the Https Proxy to be deleted before they
|
15
|
+
# can be destroyed
|
16
|
+
super(false)
|
17
|
+
@ssl_certificates.cleanup
|
18
|
+
@url_maps.cleanup
|
19
|
+
end
|
20
|
+
|
21
|
+
def params
|
22
|
+
{ :name => resource_name,
|
23
|
+
:url_map => @url_maps.create.self_link,
|
24
|
+
:ssl_certificates => [@ssl_certificates.create.self_link] }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/servers_factory"
|
3
|
+
|
4
|
+
class TargetInstancesFactory < CollectionFactory
|
5
|
+
def initialize(example)
|
6
|
+
@servers = ServersFactory.new(example)
|
7
|
+
super(Fog::Compute[:google].target_instances, example)
|
8
|
+
end
|
9
|
+
|
10
|
+
def cleanup
|
11
|
+
super
|
12
|
+
@servers.cleanup
|
13
|
+
end
|
14
|
+
|
15
|
+
def all
|
16
|
+
@subject.all(zone: TEST_ZONE)
|
17
|
+
end
|
18
|
+
|
19
|
+
def params
|
20
|
+
{ :name => resource_name,
|
21
|
+
:zone => TEST_ZONE,
|
22
|
+
:instance => @servers.create.self_link }
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/servers_factory"
|
3
|
+
require "integration/factories/http_health_checks_factory"
|
4
|
+
|
5
|
+
class TargetPoolsFactory < CollectionFactory
|
6
|
+
def initialize(example)
|
7
|
+
@http_health_checks = HttpHealthChecksFactory.new(example)
|
8
|
+
@servers = ServersFactory.new(example)
|
9
|
+
super(Fog::Compute[:google].target_pools, example)
|
10
|
+
end
|
11
|
+
|
12
|
+
def cleanup
|
13
|
+
super
|
14
|
+
@servers.cleanup
|
15
|
+
@http_health_checks.cleanup
|
16
|
+
end
|
17
|
+
|
18
|
+
def all
|
19
|
+
@subject.all(region: TEST_REGION)
|
20
|
+
end
|
21
|
+
|
22
|
+
def params
|
23
|
+
{ :name => resource_name,
|
24
|
+
:region => TEST_REGION,
|
25
|
+
:instances => [@servers.create.self_link, @servers.create.self_link],
|
26
|
+
:health_checks => [@http_health_checks.create.self_link] }
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/backend_services_factory"
|
3
|
+
|
4
|
+
class UrlMapsFactory < CollectionFactory
|
5
|
+
def initialize(example)
|
6
|
+
@backend_services = BackendServicesFactory.new(example)
|
7
|
+
super(Fog::Compute[:google].url_maps, example)
|
8
|
+
end
|
9
|
+
|
10
|
+
def cleanup
|
11
|
+
super
|
12
|
+
@backend_services.cleanup
|
13
|
+
end
|
14
|
+
|
15
|
+
def params
|
16
|
+
{ :name => resource_name,
|
17
|
+
:default_service => @backend_services.create.self_link }
|
18
|
+
end
|
19
|
+
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:monitoring" if ENV["COVERAGE"]
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "helpers/client_helper"
|
3
|
+
|
4
|
+
class TestMetricDescriptors < FogIntegrationTest
|
5
|
+
TEST_METRIC_TYPE_PREFIX = "custom.googleapis.com/fog-google-test/test-metric-descriptors".freeze
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@client = Fog::Google::Monitoring.new
|
9
|
+
# Ensure any resources we create with test prefixes are removed
|
10
|
+
Minitest.after_run do
|
11
|
+
delete_test_resources
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete_test_resources
|
16
|
+
test_resources = @client.monitoring.list_project_metric_descriptors(
|
17
|
+
"projects/#{@project}",
|
18
|
+
:filter => "metric.type = starts_with(\"#{TEST_METRIC_TYPE_PREFIX}\")"
|
19
|
+
)
|
20
|
+
unless test_resources.metric_descriptors.nil?
|
21
|
+
test_resources.metric_descriptors.each do |md|
|
22
|
+
@client.monitoring.delete_project_metric_descriptors(md.name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
rescue
|
26
|
+
# Do nothing
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_list_metric_descriptors
|
30
|
+
list_resp = @client.list_metric_descriptors
|
31
|
+
assert_operator(list_resp.metric_descriptors.size, :>, 0,
|
32
|
+
"metric descriptor count should be positive")
|
33
|
+
|
34
|
+
resp = @client.list_metric_descriptors(
|
35
|
+
:filter => 'metric.type = starts_with("compute.googleapis.com")',
|
36
|
+
:page_size => 5
|
37
|
+
)
|
38
|
+
assert_operator(resp.metric_descriptors.size, :<=, 5,
|
39
|
+
"metric descriptor count should be <= page size 5")
|
40
|
+
|
41
|
+
resp = @client.list_metric_descriptors(:page_size => 1)
|
42
|
+
assert_equal(resp.metric_descriptors.size, 1,
|
43
|
+
"metric descriptor count should be page size 1")
|
44
|
+
|
45
|
+
next_resp = @client.list_metric_descriptors(
|
46
|
+
:page_size => 1,
|
47
|
+
:page_token => resp.next_page_token
|
48
|
+
)
|
49
|
+
assert_equal(next_resp.metric_descriptors.size, 1, "metric descriptor count should be page size 1")
|
50
|
+
assert(resp.metric_descriptors[0].name != next_resp.metric_descriptors[0].name,
|
51
|
+
"paginated result should not be the same value")
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_create_custom_metric_descriptors
|
55
|
+
metric_type = "#{TEST_METRIC_TYPE_PREFIX}/test-create"
|
56
|
+
label = {
|
57
|
+
:key => "foo",
|
58
|
+
:value_type => "INT64",
|
59
|
+
:description => "test label for a metric descriptor"
|
60
|
+
}
|
61
|
+
options = {
|
62
|
+
:metric_type => metric_type,
|
63
|
+
:unit => "1",
|
64
|
+
:value_type => "INT64",
|
65
|
+
:description => "A custom metric descriptor for fog-google metric descriptor tests.",
|
66
|
+
:display_name => "fog-google/test-metric-descriptor",
|
67
|
+
:metric_kind => "GAUGE",
|
68
|
+
:labels => [label]
|
69
|
+
}
|
70
|
+
|
71
|
+
created = @client.create_metric_descriptor(options)
|
72
|
+
|
73
|
+
# Check created metric descriptor
|
74
|
+
assert_equal(_full_name(metric_type), created.name)
|
75
|
+
assert_equal(metric_type, created.type)
|
76
|
+
assert_equal(options[:metric_kind], created.metric_kind)
|
77
|
+
assert_equal(options[:value_type], created.value_type)
|
78
|
+
assert_equal(options[:unit], created.unit)
|
79
|
+
assert_equal(options[:description], created.description)
|
80
|
+
assert_equal(options[:display_name], created.display_name)
|
81
|
+
|
82
|
+
assert_equal(created.labels.size, 1, "expected 1 label, got #{created.labels.size}")
|
83
|
+
label_descriptor = created.labels.first
|
84
|
+
assert_equal(label[:key], label_descriptor.key)
|
85
|
+
assert_equal(label[:value_type], label_descriptor.value_type)
|
86
|
+
assert_equal(label[:description], label_descriptor.description)
|
87
|
+
|
88
|
+
Fog.wait_for(30) do
|
89
|
+
begin
|
90
|
+
get_resp = @client.get_metric_descriptor(metric_type)
|
91
|
+
return !get_resp.nil?
|
92
|
+
rescue
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
list_resp = @client.list_metric_descriptor(:filter => "metric.type = \"#{metric_type}\"", :page_size => 1)
|
98
|
+
assert(!list_resp.metric_descriptors.nil?, "expected non-empty list request for metric descriptors")
|
99
|
+
|
100
|
+
assert_empty(@client.delete_metric_descriptor(metric_type))
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_metric_descriptors_all
|
104
|
+
descriptors = @client.metric_descriptors.all
|
105
|
+
assert_operator(descriptors.size, :>, 0,
|
106
|
+
"metric descriptor count should be positive")
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_metric_descriptors_all_page_size
|
110
|
+
descriptors = @client.metric_descriptors.all(
|
111
|
+
:filter => 'metric.type = starts_with("compute.googleapis.com")',
|
112
|
+
:page_size => 5
|
113
|
+
)
|
114
|
+
assert_operator(descriptors.size, :<=, 5,
|
115
|
+
"metric descriptor count should be <= page size 5")
|
116
|
+
|
117
|
+
descriptors = @client.metric_descriptors.all(:page_size => 2)
|
118
|
+
assert_equal(descriptors.size, 2, "metric descriptor count should be page size 2")
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_metric_descriptors_get
|
122
|
+
builtin_test_type = "compute.googleapis.com/instance/cpu/usage_time"
|
123
|
+
|
124
|
+
descriptor = @client.metric_descriptors.get("compute.googleapis.com/instance/cpu/usage_time")
|
125
|
+
assert_equal(descriptor.type, builtin_test_type)
|
126
|
+
end
|
127
|
+
|
128
|
+
def _full_name(metric_type)
|
129
|
+
"projects/#{@client.project}/metricDescriptors/#{metric_type}"
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
class TestMetricDescriptors < FogIntegrationTest
|
4
|
+
def setup
|
5
|
+
@client = Fog::Google::Monitoring.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_list_and_get
|
9
|
+
resp = @client.list_monitored_resource_descriptors
|
10
|
+
|
11
|
+
assert_operator(resp.resource_descriptors.size, :>, 0,
|
12
|
+
"resource descriptor count should be positive")
|
13
|
+
|
14
|
+
@client.get_monitored_resource_descriptor(
|
15
|
+
resp.resource_descriptors.first.type
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_all
|
20
|
+
resp = @client.monitored_resource_descriptors.all
|
21
|
+
|
22
|
+
assert_operator(resp.size, :>, 0,
|
23
|
+
"resource descriptor count should be positive")
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_get
|
27
|
+
resource = "global"
|
28
|
+
descriptor = @client.monitored_resource_descriptors.get(resource)
|
29
|
+
|
30
|
+
assert_equal(
|
31
|
+
descriptor.name,
|
32
|
+
"projects/#{@client.project}/monitoredResourceDescriptors/#{resource}"
|
33
|
+
)
|
34
|
+
assert_equal(descriptor.labels.size, 1)
|
35
|
+
assert_equal(descriptor.labels.first[:key], "project_id")
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,238 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
|
3
|
+
class TestMetricDescriptors < FogIntegrationTest
|
4
|
+
# This module has a decent amount of retry wrappers as the Stackdriver API
|
5
|
+
# can be quite slow with metric propagation (sometimes 80+ seconds) and client
|
6
|
+
# returning errors, e.g. Google::Apis::ClientError: badRequest if the metric
|
7
|
+
# hasn't yet been created instead of a 404.
|
8
|
+
|
9
|
+
TEST_METRIC_PREFIX = "custom.googleapis.com/fog-google-test/timeseries".freeze
|
10
|
+
LABEL_DESCRIPTORS = [
|
11
|
+
{
|
12
|
+
:key => "test_string_label",
|
13
|
+
:value_type => "STRING",
|
14
|
+
:description => "test string label"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
:key => "test_bool_label",
|
18
|
+
:value_type => "BOOL",
|
19
|
+
:description => "test boolean label"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
:key => "test_int_label",
|
23
|
+
:value_type => "INT64",
|
24
|
+
:description => "test integer label"
|
25
|
+
}
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
def setup
|
29
|
+
@client = Fog::Google::Monitoring.new
|
30
|
+
# Ensure any resources we create with test prefixes are removed
|
31
|
+
|
32
|
+
Minitest.after_run do
|
33
|
+
_delete_test_resources
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_timeseries_collection
|
38
|
+
metric_type = "#{TEST_METRIC_PREFIX}/test_requests"
|
39
|
+
_some_custom_metric_descriptor(metric_type)
|
40
|
+
|
41
|
+
start_time = Time.now
|
42
|
+
labels = {
|
43
|
+
:test_string_label => "foo",
|
44
|
+
:test_bool_label => "false",
|
45
|
+
:test_int_label => "1"
|
46
|
+
}
|
47
|
+
|
48
|
+
expected = _some_timeseries(start_time, metric_type, labels)
|
49
|
+
resp = @client.create_timeseries(:timeseries => [expected])
|
50
|
+
assert_empty(resp.to_h)
|
51
|
+
|
52
|
+
# Wait for metric to be created
|
53
|
+
retry_on(Google::Apis::ClientError) do
|
54
|
+
@client.list_timeseries(
|
55
|
+
:filter => "metric.type = \"#{metric_type}\"",
|
56
|
+
:interval => {
|
57
|
+
# Subtracting one second because timeSeries.list API
|
58
|
+
# doesn't return points that are exactly the same time
|
59
|
+
# as the interval for some reason.
|
60
|
+
:start_time => (start_time - 1).to_datetime.rfc3339,
|
61
|
+
:end_time => Time.now.to_datetime.rfc3339
|
62
|
+
}
|
63
|
+
).time_series
|
64
|
+
end
|
65
|
+
|
66
|
+
series = retry_on(Google::Apis::ClientError) do
|
67
|
+
@client.timeseries_collection.all(
|
68
|
+
:filter => "metric.type = \"#{metric_type}\"",
|
69
|
+
:interval => {
|
70
|
+
# Subtracting one second because timeSeries.list API
|
71
|
+
# doesn't return points that are exactly the same time
|
72
|
+
# as the interval for some reason.
|
73
|
+
:start_time => (start_time - 1).to_datetime.rfc3339,
|
74
|
+
:end_time => Time.now.to_datetime.rfc3339
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
assert_equal(1, series.size)
|
80
|
+
actual = series.first
|
81
|
+
assert_equal(expected[:metric], actual.metric)
|
82
|
+
assert_equal(expected[:metric_kind], actual.metric_kind)
|
83
|
+
|
84
|
+
assert_equal(expected[:resource], actual.resource)
|
85
|
+
assert_equal(expected[:value_type], actual.value_type)
|
86
|
+
assert_equal(1, actual.points.size)
|
87
|
+
assert_equal(expected[:points].first[:value], actual.points.first[:value])
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_multiple_timeseries
|
91
|
+
metric_type = "#{TEST_METRIC_PREFIX}/test_multiple"
|
92
|
+
_some_custom_metric_descriptor(metric_type)
|
93
|
+
|
94
|
+
start_time = Time.now
|
95
|
+
metric_labels = [
|
96
|
+
{
|
97
|
+
:test_string_label => "first",
|
98
|
+
:test_bool_label => "true",
|
99
|
+
:test_int_label => "1"
|
100
|
+
},
|
101
|
+
{
|
102
|
+
:test_string_label => "second",
|
103
|
+
:test_bool_label => "false",
|
104
|
+
:test_int_label => "2"
|
105
|
+
}
|
106
|
+
]
|
107
|
+
|
108
|
+
timeseries = metric_labels.map do |labels|
|
109
|
+
_some_timeseries(start_time, metric_type, labels)
|
110
|
+
end
|
111
|
+
|
112
|
+
retry_on(Google::Apis::ServerError) do
|
113
|
+
@client.create_timeseries(:timeseries => timeseries)
|
114
|
+
end
|
115
|
+
interval = {
|
116
|
+
# Subtracting one second because timeSeries.list API
|
117
|
+
# doesn't return points that are exactly the same time
|
118
|
+
# as the interval for some reason.
|
119
|
+
:start_time => (start_time - 1).to_datetime.rfc3339,
|
120
|
+
:end_time => Time.now.to_datetime.rfc3339
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
# Wait for metric to be created
|
125
|
+
# Retriable is used instead of wait_for due to API client returning Google::Apis::ClientError: badRequest if the
|
126
|
+
# metric hasn't yet been created
|
127
|
+
retry_on(Google::Apis::ClientError) do
|
128
|
+
@client.list_timeseries(
|
129
|
+
:filter => "metric.type = \"#{metric_type}\"",
|
130
|
+
:interval => interval
|
131
|
+
).time_series
|
132
|
+
end
|
133
|
+
|
134
|
+
# Test page size
|
135
|
+
resp = retry_on(Google::Apis::ClientError) do
|
136
|
+
@client.list_timeseries(
|
137
|
+
:filter => "metric.type = \"#{metric_type}\"",
|
138
|
+
:interval => interval,
|
139
|
+
:page_size => 1
|
140
|
+
)
|
141
|
+
end
|
142
|
+
|
143
|
+
refute_nil(resp.time_series, "expected timeseries to not be nil")
|
144
|
+
assert_equal(resp.time_series.size, 1,
|
145
|
+
"expected timeseries count to be equal to page size 1")
|
146
|
+
|
147
|
+
next_resp = @client.list_timeseries(
|
148
|
+
:filter => "metric.type = \"#{metric_type}\"",
|
149
|
+
:interval => interval,
|
150
|
+
:page_size => 1,
|
151
|
+
:page_token => resp.next_page_token
|
152
|
+
)
|
153
|
+
assert_equal(next_resp.time_series.size, 1,
|
154
|
+
"expected timeseries count to be equal to page size 1")
|
155
|
+
labels = resp.time_series.first.metric.labels
|
156
|
+
labels_next = next_resp.time_series.first.metric.labels
|
157
|
+
refute_equal(labels, labels_next,
|
158
|
+
"expected different timeseries when using page_token")
|
159
|
+
|
160
|
+
# Test filter
|
161
|
+
series = retry_on(Google::Apis::ClientError) do
|
162
|
+
@client.timeseries_collection.all(
|
163
|
+
:filter => %[
|
164
|
+
metric.type = "#{metric_type}" AND
|
165
|
+
metric.label.test_string_label = "first"
|
166
|
+
],
|
167
|
+
:interval => interval
|
168
|
+
)
|
169
|
+
end
|
170
|
+
assert_equal(series.size, 1,
|
171
|
+
"expected returned timeseries to be filtered to 1 value")
|
172
|
+
assert_equal("true", series.first.metric[:labels][:test_bool_label])
|
173
|
+
assert_equal("1", series.first.metric[:labels][:test_int_label])
|
174
|
+
end
|
175
|
+
|
176
|
+
def _delete_test_resources
|
177
|
+
list_resp = @client.monitoring.list_project_metric_descriptors(
|
178
|
+
"projects/#{@client.project}",
|
179
|
+
filter: "metric.type = starts_with(\"#{TEST_METRIC_PREFIX}\")"
|
180
|
+
)
|
181
|
+
unless list_resp.metric_descriptors.nil?
|
182
|
+
list_resp.metric_descriptors.each do |md|
|
183
|
+
@client.monitoring.delete_project_metric_descriptor(md.name)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
rescue
|
187
|
+
# Do nothing
|
188
|
+
end
|
189
|
+
|
190
|
+
def _some_custom_metric_descriptor(metric_type)
|
191
|
+
# Create custom metric to write test timeseries for.
|
192
|
+
@client.create_metric_descriptor(
|
193
|
+
:labels => LABEL_DESCRIPTORS,
|
194
|
+
:metric_type => metric_type,
|
195
|
+
:unit => "1",
|
196
|
+
:value_type => "INT64",
|
197
|
+
:description => "A custom metric descriptor for fog-google timeseries test.",
|
198
|
+
:display_name => "fog-google-test/#{metric_type}",
|
199
|
+
:metric_kind => "GAUGE"
|
200
|
+
)
|
201
|
+
|
202
|
+
# Wait for metric descriptor to be created
|
203
|
+
Fog.wait_for(180, 2) do
|
204
|
+
begin
|
205
|
+
@client.get_metric_descriptor(metric_type)
|
206
|
+
true
|
207
|
+
rescue
|
208
|
+
false
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def _some_timeseries(start_time, metric_type, labels)
|
214
|
+
{
|
215
|
+
:metric => {
|
216
|
+
:type => metric_type,
|
217
|
+
:labels => labels
|
218
|
+
},
|
219
|
+
:resource => {
|
220
|
+
:type => "global",
|
221
|
+
:labels => { :project_id => @client.project }
|
222
|
+
},
|
223
|
+
:metric_kind => "GAUGE",
|
224
|
+
:value_type => "INT64",
|
225
|
+
:points => [
|
226
|
+
{
|
227
|
+
:interval => {
|
228
|
+
:end_time => start_time.to_datetime.rfc3339,
|
229
|
+
:start_time => start_time.to_datetime.rfc3339
|
230
|
+
},
|
231
|
+
:value => {
|
232
|
+
:int64_value => rand(10)
|
233
|
+
}
|
234
|
+
}
|
235
|
+
]
|
236
|
+
}
|
237
|
+
end
|
238
|
+
end
|