项目作者: fog

项目描述 :
Fog provider for Linode
高级语言: Ruby
项目地址: git://github.com/fog/fog-linode.git
创建时间: 2019-04-23T17:47:29Z
项目社区:https://github.com/fog/fog-linode

开源协议:MIT License

下载


Fog::Linode

This is the plugin Gem to talk to Linode clouds via fog.

Installation

Add this line to your application’s Gemfile:

  1. gem 'fog-linode'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install fog-linode

Usage

  1. require 'fog/linode'
  2. compute = Fog::Compute.new(provider: :linode, linode_token: '<your LinodeAPIv4 access token>')
  3. all_kernels = compute.kernels.all # Fetch all kernels from the Linode API
  4. kvm_kernels = compute.kernels.all(filters: { kvm: true }) # Fetch all KVM kernels from the Linode API
  5. kvm_kernels_page_2 = compute.kernels.all(page: 2, filters: { kvm: true }) # Fetch only the 2nd page of KVM kernels
  6. finnix = compute.kernels.get('linode/finnix-legacy') # Load details for a single kernel
  7. # Complex filtering
  8. wordpress_stack_scripts = compute.stack_scripts.all(filters: { description: { '+contains': 'WordPress' } }) # Load all StackScripts with a description containing 'WordPress'
  9. # Creating a Linode instance
  10. regions = compute.regions.all
  11. types = compute.types.all
  12. images = compute.images.all({filters: { label: { '+contains': 'CentOS' } } })
  13. server = compute.servers.new
  14. server.region = regions[2].id
  15. server.type = types[4].id
  16. server.image = images.first.id
  17. server.root_pass = '<password>'
  18. server.save
  19. # Updating a Linode instance
  20. server.tags = ['add', 'some', 'tags']
  21. server.save
  22. # Working with Linode Domains
  23. dns = Fog::DNS.new(provider: :linode, linode_token: '<your LinodeAPIv4 access token>')
  24. all_domains = dns.domains.all # Load all Linode Domains on your account
  25. exsiting_domain = dns.domains.get(1234567890) # Load details for a single Linode Domain on your account
  26. new_domain = dns.domains.new
  27. new_domain.domain = 'fog-linode.example.com'
  28. new_domain.type = 'master'
  29. new_domain.soa_email = 'fog-linode@example.com'
  30. new_domain.save # Create the new domain

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Linode/fog-linode. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Code of Conduct

Everyone interacting in the Fog::Linode project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.