Popularity
0.9
Stable
Activity
0.0
Stable
25
2
3

Description

Hyper.sh API wrapper ruby gem

Monthly Downloads: 484
Programming language: Ruby
License: MIT License
Tags: Hyper.sh     Sdk     Gem    
Latest version: v0.7.1

README

Unfortunately this project is being archived since hyper.sh shutdown

Hyperb Hyperb is a Hyper.sh API ruby gem.


This gem is under active development.

Installation

Add this line to your application's Gemfile:

gem 'hyperb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hyperb

Configuration

Hyper.sh requires you to create credentials on their dashboard, after that you can configure your client as following:

client = Hyperb::Client.new(access_key: 'ak', secret_key: 'sk', region: 'us-west-1')

or

client = Hyperb::Client.new do |client|
  client.secret_key = 'secret_key'
  client.access_key = 'access_key'
  client.region = 'eu-central-1'
end

If region is not set, us-west-1 is set by default.

Usage Examples

After configuring a client, you can run the following examples.

get api version

client.version

fetch all images

client.images

remove an image

client.remove_image id: 'id-or-name'

create an image (pull)

client.create_image from_image: 'busybox'

pull an image from gcr (using service account)

client.create_image from_image: 'gcr.io/project/owner/gcr', x_registry_auth: { username: '_json_key', password: File.new('./path/service-account.json'), email: '[email protected]', serveraddress: 'https://gcr.io' }

create container (defaults to s1 size)

client.create_container name: 'nginx-container', image: 'nginx'

create container with specific size

client.create_container name: 'nginx-container', image: 'nginx', labels: { sh_hyper_instancetype: 'm1' }

start container

client.start_container name: 'nginx-container'

container logs

logs = client.container_logs id: 'nginx', stdout: true, stderr: true, follow: true

while body = logs.readpartial(1024)
  puts body
end

allocate an floating ip

ips = client.fip_allocate count: 2
puts ips
#['8.8.8.8', '5.5.5.5']

For more usage examples, please see the full documentation.

APIs (v1.23) Covered

API

Images

  • inspect image
  • create image
  • list images
  • remove images

Volumes

  • list volumes
  • inspect volume
  • create volume
  • remove volume

Containers

  • create container (not all arguments supported yet)
  • start container
  • stop container
  • kill container
  • get container logs
  • get container stats
  • remove containers
  • rename container

Network

  • floating ip allocate
  • floating ip release
  • floating ip list
  • floating ip attach
  • floating ip detach
  • floating ip name

Compose

  • compose create
  • compose up
  • compose down
  • compose rm

Snapshot

  • create snapshot

Service

  • create service
  • remove service
  • inspect service
  • list services

Func (beta)

  • create func
  • remove func
  • list funcs
  • func status
  • call func

Misc.

  • version
  • info

Security Groups

wip

Event

wip

Cron (beta)

wip

Contributing

Bug reports and pull requests are welcome at https://github.com/drish/hyperb.

License

The gem is available as open source under the terms of the MIT License.


*Note that all licence references and agreements mentioned in the Hyperb README section above are relevant to that project's source code only.