Ruby client for UpCloud's API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.swagger-codegen
docs
lib
spec
.gitignore
.rspec
.swagger-codegen-ignore
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
git_push.sh
upcloud_client.gemspec

README.md

UpCloud Ruby API client library

Build Status

This Ruby API client library provides integration with the UpCloud API allowing operations used to manage resources on UpCloud. The client is a web service interface that uses HTTPS to connect to the API. The API follows the principles of a RESTful web service wherever possible.

The base URL for all API operations is https://api.upcloud.com/ and require basic authentication using UpCloud username and password. We recommend creating a subaccount dedicated for the API communication for security purposes. This allows you to restrict API access by servers, storages, and tags ensuring you will never accidentally affect critical systems.

Table of content

Installation

Build a gem

To build the Ruby code into a gem, use the following command:

gem build upcloud_client.gemspec

Then either install the gem locally:

gem install ./upcloud_client-1.2.0.gem

(for development, run gem install --dev ./upcloud_client-1.2.0.gem to install the development dependencies)

Or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'upcloud_client', '~> 1.2.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'upcloud_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Usage

Please follow the installation procedure and then run the following code:

# Load the gem
require 'upcloud_client'

# Setup authorization
Upcloud.configure do |config|
  # Configure HTTP basic authorization: baseAuth
  config.username = ENV['UPCLOUD_USERNAME']
  config.password = ENV['UPCLOUD_PASSWORD']
end

api_instance = Upcloud::AccountApi.new

begin
  #Account information
  result = api_instance.get_account
  p result
rescue Upcloud::ApiError => e
  puts "Exception when calling AccountApi->get_account: #{e}"
end

Documentation

All URIs are relative to https://api.upcloud.com/1.2

Class Method HTTP request Description
Upcloud::AccountApi get_account GET /account Account information
Upcloud::FirewallApi create_firewall_rule POST /server/{serverId}/firewall_rule Create firewall rule
Upcloud::FirewallApi delete_firewall_rule DELETE /server/{serverId}/firewall_rule/{firewallRuleNumber} Remove firewall rule
Upcloud::FirewallApi get_firewall_rule GET /server/{serverId}/firewall_rule/{firewallRuleNumber} Get firewall rule details
Upcloud::FirewallApi server_server_id_firewall_rule_get GET /server/{serverId}/firewall_rule List firewall rules
Upcloud::IPAddressApi add_ip POST /ip_address Assign IP address
Upcloud::IPAddressApi delete_ip DELETE /ip_address/{ip} Release IP address
Upcloud::IPAddressApi get_details GET /ip_address/{ip} Get IP address details
Upcloud::IPAddressApi list_ips GET /ip_address List IP addresses
Upcloud::IPAddressApi modify_ip PUT /ip_address/{ip} Modify IP address
Upcloud::PlanApi list_plans GET /plan List available plans
Upcloud::PricesApi list_prices GET /price List prices
Upcloud::ServerApi assign_tag POST /server/{serverId}/tag/{tagList} Assign tag to a server
Upcloud::ServerApi attach_storage POST /server/{serverId}/storage/attach Attach storage
Upcloud::ServerApi create_firewall_rule POST /server/{serverId}/firewall_rule Create firewall rule
Upcloud::ServerApi create_server POST /server Create server
Upcloud::ServerApi delete_firewall_rule DELETE /server/{serverId}/firewall_rule/{firewallRuleNumber} Remove firewall rule
Upcloud::ServerApi delete_server DELETE /server/{serverId} Delete server
Upcloud::ServerApi detach_storage POST /server/{serverId}/storage/detach Detach storage
Upcloud::ServerApi eject_cdrom POST /server/{serverId}/cdrom/eject Eject CD-ROM
Upcloud::ServerApi get_firewall_rule GET /server/{serverId}/firewall_rule/{firewallRuleNumber} Get firewall rule details
Upcloud::ServerApi list_server_configurations GET /server_size List server configurations
Upcloud::ServerApi list_servers GET /server List of servers
Upcloud::ServerApi load_cdrom POST /server/{serverId}/storage/cdrom/load Load CD-ROM
Upcloud::ServerApi modify_server PUT /server/{serverId} Modify server
Upcloud::ServerApi restart_server POST /server/{serverId}/restart Restart server
Upcloud::ServerApi server_details GET /server/{serverId} Get server details
Upcloud::ServerApi server_server_id_firewall_rule_get GET /server/{serverId}/firewall_rule List firewall rules
Upcloud::ServerApi start_server POST /server/{serverId}/start Start server
Upcloud::ServerApi stop_server POST /server/{serverId}/stop Stop server
Upcloud::ServerApi untag POST /server/{serverId}/untag/{tagName} Remove tag from server
Upcloud::StorageApi attach_storage POST /server/{serverId}/storage/attach Attach storage
Upcloud::StorageApi backup_storage POST /storage/{storageId}/backup Create backup
Upcloud::StorageApi cancel_operation POST /storage/{storageId}/cancel Cancel storage operation
Upcloud::StorageApi clone_storage POST /storage/{storageId}/clone Clone storage
Upcloud::StorageApi create_storage POST /storage Create storage
Upcloud::StorageApi delete_storage DELETE /storage/{storageId} Delete storage
Upcloud::StorageApi detach_storage POST /server/{serverId}/storage/detach Detach storage
Upcloud::StorageApi eject_cdrom POST /server/{serverId}/cdrom/eject Eject CD-ROM
Upcloud::StorageApi favorite_storage POST /storage/{storageId}/favorite Add storage to favorites
Upcloud::StorageApi get_storage_details GET /storage/{storageId} Get storage details
Upcloud::StorageApi list_storage_types GET /storage/{type}/ List of storages by type
Upcloud::StorageApi list_storages GET /storage List of storages
Upcloud::StorageApi load_cdrom POST /server/{serverId}/storage/cdrom/load Load CD-ROM
Upcloud::StorageApi modify_storage PUT /storage/{storageId} Modify storage
Upcloud::StorageApi restore_storage POST /storage/{storageId}/restore Restore backup
Upcloud::StorageApi templatize_storage POST /storage/{storageId}/templatize Templatize storage
Upcloud::StorageApi unfavorite_storage DELETE /storage/{storageId}/favorite Remove storage from favorites
Upcloud::TagApi assign_tag POST /server/{serverId}/tag/{tagList} Assign tag to a server
Upcloud::TagApi create_tag POST /tag Create a new tag
Upcloud::TagApi delete_tag DELETE /tag/{tagName} Delete tag
Upcloud::TagApi list_tags GET /tag List existing tags
Upcloud::TagApi modify_tag PUT /tag/{tagName} Modify existing tag
Upcloud::TagApi untag POST /server/{serverId}/untag/{tagName} Remove tag from server
Upcloud::TimezoneApi list_timezones GET /timezone List timezones
Upcloud::ZoneApi list_zones GET /zone List available zones

Documentation of the models

Documentation for authorization

It's recommended to store the username and password as environmental variables while developing API applications to avoid accidentally publishing your account credentials.

baseAuth

  • Type: HTTP basic authentication
  • Username: Your UpCloud API username
  • Password: Your UpCloud API user's password

Issues

Found a bug, have a problem using the client, or anything else about the library you would want to mention? Open a new issue here to get in contact.

License

This project is distributed under the MIT License, see LICENSE.txt for more information.