cloudsigma-sdk-go is the official CloudSigma SDK for the Go programming language.
# X.Y.Z is the version you need
go get github.com/cloudsigma/[email protected]
# for non Go modules usage or latest version
go get github.com/cloudsigma/cloudsigma-sdk-go
import "github.com/cloudsigma/cloudsigma-sdk-go"
Create a new CloudSigma client, then use the exposed services to access different parts of the CloudSigma API.
Currently, HTTP Basic Authentication is the only method of authenticating with the API. You can then use your credentials to create a new client:
cred := cloudsigma.NewUsernamePasswordCredentialsProvider("[email protected]", "my-secure-password")
client := cloudsigma.NewClient(cred)
If you want to specify more parameters by client initialization, use
With...
methods and pass via option pattern:
cred := cloudsigma.NewUsernamePasswordCredentialsProvider("[email protected]", "my-secure-password")
client := cloudsigma.NewClient(cred,
cloudsigma.WithLocation("fra"),
cloudsigma.WithHTTPClient(customHTTPClient),
)
List all servers for the user.
func main() {
cred := cloudsigma.NewUsernamePasswordCredentialsProvider("[email protected]", "my-secure-password")
client := cloudsigma.NewClient(cred)
// list all servers for the authenticated user
ctx := context.Background()
servers, _, err := client.Servers.List(ctx)
}
We love pull requests! Please see the contribution guidelines.
This SDK is distributed under the BSD 3-Clause License, see LICENSE for more information.