zstack-sdk-go

module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: Apache-2.0

README

ZStack SDK for Go

ZStack SDK for Go

This repository provides a Go SDK for interacting with the ZStack cloud platform API. It allows developers to manage ZStack resources programmatically using Go.

Features
  • Complete API coverage for ZStack cloud platform
  • Type-safe Go client for ZStack API operations
  • Support for authentication and session management
  • Structured request and response handling
  • Error handling and logging capabilities
  • Compatible with Terraform provider development
Installation
go get github.com/terraform-zstack-modules/zstack-sdk-go
Usage
Initialize Client with Account Login
import (
    "github.com/terraform-zstack-modules/zstack-sdk-go/pkg/client"
    "github.com/terraform-zstack-modules/zstack-sdk-go/pkg/param"
)

// Create a client with account login authentication
accountLoginClient := client.NewZSClient(
    client.DefaultZSConfig("ZStack MN HOST IP").
        LoginAccount("admin", "password").
        ReadOnly(false).
        Debug(true),
)

// Login to ZStack
_, err := accountLoginClient.Login()
if err != nil {
    // Handle error
}
defer accountLoginClient.Logout()

// Query clusters
clusters, err := accountLoginClient.QueryCluster(param.NewQueryParam())
if err != nil {
    // Handle error
}
// Use clusters data

Initialize Client with Access Key
import (
    "github.com/terraform-zstack-modules/zstack-sdk-go/pkg/client"
    "github.com/terraform-zstack-modules/zstack-sdk-go/pkg/param"
)

// Create a client with access key authentication
accessKeyClient := client.NewZSClient(
    client.DefaultZSConfig("ZStack MN HOST IP").
        AccessKey("your-access-key-id", "your-access-key-secret").
        ReadOnly(false).
        Debug(false),
)

// Query clusters
clusters, err := accessKeyClient.QueryCluster(param.NewQueryParam())
if err != nil {
    // Handle error
}
// Use clusters data

Authentication

The SDK supports the following authentication methods:

  • Username and password authentication
  • Session-based authentication with automatic token renewal
  • API key authentication
API Coverage

This SDK provides Go bindings for all major ZStack API operations, including but not limited to:

  • Compute resources (instances, volumes)
  • Network resources (L2/L3 networks, security groups)
  • Storage resources (primary storage, backup storage)
  • Identity and access management
  • System management operations
Contributing

Contributions to the ZStack Go SDK are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request
License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Support

For issues, questions and discussions please use the GitHub Issues.


This SDK is not officially associated with ZStack. It is a community-maintained project designed to facilitate integration with ZStack cloud platform.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL