gosdc
is a Go client for Joyent's SmartDataCenter
Table of Contents
To create a client
(*cloudapi.Client
),
you'll need a few things:
- your account ID
- the ID of the key associated with your account
- your private key material
- the cloud endpoint you want to use (for example
https://us-east-1.api.joyentcloud.com
)
Given these four pieces of information, you can initialize a client with the following (N.B. error handling is glossed over in this example for the sake of brevity):
package main
import (
"github.com/joyent/gocommon/client"
"github.com/joyent/gosdc/cloudapi"
"github.com/joyent/gosign/auth"
"io/ioutil"
)
func client(key, keyId, account, endpoint string) *cloudapi.Client {
keyData, _ := ioutil.ReadFile(key)
auth, _ := auth.NewAuth(account, string(keyData), "rsa-sha256")
creds := &auth.Credentials{
UserAuthentication: auth,
SdcKeyId: keyId,
SdcEndpoint: endpoint,
}
return cloudapi.New(client.NewClient(
endpoint,
cloudapi.DefaultAPIVersion,
creds,
&cloudapi.Logger
))
}
Projects using the gosdc API:
After creating a client, you can manipulate resources in the following ways:
gosdc is licensed under the Mozilla Public License Version 2.0, a copy of which is available at LICENSE