{"id":16746543,"url":"https://github.com/fog/fog-google","last_synced_at":"2025-05-14T07:10:09.033Z","repository":{"id":25757057,"uuid":"29195078","full_name":"fog/fog-google","owner":"fog","description":"Fog for Google Cloud Platform","archived":false,"fork":false,"pushed_at":"2025-04-25T22:13:30.000Z","size":2105,"stargazers_count":99,"open_issues_count":20,"forks_count":145,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-03T01:14:58.312Z","etag":null,"topics":["cloud-sql","fog","gce","gcp","gcs","google-cloud","google-cloud-monitoring","google-cloud-platform","hacktoberfest","ruby","storage"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fog.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"geemus"}},"created_at":"2015-01-13T15:02:24.000Z","updated_at":"2025-04-25T22:12:49.000Z","dependencies_parsed_at":"2023-01-14T03:21:26.224Z","dependency_job_id":"b8f19ff0-9b9c-42fb-8366-31bf935fa2d5","html_url":"https://github.com/fog/fog-google","commit_stats":{"total_commits":1081,"total_committers":81,"mean_commits":"13.345679012345679","dds":0.7086031452358927,"last_synced_commit":"37fd42d392ada472045422a33d97305029d1df9a"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog-google","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog-google/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog-google/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog-google/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fog","download_url":"https://codeload.github.com/fog/fog-google/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253411524,"owners_count":21904147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-sql","fog","gce","gcp","gcs","google-cloud","google-cloud-monitoring","google-cloud-platform","hacktoberfest","ruby","storage"],"created_at":"2024-10-13T02:06:48.937Z","updated_at":"2025-05-14T07:10:09.013Z","avatar_url":"https://github.com/fog.png","language":"Ruby","readme":"# Fog::Google\n\n[![Gem Version](https://badge.fury.io/rb/fog-google.svg)](http://badge.fury.io/rb/fog-google) [![Build Status](https://github.com/fog/fog-google/actions/workflows/unit.yml/badge.svg)](https://github.com/fog/fog-google/actions/workflows/unit.yml) [![codecov](https://codecov.io/gh/fog/fog-google/branch/master/graph/badge.svg)](https://codecov.io/gh/fog/fog-google) ![Dependabot Status](https://flat.badgen.net/github/dependabot/fog/fog-google) [![Doc coverage](https://inch-ci.org/github/fog/fog-google.svg?branch=master)](https://inch-ci.org/github/fog/fog-google)\n\nThe main maintainers for the Google sections are @icco, @Temikus and @plribeiro3000. Please send pull requests to them.\n\n## Important notices\n\n- As of **v1.0.0**, fog-google includes google-api-client as a dependency, there is no need to include it separately anymore.\n\n- Fog-google is currently supported on Ruby 2.7+ See [supported ruby versions](#supported-ruby-versions) for more info.\n\nSee **[MIGRATING.md](MIGRATING.md)** for migration between major versions.\n\n# Sponsors\n\nWe're proud to be sponsored by MeisterLabs who are generously funding our CI stack. A small message from them:\n\n\u003cimg align=\"right\" width=100 height=100 src=\"https://user-images.githubusercontent.com/2083229/125146917-d965a680-e16b-11eb-8ad2-611b39056ca2.png\"\u003e\n\n*\"As extensive users of fog-google we are excited to help! Meister is the company behind the productivity tools [MindMeister](https://www.mindmeister.com/), [MeisterTask](https://www.meistertask.com), and [MeisterNote](https://www.meisternote.com/). We are based in Vienna, Austria and we have a very talented international team who build our products on top of Ruby on Rails, Elixir, React and Redux. We are constantly looking for great talent in Engineering, so If you feel like taking on a new Ruby or Elixir challenge. get in touch, open jobs can be found [here](https://www.meisterlabs.com/jobs/).\"*\n\n# Usage\n\n## Storage\n\nThere are two ways to access [Google Cloud Storage](https://cloud.google.com/storage/). The old S3 API and the new JSON API. `Fog::Google::Storage` will automatically direct you to the appropriate API based on the credentials you provide it.\n\n * The [XML API](https://cloud.google.com/storage/docs/xml-api-overview/) is almost identical to S3. Use [Google's interoperability keys](https://cloud.google.com/storage/docs/migrating#keys) to access it.\n * The new [JSON API](https://cloud.google.com/storage/docs/json_api/) is faster and uses auth similarly to the rest of the Google Cloud APIs using a [service account private key](https://developers.google.com/identity/protocols/OAuth2ServiceAccount).\n\n## Compute\n\nGoogle Compute Engine is a Virtual Machine hosting service. Currently it is built on version [v1](https://cloud.google.com/compute/docs/reference/v1/) of the GCE API.\n\nAs of 2017-12-15, we are still working on making Fog for Google Compute engine (`Fog::Google::Compute`) feature complete. If you are using Fog to interact with GCE, please keep Fog up to date and [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.\n\n## SQL\n\nFog implements [v1beta4](https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/) of the Google Cloud SQL Admin API. As of 2017-11-06, Cloud SQL is mostly feature-complete. Please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like as we finish\nadding remaining features.\n\n## DNS\n\nFog implements [v1](https://cloud.google.com/dns/api/v1/) of the Google Cloud DNS API. We are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.\n\n## Monitoring\n\nFog implements [v3](https://cloud.google.com/monitoring/api/v3/) of the Google Cloud Monitoring API. As of 2017-10-05, we believe Fog for Google Cloud Monitoring is feature complete for metric-related resources and are working on supporting groups.\n\nWe are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.\n\n## Pubsub\n\nFog mostly implements [v1](https://cloud.google.com/pubsub/docs/reference/rest/) of the Google Cloud Pub/Sub API; however some less common API methods are missing. Pull requests for additions would be greatly appreciated.\n\n## Installation\n\nAdd the following two lines to your application's `Gemfile`:\n\n```ruby\ngem 'fog-google'\n```\n\nAnd then execute:\n\n```shell\n$ bundle\n```\n\nOr install it yourself as:\n\n```shell\n$ gem install fog-google\n```\n\n## Testing\n\nIntegration tests can be kicked off via following rake tasks.\n**Important note:** As those tests are running against real API's YOU WILL BE BILLED.\n\n```\nrake test               # Run all integration tests\nrake test:parallel      # Run all integration tests in parallel\n\nrake test:compute       # Run Compute API tests\nrake test:monitoring    # Run Monitoring API tests\nrake test:pubsub        # Run PubSub API tests\nrake test:sql           # Run SQL API tests\nrake test:storage       # Run Storage API tests\n```\n\nSince some resources can be expensive to test, we have a self-hosted CI server.\nDue to security considerations a repo maintainer needs to add the label `integrate` to kick off the CI.\n\n## Setup\n\n#### Credentials\n\nFollow the [instructions to generate a private key](https://cloud.google.com/storage/docs/authentication#generating-a-private-key). A sample credentials file can be found in `.fog.example` in this directory:\n\n```\ncat .fog.example \u003e\u003e ~/.fog # appends the sample configuration\nvim ~/.fog                 # edit file with yout config\n```\n\nAs of `1.9.0` fog-google supports Google [application default credentials (ADC)](https://cloud.google.com/docs/authentication/production)\nThe auth method uses [Google::Auth.get_application_default](https://www.rubydoc.info/gems/googleauth/0.6.7/Google%2FAuth.get_application_default)\nunder the hood.\n\nExample workflow for a GCE instance with [service account scopes](https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances)\ndefined:\n\n```\n\u003e connection = Fog::Google::Compute.new(:google_project =\u003e \"my-project\", :google_application_default =\u003e true)\n=\u003e #\u003cFog::Google::Compute::Real:32157700...\n\u003e connection.servers\n=\u003e [  \u003cFog::Google::Compute::Server ...  ]\n```\n\n#### CarrierWave integration\n\nIt is common to integrate Fog with Carrierwave. Here's a minimal config that's commonly put in `config/initializers/carrierwave.rb`:\n\n```\nCarrierWave.configure do |config|\n    config.fog_provider = 'fog/google'\n    config.fog_credentials = {\n        provider: 'Google',\n        google_project: Rails.application.secrets.google_cloud_storage_project_name,\n        google_json_key_string: Rails.application.secrets.google_cloud_storage_credential_content\n        # can optionally use google_json_key_location if using an actual file;\n    }\n    config.fog_directory = Rails.application.secrets.google_cloud_storage_bucket_name\nend\n```\n\nThis needs a corresponding secret in `config/secrets.yml`, e.g.:\n\n```\ndevelopment:\n    google_cloud_storage_project_name: your-project-name\n    google_cloud_storage_credential_content: '{\n        \"type\": \"service_account\",\n        \"project_id\": \"your-project-name\",\n        \"private_key_id\": \"REDACTED\",\n        \"private_key\": \"-----BEGIN PRIVATE KEY-----REDACTED-----END PRIVATE KEY-----\\n\",\n        \"client_email\": \"REDACTED@your-project-name.iam.gserviceaccount.com\",\n        \"client_id\": \"REDACTED\",\n        \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n        \"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\n        \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n        \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/REDACTED%40your-project-name.iam.gserviceaccount.com\"\n    }'\n    google_cloud_storage_bucket_name: your-bucket-name\n```\n\n#### SSH-ing into instances\n\nIf you want to be able to bootstrap SSH-able instances, (using `servers.bootstrap`,) be sure you have a key in `~/.ssh/id_rsa` and `~/.ssh/id_rsa.pub`\n\n## Quickstart\n\nOnce you've specified your credentials, you should be good to go!\n```\n$ bundle exec pry\n[1] pry(main)\u003e require 'fog/google'\n=\u003e true\n[2] pry(main)\u003e connection = Fog::Google::Compute.new\n[3] pry(main)\u003e connection.servers\n=\u003e [  \u003cFog::Google::Compute::Server\n    name=\"xxxxxxx\",\n    kind=\"compute#instance\",\n```\n\n## Supported Ruby Versions\n\nFog-google is currently supported on Ruby 3.0+.\n\nIn general we support (and run our CI) for Ruby versions that are actively supported\nby Ruby Core - that is, Ruby versions that are not end of life. Older versions of\nRuby _may_ still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/\nfor details about the Ruby support schedule.\n\n## Contributing\n\nSee `CONTRIBUTING.md` in this repository.\n","funding_links":["https://github.com/sponsors/geemus"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffog%2Ffog-google","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffog%2Ffog-google","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffog%2Ffog-google/lists"}