Documentation
¶
Overview ¶
Package thunder provides a typed client for Central's organization API-token bearer interface.
The SDK intentionally covers the automation surface used by thunderd clients: creating client and server enrollment tokens, deleting servers by enrollment token, listing and revoking registered clients and servers, creating/listing zones, and managing zone GPU oversubscription targets.
Index ¶
- Constants
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func IsPermanent(err error) bool
- func IsUnauthorized(err error) bool
- type APIError
- type Client
- type ClientEnrollmentCommandRequest
- type CreateClientEnrollmentRequest
- type CreateServerEnrollmentRequest
- type CreateZoneRequest
- type CreateZoneResponse
- type DeleteEnrollmentServerResponse
- type EnrollmentToken
- type Option
- type RevokeClientResponse
- type RevokeServerResponse
- type Server
- type ServerConfigurations
- type ServerEnrollmentCommandRequest
- type Thunder
- func (c *Thunder) ClientEnrollmentCommand(enrollmentToken string) string
- func (c *Thunder) ClientEnrollmentCommandFor(req ClientEnrollmentCommandRequest) string
- func (c *Thunder) CreateClientEnrollment(ctx context.Context, req CreateClientEnrollmentRequest) (EnrollmentToken, error)
- func (c *Thunder) CreateServerEnrollment(ctx context.Context, req CreateServerEnrollmentRequest) (EnrollmentToken, error)
- func (c *Thunder) CreateZone(ctx context.Context, req CreateZoneRequest) (CreateZoneResponse, error)
- func (c *Thunder) DeleteEnrollmentServer(ctx context.Context, enrollmentTokenID string) (DeleteEnrollmentServerResponse, error)
- func (c *Thunder) DeleteZone(ctx context.Context, zoneID string) error
- func (c *Thunder) EnrollClient(ctx context.Context, req CreateClientEnrollmentRequest) (EnrollmentToken, error)
- func (c *Thunder) EnrollServer(ctx context.Context, req CreateServerEnrollmentRequest) (EnrollmentToken, error)
- func (c *Thunder) ListClients(ctx context.Context, zoneID string) ([]Client, error)
- func (c *Thunder) ListServers(ctx context.Context, zoneID string) ([]Server, error)
- func (c *Thunder) ListZoneOversubscriptionTargets(ctx context.Context, zoneID string) (ZoneOversubscriptionTargetsResponse, error)
- func (c *Thunder) ListZones(ctx context.Context) ([]Zone, error)
- func (c *Thunder) RevokeClient(ctx context.Context, clientID string) (RevokeClientResponse, error)
- func (c *Thunder) RevokeServer(ctx context.Context, serverID string) (RevokeServerResponse, error)
- func (c *Thunder) ServerEnrollmentCommand(req ServerEnrollmentCommandRequest) string
- func (c *Thunder) SetZoneOversubscriptionTargets(ctx context.Context, zoneID string, targets []ZoneOversubscriptionTarget) (ZoneOversubscriptionTargetsResponse, error)
- func (c *Thunder) UnenrollClient(ctx context.Context, enrollmentTokenID string) (DeleteEnrollmentServerResponse, error)
- func (c *Thunder) UnenrollServer(ctx context.Context, enrollmentTokenID string) (DeleteEnrollmentServerResponse, error)
- type Zone
- type ZoneOversubscriptionTarget
- type ZoneOversubscriptionTargetsResponse
Constants ¶
const ( DefaultBaseURL = "https://api.thundercompute.com:2096" DefaultInstallURL = "https://get.thundercompute.com/install.sh" RoleClient = "client" RoleServer = "server" CapabilityCreateClientEnrollmentToken = "client_enrollment_tokens:create" CapabilityCreateServerEnrollmentToken = "server_enrollment_tokens:create" CapabilityRevokeClient = "clients:revoke" CapabilityRevokeHost = "hosts:revoke" CapabilityReadHosts = "hosts:read" CapabilityReadClients = "clients:read" CapabilityReadZones = "zones:read" CapabilityWriteZones = "zones:write" CapabilityDeleteZone = "zones:delete" CapabilityCreateZone = "zones:create" )
Variables ¶
This section is empty.
Functions ¶
func IsConflict ¶
func IsForbidden ¶
func IsNotFound ¶
func IsPermanent ¶
func IsUnauthorized ¶
Types ¶
type APIError ¶
type APIError struct {
Method string
Path string
StatusCode int
Status string
ErrorType string `json:"error"`
Message string `json:"message"`
}
APIError is returned when Central responds with a non-2xx status.
func (*APIError) IsConflict ¶
func (*APIError) IsForbidden ¶
func (*APIError) IsNotFound ¶
func (*APIError) IsPermanent ¶
IsPermanent reports whether retrying the same request should not help.
func (*APIError) IsUnauthorized ¶
type Client ¶
type Client struct {
ClientID string `json:"clientId"`
ZoneID string `json:"zoneId"`
DisplayName string `json:"displayName"`
GPUType string `json:"gpuType"`
GPUCount uint32 `json:"gpuCount"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
LastSeenAt *time.Time `json:"lastSeenAt,omitempty"`
DecommissionedAt *time.Time `json:"decommissionedAt,omitempty"`
}
type CreateZoneRequest ¶
type CreateZoneRequest struct {
DisplayName string `json:"displayName,omitempty"`
}
type CreateZoneResponse ¶
type EnrollmentToken ¶
type EnrollmentToken struct {
EnrollmentTokenID string `json:"enrollmentTokenId"`
EnrollmentToken string `json:"enrollmentToken"`
OrgID string `json:"orgId"`
ZoneID string `json:"zoneId,omitempty"`
Role string `json:"role"`
GPUType string `json:"gpuType,omitempty"`
GPUCount uint32 `json:"gpuCount,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
}
type Option ¶
type Option func(*Thunder)
func WithHTTPClient ¶
func WithInstallURL ¶
func WithUserAgent ¶
type RevokeClientResponse ¶
type RevokeServerResponse ¶
type Server ¶
type Server struct {
ServerID string `json:"hostId"`
ZoneID string `json:"zoneId"`
DisplayName string `json:"displayName"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
ThunderdVersion *string `json:"thunderdVersion,omitempty"`
GPUType string `json:"gpuType"`
GPUCount uint32 `json:"gpuCount"`
Status string `json:"status"`
LastSeenAt *time.Time `json:"lastSeenAt,omitempty"`
Configurations ServerConfigurations `json:"configurations"`
}
type ServerConfigurations ¶ added in v0.2.0
type ServerConfigurations struct {
Cordoned bool `json:"cordoned"`
}
ServerConfigurations contains operator-declared controls that affect how the control plane uses a server independently of its reported health.
type Thunder ¶ added in v0.3.0
type Thunder struct {
// contains filtered or unexported fields
}
Thunder is a typed SDK over Central's organization API-token bearer surface.
func NewThunder ¶ added in v0.3.0
func (*Thunder) ClientEnrollmentCommand ¶ added in v0.3.0
func (*Thunder) ClientEnrollmentCommandFor ¶ added in v0.3.0
func (c *Thunder) ClientEnrollmentCommandFor(req ClientEnrollmentCommandRequest) string
func (*Thunder) CreateClientEnrollment ¶ added in v0.3.0
func (c *Thunder) CreateClientEnrollment(ctx context.Context, req CreateClientEnrollmentRequest) (EnrollmentToken, error)
func (*Thunder) CreateServerEnrollment ¶ added in v0.3.0
func (c *Thunder) CreateServerEnrollment(ctx context.Context, req CreateServerEnrollmentRequest) (EnrollmentToken, error)
func (*Thunder) CreateZone ¶ added in v0.3.0
func (c *Thunder) CreateZone(ctx context.Context, req CreateZoneRequest) (CreateZoneResponse, error)
func (*Thunder) DeleteEnrollmentServer ¶ added in v0.3.0
func (*Thunder) DeleteZone ¶ added in v0.3.0
func (*Thunder) EnrollClient ¶ added in v0.3.0
func (c *Thunder) EnrollClient(ctx context.Context, req CreateClientEnrollmentRequest) (EnrollmentToken, error)
func (*Thunder) EnrollServer ¶ added in v0.3.0
func (c *Thunder) EnrollServer(ctx context.Context, req CreateServerEnrollmentRequest) (EnrollmentToken, error)
func (*Thunder) ListClients ¶ added in v0.3.0
func (*Thunder) ListServers ¶ added in v0.3.0
func (*Thunder) ListZoneOversubscriptionTargets ¶ added in v0.3.0
func (*Thunder) RevokeClient ¶ added in v0.3.0
func (*Thunder) RevokeServer ¶ added in v0.3.0
func (*Thunder) ServerEnrollmentCommand ¶ added in v0.3.0
func (c *Thunder) ServerEnrollmentCommand(req ServerEnrollmentCommandRequest) string
func (*Thunder) SetZoneOversubscriptionTargets ¶ added in v0.3.0
func (c *Thunder) SetZoneOversubscriptionTargets(ctx context.Context, zoneID string, targets []ZoneOversubscriptionTarget) (ZoneOversubscriptionTargetsResponse, error)
func (*Thunder) UnenrollClient ¶ added in v0.3.0
func (*Thunder) UnenrollServer ¶ added in v0.3.0
type ZoneOversubscriptionTargetsResponse ¶
type ZoneOversubscriptionTargetsResponse struct {
OversubscriptionTargets []ZoneOversubscriptionTarget `json:"oversubscriptionTargets"`
DefaultOversubscriptionTarget float64 `json:"defaultOversubscriptionTarget"`
}