{"id":13427887,"url":"https://github.com/fog/fog","last_synced_at":"2025-05-13T10:59:25.928Z","repository":{"id":571906,"uuid":"203666","full_name":"fog/fog","owner":"fog","description":"The Ruby cloud services library.","archived":false,"fork":false,"pushed_at":"2024-11-19T13:42:48.000Z","size":21842,"stargazers_count":4316,"open_issues_count":8,"forks_count":1463,"subscribers_count":108,"default_branch":"master","last_synced_at":"2025-04-26T05:39:50.817Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://fog.github.io","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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"geemus"}},"created_at":"2009-05-18T07:14:04.000Z","updated_at":"2025-04-24T16:02:32.000Z","dependencies_parsed_at":"2023-07-05T15:03:15.774Z","dependency_job_id":"8708522f-70a1-437c-86da-e7be8e5d8d04","html_url":"https://github.com/fog/fog","commit_stats":{"total_commits":9587,"total_committers":893,"mean_commits":"10.735722284434491","dds":0.8452070512151872,"last_synced_commit":"f3e5ceacc44cd1b63daf9db9a4a5985f0802de50"},"previous_names":[],"tags_count":174,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fog%2Ffog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fog","download_url":"https://codeload.github.com/fog/fog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251094663,"owners_count":21535330,"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":[],"created_at":"2024-07-31T01:00:41.984Z","updated_at":"2025-04-28T10:29:32.296Z","avatar_url":"https://github.com/fog.png","language":"Ruby","readme":"![fog](http://geemus.s3.amazonaws.com/fog.png)\n\nfog is the Ruby cloud services library, top to bottom:\n\n* Collections provide a simplified interface, making clouds easier to work with and switch between.\n* Requests allow power users to get the most out of the features of each individual cloud.\n* Mocks make testing and integrating a breeze.\n\n[![Build Status](https://github.com/fog/fog/actions/workflows/ruby.yml/badge.svg)](https://github.com/fog/fog/actions/workflows/ruby.yml)\n[![Code Climate](https://codeclimate.com/github/fog/fog/badges/gpa.svg)](https://codeclimate.com/github/fog/fog)\n[![Gem Version](https://badge.fury.io/rb/fog.svg)](http://badge.fury.io/rb/fog)\n[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=fog\u0026package-manager=bundler\u0026version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=fog\u0026package-manager=bundler\u0026version-scheme=semver)\n\n## Dependency Notice\n\nCurrently all fog providers are getting separated into metagems to lower the\nload time and dependency count.\n\nIf there's a metagem available for your cloud provider, e.g. `fog-aws`,\nyou should be using it instead of requiring the full fog collection to avoid\nunnecessary dependencies.\n\n'fog' should be required explicitly only if the provider you use doesn't yet\nhave a metagem available.\n\n## Getting Started\n\nThe easiest way to learn fog is to install the gem and use the interactive console.\nHere is an example of wading through server creation for Amazon Elastic Compute Cloud:\n\n```\n$ sudo gem install fog\n[...]\n\n$ fog\n\n  Welcome to fog interactive!\n  :default provides [...]\n\n\u003e\u003e server = Compute[:aws].servers.create\nArgumentError: image_id is required for this operation\n\n\u003e\u003e server = Compute[:aws].servers.create(:image_id =\u003e 'ami-5ee70037')\n\u003cFog::AWS::EC2::Server [...]\u003e\n\n\u003e\u003e server.destroy # cleanup after yourself or regret it, trust me\ntrue\n```\n\n## Ruby version\n\nFog requires Ruby `2.0.0` or later.\n\nRuby `1.8` and `1.9` support was dropped in `fog-v2.0.0` as a backwards incompatible\nchange. Please use the later fog `1.x` versions if you require `1.8.7` or `1.9.x` support.\n\n## Collections\n\nA high level interface to each cloud is provided through collections, such as `images` and `servers`.\nYou can see a list of available collections by calling `collections` on the connection object.\nYou can try it out using the `fog` command:\n\n    \u003e\u003e Compute[:aws].collections\n    [:addresses, :directories, ..., :volumes, :zones]\n\nSome collections are available across multiple providers:\n\n* compute providers have `flavors`, `images` and `servers`\n* dns providers have `zones` and `records`\n* storage providers have `directories` and `files`\n\nCollections share basic CRUD type operations, such as:\n\n* `all` - fetch every object of that type from the provider.\n* `create` - initialize a new record locally and a remote resource with the provider.\n* `get` - fetch a single object by its identity from the provider.\n* `new` - initialize a new record locally, but do not create a remote resource with the provider.\n\nAs an example, we'll try initializing and persisting a Rackspace Cloud server:\n\n```ruby\nrequire 'fog'\n\ncompute = Fog::Compute.new(\n  :provider           =\u003e 'Rackspace',\n  :rackspace_api_key  =\u003e key,\n  :rackspace_username =\u003e username\n)\n\n# boot a gentoo server (flavor 1 = 256, image 3 = gentoo 2008.0)\nserver = compute.servers.create(:flavor_id =\u003e 1, :image_id =\u003e 3, :name =\u003e 'my_server')\nserver.wait_for { ready? } # give server time to boot\n\n# DO STUFF\n\nserver.destroy # cleanup after yourself or regret it, trust me\n```\n\n## Models\n\nMany of the collection methods return individual objects, which also provide common methods:\n\n* `destroy` - will destroy the persisted object from the provider\n* `save` - persist the object to the provider\n* `wait_for` - takes a block and waits for either the block to return true for the object or for a timeout (defaults to 10 minutes)\n\n## Mocks\n\nAs you might imagine, testing code using Fog can be slow and expensive, constantly turning on and shutting down instances.\nMocking allows skipping this overhead by providing an in memory representation of resources as you make requests.\nEnabling mocking is easy to use: before you run other commands, simply run:\n\n```ruby\nFog.mock!\n```\n\nThen proceed as usual, if you run into unimplemented mocks, fog will raise an error and as always contributions are welcome!\n\n## Requests\n\nRequests allow you to dive deeper when the models just can't cut it.\nYou can see a list of available requests by calling `#requests` on the connection object.\n\nFor instance, ec2 provides methods related to reserved instances that don't have any models (yet). Here is how you can lookup your reserved instances:\n\n    $ fog\n    \u003e\u003e Compute[:aws].describe_reserved_instances\n    #\u003cExcon::Response [...]\u003e\n\nIt will return an [excon](http://github.com/geemus/excon) response, which has `body`, `headers` and `status`. Both return nice hashes.\n\n## Go forth and conquer\n\nPlay around and use the console to explore or check out [fog.github.io](http://fog.github.io) and the [provider documentation](http://fog.github.io/about/provider_documentation.html)\nfor more details and examples. Once you are ready to start scripting fog, here is a quick hint on how to make connections without the command line thing to help you.\n\n```ruby\n# create a compute connection\ncompute = Fog::Compute.new(:provider =\u003e 'AWS', :aws_access_key_id =\u003e ACCESS_KEY_ID, :aws_secret_access_key =\u003e SECRET_ACCESS_KEY)\n# compute operations go here\n\n# create a storage connection\nstorage = Fog::Storage.new(:provider =\u003e 'AWS', :aws_access_key_id =\u003e ACCESS_KEY_ID, :aws_secret_access_key =\u003e SECRET_ACCESS_KEY)\n# storage operations go here\n```\n\ngeemus says: \"That should give you everything you need to get started, but let me know if there is anything I can do to help!\"\n\n## Versioning\n\nFog library aims to adhere to [Semantic Versioning 2.0.0][semver], although it does not\naddress challenges of multi-provider libraries. Semantic versioning is only guaranteed for\nthe common API, not any provider-specific extensions.  You may also need to update your\nconfiguration from time to time (even between Fog releases) as providers update or deprecate\nservices.\n\nHowever, we still aim for forwards compatibility within Fog major versions.  As a result of this policy, you can (and\nshould) specify a dependency on this gem using the [Pessimistic Version\nConstraint][pvc] with two digits of precision. For example:\n\n```ruby\nspec.add_dependency 'fog', '~\u003e 1.0'\n```\n\nThis means your project is compatible with Fog 1.0 up until 2.0.  You can also set a higher minimum version:\n\n```ruby\nspec.add_dependency 'fog', '~\u003e 1.16'\n```\n\n[semver]: http://semver.org/\n[pvc]: http://guides.rubygems.org/patterns/\n\n## Getting Help\n\n* [General Documentation](http://fog.github.io).\n* [Provider Specific Documentation](http://fog.github.io/about/provider_documentation.html).\n* Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/fog)\n* Report bugs and discuss potential features in [Github issues](https://github.com/fog/fog/issues).\n\n## Contributing\n\nPlease refer to [CONTRIBUTING.md](https://github.com/fog/fog/blob/master/CONTRIBUTING.md).\n\n## License\n\nPlease refer to [LICENSE.md](https://github.com/fog/fog/blob/master/LICENSE.md).\n","funding_links":["https://github.com/sponsors/geemus"],"categories":["File Uploading","Provision, Deploy \u0026 Host","Ruby","Cloud Services","others","Cloud","Multi-Cloud \u0026 Hybrid","文件上传","Uncategorized"],"sub_categories":["Omniauth","Amazon Web Services","Cloud Abstraction","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffog%2Ffog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffog%2Ffog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffog%2Ffog/lists"}