# README
Hazelcast Cloud SDK - Go
Hazelcast Cloud is a client library to consume Public API easily.
You can view Hazelcast Cloud API references from here: https://docs.cloud.hazelcast.com/docs/api-reference
Install
go get github.com/hazelcast/[email protected]
where X.Y.Z is the version you need.
or
go get github.com/hazelcast/hazelcast-cloud-sdk-go
for non Go modules usage or latest version.
Usage
import "github.com/hazelcast/hazelcast-cloud-sdk-go"
Create a new HazelcastCloud client, then use the exposed services to access different parts of the Hazelcast Cloud Public API.
Authentication
Currently, using API Keys and API Secrets is the only method of authenticating with the API. You can manage your tokens in Hazelcast Cloud Developer Page.
Then, you can use your API Key and API Secret to create a new client as shown below:
package main
import (
"github.com/hazelcast/hazelcast-cloud-sdk-go"
)
func main() {
client := hazelcastcloud.NewFromCredentials("API-KEY", "API-SECRET")
}
Also, you can use hazelcastcloud.New()
to provider your API Key and API Secret from environment variables as HZ_CLOUD_API_KEY
and HZ_CLOUD_API_SECRET
:rocket: Examples
- Create a new Starter Cluster:
clusterName := "my-awesome-cluster"
createInput := models.CreateStarterClusterInput{
Name: clusterName,
CloudProvider: "aws",
Region: "us-west-2",
ClusterType: "FREE",
HazelcastVersion: "4.0",
TotalMemory: 0.2,
}
newCluster, _, createErr := client.StarterCluster.Create(context.Background(), &createInput)
if createErr != nil {
fmt.Printf("An error occurred: %s\n\n", createErr)
return
}
🏷️ Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
⭐️ Documentation
For details on all the functionality in this library, see the GoDoc documentation. Also, you can refer API References for Graphql queries and mutations to understand payloads.
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
📝 License
Copyright © 2020 Hazelcast.
This project is Apache License 2.0 licensed.