Files
moby/client/system_info.go
Austin Vazquez e46058cbae client: refactor Events, Info, RegistryLogin
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 09:36:23 +01:00

35 lines
752 B
Go

package client
import (
"context"
"encoding/json"
"fmt"
"net/url"
"github.com/moby/moby/api/types/system"
)
type InfoOptions struct {
// No options currently; placeholder for future use
}
type SystemInfoResult struct {
Info system.Info
}
// Info returns information about the docker server.
func (cli *Client) Info(ctx context.Context, options InfoOptions) (SystemInfoResult, error) {
resp, err := cli.get(ctx, "/info", url.Values{}, nil)
defer ensureReaderClosed(resp)
if err != nil {
return SystemInfoResult{}, err
}
var info system.Info
if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
return SystemInfoResult{}, fmt.Errorf("Error reading remote info: %v", err)
}
return SystemInfoResult{Info: info}, nil
}