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,23 @@
|
|
1
|
+
require "fog/core/model"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Google
|
5
|
+
class SQL
|
6
|
+
##
|
7
|
+
# A Google Cloud SQL service flag resource
|
8
|
+
#
|
9
|
+
# @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/flags
|
10
|
+
class Flag < Fog::Model
|
11
|
+
identity :name
|
12
|
+
|
13
|
+
attribute :allowed_string_values, :aliases => "allowedStringValues"
|
14
|
+
attribute :applies_to, :aliases => "appliesTo"
|
15
|
+
attribute :kind
|
16
|
+
attribute :max_value, :aliases => "maxValue"
|
17
|
+
attribute :min_value, :aliases => "minValue"
|
18
|
+
attribute :requires_restart, :aliases => "requiresRestart"
|
19
|
+
attribute :type
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "fog/core/collection"
|
2
|
+
require "fog/google/models/sql/flag"
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Google
|
6
|
+
class SQL
|
7
|
+
class Flags < Fog::Collection
|
8
|
+
model Fog::Google::SQL::Flag
|
9
|
+
|
10
|
+
##
|
11
|
+
# List all available database flags
|
12
|
+
#
|
13
|
+
# @return [Array<Fog::Google::SQL::Flag>] List of flags
|
14
|
+
def all
|
15
|
+
data = service.list_flags.to_h[:items] || []
|
16
|
+
load(data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,339 @@
|
|
1
|
+
require "fog/core/model"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Google
|
5
|
+
class SQL
|
6
|
+
class Instance < Fog::Model
|
7
|
+
identity :name
|
8
|
+
|
9
|
+
attribute :current_disk_size, :aliases => "currentDiskSize"
|
10
|
+
attribute :database_version, :aliases => "databaseVersion"
|
11
|
+
attribute :etag
|
12
|
+
attribute :ip_addresses, :aliases => "ipAddresses"
|
13
|
+
attribute :kind
|
14
|
+
attribute :max_disk_size, :aliases => "maxDiskSize"
|
15
|
+
attribute :project
|
16
|
+
attribute :region
|
17
|
+
attribute :server_ca_cert, :aliases => "serverCaCert"
|
18
|
+
attribute :settings
|
19
|
+
attribute :state
|
20
|
+
|
21
|
+
# These attributes are not available in the representation of an 'Instance' returned by the Google SQL API.
|
22
|
+
attribute :activation_policy
|
23
|
+
attribute :authorized_gae_applications
|
24
|
+
attribute :backup_configuration
|
25
|
+
attribute :database_flags
|
26
|
+
attribute :ip_configuration_authorized_networks
|
27
|
+
attribute :ip_configuration_enabled
|
28
|
+
attribute :ip_configuration_require_ssl
|
29
|
+
attribute :location_preference_zone_follow_gae_application
|
30
|
+
attribute :location_preference_zone
|
31
|
+
attribute :pricing_plan
|
32
|
+
attribute :replication_type
|
33
|
+
attribute :settings_version
|
34
|
+
attribute :tier
|
35
|
+
|
36
|
+
MAINTENANCE_STATE = "MAINTENANCE".freeze
|
37
|
+
PENDING_CREATE_STATE = "PENDING_CREATE".freeze
|
38
|
+
RUNNABLE_STATE = "RUNNABLE".freeze
|
39
|
+
SUSPENDED_STATE = "SUSPENDED".freeze
|
40
|
+
UNKNOWN_STATE = "UNKNOWN_STATE".freeze
|
41
|
+
|
42
|
+
##
|
43
|
+
# Returns the activation policy for this instance
|
44
|
+
#
|
45
|
+
# @return [String] The activation policy for this instance
|
46
|
+
def activation_policy
|
47
|
+
settings[:activation_policy]
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Returns the AppEngine app ids that can access this instance
|
52
|
+
#
|
53
|
+
# @return [Array<String>] The AppEngine app ids that can access this instance
|
54
|
+
def authorized_gae_applications
|
55
|
+
settings[:authorized_gae_applications]
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Returns the daily backup configuration for the instance
|
60
|
+
#
|
61
|
+
# @return [Hash] The daily backup configuration for the instance
|
62
|
+
def backup_configuration
|
63
|
+
settings["backup_configuration"]
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# Creates a Cloud SQL instance as a clone of the source instance
|
68
|
+
#
|
69
|
+
# @param [String] destination_name Name of the Cloud SQL instance to be created as a clone
|
70
|
+
# @param [Boolean] async If the operation must be performed asynchronously (true by default)
|
71
|
+
# @param [String] log_filename Name of the binary log file for a Cloud SQL instance
|
72
|
+
# @param [Integer] log_position Position (offset) within the binary log file
|
73
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
74
|
+
def clone(destination_name, async: true, log_filename: nil, log_position: nil)
|
75
|
+
requires :identity
|
76
|
+
|
77
|
+
data = service.clone_instance(
|
78
|
+
identity, destination_name,
|
79
|
+
:log_filename => log_filename,
|
80
|
+
:log_position => log_position
|
81
|
+
)
|
82
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
83
|
+
operation.tap { |o| o.wait_for { ready? } unless async }
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# Creates a Cloud SQL instance
|
88
|
+
# @param [Boolean] async If the operation must be performed asynchronously
|
89
|
+
#
|
90
|
+
# This is true by default since SQL instances return Google::Apis::ClientError: invalidState
|
91
|
+
# whenever an instance is in a transition process (creation, deletion, etc.) which makes it
|
92
|
+
# hard to operate unless one puts guard clauses on Google::Apis::ClientError everywhere.
|
93
|
+
#
|
94
|
+
# TODO: Rethink this when API graduates out of beta. (Written as of V1beta4)
|
95
|
+
#
|
96
|
+
# @return [Fog::Google::SQL::Instance] Instance resource
|
97
|
+
def create(async = false)
|
98
|
+
requires :identity
|
99
|
+
|
100
|
+
data = service.insert_instance(identity, attributes[:tier], attributes)
|
101
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
102
|
+
operation.wait_for { ready? } unless async
|
103
|
+
reload
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Returns the database flags passed to the instance at startup
|
108
|
+
#
|
109
|
+
# @return [Array<Hash>] The database flags passed to the instance at startup
|
110
|
+
def database_flags
|
111
|
+
settings[:database_flags]
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Deletes a Cloud SQL instance
|
116
|
+
#
|
117
|
+
# @param [Boolean] async If the operation must be performed asynchronously (false by default)
|
118
|
+
# See Fog::Google::SQL::Instance.create on details why default is set this way.
|
119
|
+
#
|
120
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
121
|
+
def destroy(async = false)
|
122
|
+
requires :identity
|
123
|
+
|
124
|
+
# TODO(2.0): Add a deprecation warning here, depending on the decision in #27
|
125
|
+
# This is a compatibility fix leftover from breaking named parameter change
|
126
|
+
if async.is_a?(Hash)
|
127
|
+
async = async[:async]
|
128
|
+
end
|
129
|
+
|
130
|
+
data = service.delete_instance(identity)
|
131
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
132
|
+
operation.tap { |o| o.wait_for { ready? } unless async }
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump file
|
137
|
+
#
|
138
|
+
# @param [String] uri The path to the file in Google Cloud Storage where the export will be stored,
|
139
|
+
# or where it was already stored
|
140
|
+
# @param [Hash] options Method options
|
141
|
+
# @option options [Array<String>] :databases Databases (for example, guestbook) from which the export is made.
|
142
|
+
# If unspecified, all databases are exported.
|
143
|
+
# @option options [Array<String>] :tables Tables to export, or that were exported, from the specified database.
|
144
|
+
# If you specify tables, specify one and only one database.
|
145
|
+
# @option options [Boolean] :async If the operation must be performed asynchronously (true by default)
|
146
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
147
|
+
def export(uri, options: {})
|
148
|
+
requires :identity
|
149
|
+
|
150
|
+
data = service.export_instance(identity, uri, options)
|
151
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
152
|
+
operation.tap { |o| o.wait_for { ready? } unless async }
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Imports data into a Cloud SQL instance from a MySQL dump file in Google Cloud Storage
|
157
|
+
#
|
158
|
+
# @param [Array<String>] uri A path to the MySQL dump file in Google Cloud Storage from which the import is
|
159
|
+
# made
|
160
|
+
# @param [Hash] options Method options
|
161
|
+
# @option options [String] :database The database (for example, guestbook) to which the import is made.
|
162
|
+
# If not set, it is assumed that the database is specified in the file to be imported.
|
163
|
+
# @option options [Boolean] :async If the operation must be performed asynchronously (true by default)
|
164
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
165
|
+
def import(uri, options = {})
|
166
|
+
requires :identity
|
167
|
+
|
168
|
+
data = service.import_instance(identity, uri, options)
|
169
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
170
|
+
operation.tap { |o| o.wait_for { ready? } unless options.fetch(:async, true) }
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# Returns the list of external networks that are allowed to connect to the instance using the IP
|
175
|
+
#
|
176
|
+
# @return [Array<String>] The list of external networks that are allowed to connect to the instance using the IP
|
177
|
+
def ip_configuration_authorized_networks
|
178
|
+
settings.fetch(:ip_configuration, {})
|
179
|
+
.fetch(:authorized_networks, [])
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# Returns whether the instance should be assigned an IP address or not
|
184
|
+
#
|
185
|
+
# @return [Boolean] Whether the instance should be assigned an IP address or not
|
186
|
+
def ip_configuration_ipv4_enabled
|
187
|
+
settings.fetch(:ip_configuration, {})[:ipv4_enabled]
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# Returns whether SSL connections over IP should be enforced or not.
|
192
|
+
#
|
193
|
+
# @return [Boolean] Whether SSL connections over IP should be enforced or not.
|
194
|
+
def ip_configuration_require_ssl
|
195
|
+
settings.fetch(:ip_configuration, {})[:require_ssl]
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# Returns the AppEngine application to follow
|
200
|
+
#
|
201
|
+
# @return [String] The AppEngine application to follow
|
202
|
+
def location_preference_zone_follow_gae_application
|
203
|
+
settings.fetch(:location_preference, {})[:follow_gae_application]
|
204
|
+
end
|
205
|
+
|
206
|
+
##
|
207
|
+
# Returns the preferred Compute Engine zone
|
208
|
+
#
|
209
|
+
# @return [String] The preferred Compute Engine zone
|
210
|
+
def location_preference_zone
|
211
|
+
settings.fetch(:location_preference, {})[:zone]
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
# Returns the pricing plan for this instance
|
216
|
+
#
|
217
|
+
# @return [String] The pricing plan for this instance
|
218
|
+
def pricing_plan
|
219
|
+
settings[:pricing_plan]
|
220
|
+
end
|
221
|
+
|
222
|
+
##
|
223
|
+
# Checks if the instance is running
|
224
|
+
#
|
225
|
+
# @return [Boolean] True if the instance is running; False otherwise
|
226
|
+
def ready?
|
227
|
+
state == RUNNABLE_STATE
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Returns the type of replication this instance uses
|
232
|
+
#
|
233
|
+
# @return [String] The type of replication this instance uses
|
234
|
+
def replication_type
|
235
|
+
settings[:replication_type]
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# Deletes all client certificates and generates a new server SSL certificate for the instance
|
240
|
+
#
|
241
|
+
# @param [Boolean] async If the operation must be performed asynchronously (true by default)
|
242
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
243
|
+
def reset_ssl_config(async: true)
|
244
|
+
requires :identity
|
245
|
+
|
246
|
+
data = service.reset_instance_ssl_config(identity)
|
247
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
248
|
+
operation.tap { |o| o.wait_for { ready? } unless async }
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Restarts a Cloud SQL instance
|
253
|
+
#
|
254
|
+
# @param [Boolean] async If the operation must be performed asynchronously (true by default)
|
255
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
256
|
+
def restart(async: true)
|
257
|
+
requires :identity
|
258
|
+
|
259
|
+
data = service.restart_instance(identity)
|
260
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
261
|
+
operation.tap { |o| o.wait_for { ready? } unless async }
|
262
|
+
end
|
263
|
+
|
264
|
+
##
|
265
|
+
# Restores a backup of a Cloud SQL instance
|
266
|
+
#
|
267
|
+
# @param [String] backup_run_id The identifier of the backup configuration
|
268
|
+
# @param [Boolean] async If the operation must be performed asynchronously (true by default)
|
269
|
+
# @return [Fog::Google::SQL::Operation] A Operation resource
|
270
|
+
def restore_backup(backup_run_id, async: true)
|
271
|
+
requires :identity
|
272
|
+
|
273
|
+
data = service.restore_instance_backup(identity, backup_run_id)
|
274
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
275
|
+
operation.tap { |o| o.wait_for { ready? } unless async }
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# Saves a Cloud SQL instance
|
280
|
+
#
|
281
|
+
# @return [Fog::Google::SQL::Instance] Instance resource
|
282
|
+
def save
|
283
|
+
etag ? update : create
|
284
|
+
end
|
285
|
+
|
286
|
+
##
|
287
|
+
# Returns the version of instance settings
|
288
|
+
#
|
289
|
+
# @return [String] The version of instance settings
|
290
|
+
def settings_version
|
291
|
+
settings[:settings_version]
|
292
|
+
end
|
293
|
+
|
294
|
+
##
|
295
|
+
# Lists all of the current SSL certificates for the instance
|
296
|
+
#
|
297
|
+
# @return [Array<Fog::Google::SQL::SslCert>] List of SSL certificate resources
|
298
|
+
def ssl_certs
|
299
|
+
requires :identity
|
300
|
+
|
301
|
+
service.ssl_certs.all(identity)
|
302
|
+
end
|
303
|
+
|
304
|
+
##
|
305
|
+
# Returns the tier of service for this instance
|
306
|
+
#
|
307
|
+
# @return [String] The tier of service for this instance
|
308
|
+
def tier
|
309
|
+
settings[:tier]
|
310
|
+
end
|
311
|
+
|
312
|
+
##
|
313
|
+
# Updates settings of a Cloud SQL instance
|
314
|
+
#
|
315
|
+
# @return [Fog::Google::SQL::Instance] Instance resource
|
316
|
+
def update
|
317
|
+
requires :identity, :settings_version, :tier
|
318
|
+
|
319
|
+
data = service.update_instance(identity, settings_version, tier, settings)
|
320
|
+
operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
|
321
|
+
operation.wait_for { ready? }
|
322
|
+
reload
|
323
|
+
end
|
324
|
+
|
325
|
+
##
|
326
|
+
# Reload a Cloud SQL instance
|
327
|
+
#
|
328
|
+
# @return [Fog::Google::SQL::Instance] Instance resource
|
329
|
+
def reload
|
330
|
+
requires :identity
|
331
|
+
|
332
|
+
data = collection.get(identity)
|
333
|
+
merge_attributes(data.attributes)
|
334
|
+
self
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "fog/core/collection"
|
2
|
+
require "fog/google/models/sql/instance"
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Google
|
6
|
+
class SQL
|
7
|
+
class Instances < Fog::Collection
|
8
|
+
model Fog::Google::SQL::Instance
|
9
|
+
|
10
|
+
##
|
11
|
+
# Lists all instance
|
12
|
+
#
|
13
|
+
# @return [Array<Fog::Google::SQL::Instance>] List of instance resources
|
14
|
+
def all
|
15
|
+
data = service.list_instances.to_h[:items] || []
|
16
|
+
load(data)
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Retrieves an instance
|
21
|
+
#
|
22
|
+
# @param [String] instance_id Instance ID
|
23
|
+
# @return [Fog::Google::SQL::Instance] Instance resource
|
24
|
+
def get(instance_id)
|
25
|
+
instance = service.get_instance(instance_id).to_h
|
26
|
+
# XXX if we pass `nil` to get() it returns empty DB object with
|
27
|
+
# kind set to "sql#instancesList"
|
28
|
+
# see https://github.com/google/google-api-ruby-client/issues/699
|
29
|
+
if instance[:kind].eql?("sql#instance")
|
30
|
+
new(instance)
|
31
|
+
end
|
32
|
+
rescue ::Google::Apis::ClientError => e
|
33
|
+
raise e unless e.status_code == 404 || e.status_code == 403
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "fog/core/model"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Google
|
5
|
+
class SQL
|
6
|
+
##
|
7
|
+
# An Operation resource contains information about database instance operations
|
8
|
+
# such as create, delete, and restart
|
9
|
+
#
|
10
|
+
# @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/operations
|
11
|
+
class Operation < Fog::Model
|
12
|
+
identity :name
|
13
|
+
|
14
|
+
attribute :kind, :aliases => "kind"
|
15
|
+
attribute :self_link, :aliases => "selfLink"
|
16
|
+
attribute :target_project, :aliases => "targetProject"
|
17
|
+
attribute :target_id, :aliases => "targetId"
|
18
|
+
attribute :target_link, :aliases => "targetLink"
|
19
|
+
attribute :name, :aliases => "name"
|
20
|
+
attribute :operation_type, :aliases => "operationType"
|
21
|
+
attribute :status, :aliases => "status"
|
22
|
+
attribute :user, :aliases => "user"
|
23
|
+
attribute :insert_time, :aliases => "insertTime"
|
24
|
+
attribute :start_time, :aliases => "startTime"
|
25
|
+
attribute :end_time, :aliases => "endTime"
|
26
|
+
attribute :error, :aliases => "error"
|
27
|
+
attribute :import_context, :aliases => "importContext"
|
28
|
+
attribute :export_context, :aliases => "exportContext"
|
29
|
+
attribute :sql_export_options, :aliases => "sqlExportOptions"
|
30
|
+
attribute :csv_export_options, :aliases => "csvExportOptions"
|
31
|
+
|
32
|
+
DONE_STATE = "DONE".freeze
|
33
|
+
PENDING_STATE = "PENDING".freeze
|
34
|
+
RUNNING_STATE = "RUNNING".freeze
|
35
|
+
UNKNOWN_STATE = "UNKNOWN".freeze
|
36
|
+
|
37
|
+
##
|
38
|
+
# Checks if the instance operation is pending
|
39
|
+
#
|
40
|
+
# @return [Boolean] True if the operation is pending; False otherwise
|
41
|
+
def pending?
|
42
|
+
status == PENDING_STATE
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Checks if the instance operation is done
|
47
|
+
#
|
48
|
+
# @return [Boolean] True if the operation is done; False otherwise
|
49
|
+
def ready?
|
50
|
+
status == DONE_STATE
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Reloads an instance operation
|
55
|
+
#
|
56
|
+
# @return [Fog::Google::SQL::Operation] Instance operation resource
|
57
|
+
def reload
|
58
|
+
requires :identity
|
59
|
+
|
60
|
+
data = collection.get(identity)
|
61
|
+
merge_attributes(data.attributes)
|
62
|
+
self
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|