Help us understand the problem. What is going on with this article?

cloudatcostのクライアントライブラリを作った

More than 3 years have passed since last update.

概要

激安VPSで有名なcloudatcostのAPIが提供されたのでライブラリを作成した

cloudatcostってなに?

カナダにある激安VPSサービス

CloudatCost
Twitter
人柱: 激安VPSのcloudatcostを試してみた

API仕様

ここ読んでね

現在サポートしているAPI

  • リスト一覧取得
  • テンプレート一覧取得
  • タスク一覧取得
  • コンソールへのログイン情報 取得
  • 電源のON/OFF/REBOOT

作成したライブラリ

github

使い方

準備

ここ読んでね

環境変数の設定

CLOUDATCOST_API_LOGIN:メールアドレス
CLOUDATCOST_API_KEY:ここのsettingsで取得できます

サンプル

package main

import (
    "fmt"
    "github.com/masayukioguni/go-cloudatcost/cloudatcost"
    "os"
)

func main() {
    Login := os.Getenv("CLOUDATCOST_API_LOGIN")
    Key := os.Getenv("CLOUDATCOST_API_KEY")
    client, _ := cloudatcost.NewClient(&cloudatcost.Option{Login: Login, Key: Key})

    listservers, hr, err := client.ListServersService.ListServers()

    if err != nil {
        fmt.Printf("error: %v\n\n", err)
        return
    }

    if hr.StatusCode != 200 {
        fmt.Printf("http response error: %+v %+v \n\n", hr, err)
        return
    }

    fmt.Printf("%v,%v\n", listservers, err)

}

[{1 1 16 c1116353-29235 xxxxx c90000-689604-110144152-29235 1xxx.xxx.xxx.xxx 255.255.255.0 xxx.xxx.xxx.xxx Cloud-ip-7 c111xxxxx-xxxxx.cloudatcost.com xxxxxxx  12345 xxxxxxx Custom Ubuntu-14.04.1-LTS-64bit 1 23 512 214.355 11 0.804909862 03/20/2015 Powered Off  Safe 1}],<nil>

まとめ

  • APIのレスポンスにrootpassが入るのが怖い…
  • go langは楽しいがこれだったら curl + jq でもよかった…

TODO

  • readme更新
  • CloudAtCostのAPIが追加されたら対応予定
  • Terraformのプラグインも書く
  • CLIツールも作る
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away