Authentication
Configure authentication for the Go SDK.
Using an Access Token
If you have an access token from the ByCloud console, you can use it directly:
package mainimport "github.com/bycoded/bycloud-go"func main() {// Using an access tokenclient := bycloud.New(bycloud.WithToken("YOUR_ACCESS_TOKEN"))}
Using API Key Credentials
For service accounts, use the access key ID and secret access key:
package mainimport "github.com/bycoded/bycloud-go"func main() {// Using API key credentialsclient := bycloud.New(bycloud.WithAPIKey("YOUR_ACCESS_KEY_ID", "YOUR_SECRET_ACCESS_KEY"),)}
Environment Variables
The SDK can automatically read credentials from environment variables. This is recommended for production deployments:
package mainimport "github.com/bycoded/bycloud-go"func main() {// The SDK automatically reads from environment variables:// BYCLOUD_TOKEN or BYCLOUD_ACCESS_KEY_ID + BYCLOUD_SECRET_ACCESS_KEYclient := bycloud.New()}
Supported environment variables: BYCLOUD_TOKEN, BYCLOUD_ACCESS_KEY_ID, BYCLOUD_SECRET_ACCESS_KEY