Using golang with Eucalyptus

Posted: 2014/04/24 13:24:30

Here is an example code to start a new instance in your Eucalyptus cloud using golang. We are using goamz library.

package main

import (
    "fmt"
    "github.com/mitchellh/goamz/aws"
    "github.com/mitchellh/goamz/ec2"
    "net/http"
)

func main() {
    DefaultClient := &http.Client{
        Transport: &http.Transport{
            Proxy: http.ProxyFromEnvironment,
        },
    }

    auth := aws.Auth{"AKI98", "5KZb4GbQ", ""}
    mec2 := ec2.NewWithClient(
        auth,
        aws.Region{EC2Endpoint: "http://euca-ip:8773/services/Eucalyptus"},
        DefaultClient,
    )

    options := ec2.RunInstances{
        ImageId:      "emi-F5433303",
        InstanceType: "m1.xlarge",
        KeyName:      "foo",
    }
    resp, _ := mec2.RunInstances(&options)

    fmt.Println(resp)

}

Comments

Searching my blog

Posted: 2013/11/26 14:13:47

More than a month back, I added a small scale search engine which indexes only my blog entries, you can access it either using search box in the page or from search.

It is still very initial stage of the service, the indexer is in Python and the web service is written using golang (less then 200 lines, includes few lines of html too).

Comments

FAS OpenID authentication with golang

Posted: 2013/09/17 15:46:27

Fedora accounts system provides OpenID authentication. If you are using python-fedora to do authentication in your webapp, you already know what I am talking about. I wanted to do the same, but from a webservice written in golang. I found a few working openid solutions in golang but none of them provides the sreg and other extensions which FAS supports.

I pushed patched openid.go in my github which by default supports all the extensions for FAS. We have an example which shows how to access the Verify function and the output. Now you can have FAS authentication if your app too :)

id, err := openid.Verify(
    fullUrl,
    discoveryCache, nonceStore)

Comments

Contents © 2004-2014 Kushal Das - Powered by Shonku