GithubHelp home page GithubHelp logo

bovi / qc.rb Goto Github PK

View Code? Open in Web Editor NEW
4.0 6.0 0.0 25 KB

QingCloud API Library to handle instances, networks, etc. on QingCloud.com

Home Page: https://github.com/bovi/qc.rb

License: MIT License

Ruby 100.00%

qc.rb's Introduction

qc.rb

QingCloud API Library to handle instances, networks, etc. on QingCloud.com

Installation

You can install qc.rb via RubyGems:

gem install qc.rb

Important Notice

I'm not a native chinese speaker! Yet the complete documentation of QingCloud.com is in chinese! Due to that it is reasonable to expect that my understanding of the API might not be 100% correct! You are very welcome to improve the code!

Usage

You can use qc.rb via qc as a CLI or direct as a Ruby library.

SSH

Get all public keys:

CLI Version:

qc ssh describe

.rb Version:

# Each Public Key is available in *s*
QC::KeyPair.describe {|s| puts s}

Instances

Get all instances:

CLI Version:

qc ins describe

.rb Version:

# Each instance is available in *i*
QC::Instance.describe {|i| puts i}

Create new Instance:

QC::Instance.run instance_name: 'NameOfInstance', login_keypair: 'kp-sadasd67' # => instance_id

Delete Instance:

i = QC::Instance.load 'i-adssad7'
i.terminate! # => {"action"=>"TerminateInstancesResponse", "job_id"=>"j-asd7djk", "ret_code"=>0}

Add IP device to Instance:

i = QC::Instance.load 'i-adssad7'
i.ip = 'eip-sadjkdsa7'  # => 'eip-sadjkdsa7'

Add Key Pair to Instance

i = QC::Instance.load 'i-adssad7'
i.add_keypair 'kp-2hadqpv3'  # => 'kp-2hadqpv3'

IPs

Get all IPs:

CLI Version:

qc ip describe

.rb Version:

# Each IP is available in *i*
QC::Eip.describe {|i| puts i}

Allocate new IP:

# Create IP width bandwidth 3MB
Eip.allocate bandwidth: 3   # => eip_id

Release IP:

# Release IP with ID 'eip-12djpg8q'
Eip.load('eip-12djpg8q').release!   # => true | false

Change Bandwidth:

# Change bandwidth of IP with ID 'eip-12djpg8q' to 2MB
ip = Eip.load('eip-12djpg8q')
ip.bandwidth = 2     # => 2

Volumes

Get all Volumes:

CLI Version:

qc vol describe

.rb Version:

# Each Volume is available in *v*
QC::Volume.describe {|v| puts v}

qc.rb's People

Contributors

bovi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.