Skip to content
DobytchickPublic

About

Go SDK for the MCSManager API

Topics

Resources

Stars

15 stars

Watchers

2 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcsmapi

Go CI Go Reference License: Apache 2.0

A Go client for the MCSManager panel API. Manage users, daemons, instances, files, Docker images, and dashboard data from Go.

Install

Requires Go 1.23.4 or newer.

go get github.com/Dobytchick/mcsmapi

Quick start

Create an API key in MCSManager, then set MCSM_API_KEY in your environment. Use HTTPS when connecting to a remote panel: the MCSManager API sends the key as a query parameter.

package main

import (
    "fmt"
    "log"
    "os"

    "github.com/Dobytchick/mcsmapi"
)

func main() {
    client := mcsmapi.NewClient(os.Getenv("MCSM_API_KEY"), "http://localhost:23333", nil)
    users, err := client.User.GetList(&mcsmapi.UserQueryParams{Page: 1, PageSize: 10})
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%+v\n", users.Data)
}

NewClient accepts an optional *http.Client; passing nil uses a client with a 10-second timeout. API and HTTP failures are returned as errors.

API areas

Client Typical operations
client.User Search, create, update, and delete users
client.Daemon Add, remove, and connect daemons
client.Instance List, create, control, and send commands to instances
client.File List, read, update, copy, move, archive, and delete files
client.Image Inspect images, containers, networks, and build progress
client.Dashboard Read the panel overview

Example: send a command

result, err := client.Instance.SendCommandResult("instance-uuid", "daemon-uuid", "say Hello from Go")
if err != nil {
    log.Fatal(err)
}
fmt.Println(result.Data)

File transfers

File.Download and File.Upload request one-time transfer credentials from the panel. The actual download or multipart upload takes place against the daemon address returned by the API. See the MCSManager file API for that second step.

Browse the usage guide, runnable examples, and the Go package reference for request and response types.

Development

go test ./...
go vet ./...

Each example has its own directory and can be run with go run ./examples/<name> after setting MCSM_API_KEY and replacing placeholder IDs.

License

Apache 2.0.

About

Go SDK for the MCSManager API

Topics

Resources

Stars

15 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages