scheduler

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodDeploy    = "Deploy"
	MethodRestart   = "Restart"
	MethodTerminate = "Terminate"
)

Commands supported by the scheduler.

View Source
const (
	// MetadataKeyError is the name of the metadata key that stores the error message.
	MetadataKeyError = "net.oasis.error"
	// MetadataKeySchedulerRAK is the name of the metadata key that stores the scheduler RAK.
	MetadataKeySchedulerRAK = "net.oasis.scheduler.rak"
	// MetadataKeyTLSPk is the name of the metadata key that stores the TLS public key.
	MetadataKeyTLSPk = "net.oasis.tls.pk"
	// MetadataKeySchedulerAPI is the name of the metadata key that stores the API endpoint address.
	MetadataKeySchedulerAPI = "net.oasis.scheduler.api"
)
View Source
const StdAuthContextBase = "rofl-scheduler/auth: v1"

StdAuthContextBase is the base authentication context.

Variables

This section is empty.

Functions

func NewHTTPClient added in v0.14.0

func NewHTTPClient(dsc *rofl.Registration) (*http.Client, error)

NewHTTPClient creates an HTTP client to communicate with the given scheduler.

Types

type AuthLoginRequest added in v0.14.0

type AuthLoginRequest struct {
	Method string `json:"method"`
	Data   any    `json:"data"`
}

AuthLoginRequest is the request to login.

func SignLogin added in v0.14.0

func SignLogin(sigCtx signature.Context, signer signature.Signer, domain string, provider types.Address) (*AuthLoginRequest, error)

SignLogin creates a new login request for the given provider and signs it.

type AuthLoginResponse added in v0.14.0

type AuthLoginResponse struct {
	Token  string `json:"token"`
	Expiry uint64 `json:"expiry"`
}

AuthLoginResponse is the response from the login request.

type Client added in v0.14.0

type Client struct {
	// contains filtered or unexported fields
}

Client is a ROFL scheduler API endpoint client.

func NewClient added in v0.14.0

func NewClient(dsc *rofl.Registration) (*Client, error)

NewClient creates a new ROFL scheduler API endpoint client.

func (*Client) Host added in v0.14.0

func (c *Client) Host() string

Host is the hostname.

func (*Client) Login added in v0.14.0

func (c *Client) Login(ctx context.Context, req *AuthLoginRequest) error

Login authenticates to the scheduler using the given login request.

func (*Client) LogsGet added in v0.14.0

func (c *Client) LogsGet(ctx context.Context, machineID roflmarket.InstanceID, since time.Time) ([]string, error)

LogsGet fetches logs for the given machine.

type Command

type Command struct {
	// Method is the method name.
	Method string `json:"method"`
	// Args are the method arguments.
	Args cbor.RawMessage `json:"args"`
}

Command is a command to be executed on a specific instance by the scheduler.

type DeployRequest

type DeployRequest struct {
	// Deployment is the deployment to deploy.
	Deployment roflmarket.Deployment `json:"deployment"`
	// WipeStorage is a flag indicating whether persistent storage should be wiped.
	WipeStorage bool `json:"wipe_storage"`
}

DeployRequest is a deployment request.

type LogsGetRequest added in v0.14.0

type LogsGetRequest struct {
	// InstanceID is the instance identifier.
	InstanceID string `json:"instance_id"`
	// ComponentID is the optional component identifier.
	ComponentID string `json:"component_id,omitempty"`
	// Since is an optional UNIX timestamp to filter log entries by. Only entries with higher
	// timestamps will be returned.
	Since uint64 `json:"since,omitempty"`
}

LogsGetRequest is a request to get logs.

type LogsGetResponse added in v0.14.0

type LogsGetResponse struct {
	// Logs are the resulting log lines.
	Logs []string `json:"logs"`
}

LogsGetResponse is the response from the LogsGet request.

type RestartRequest

type RestartRequest struct {
	// WipeStorage is a flag indicating whether persistent storage should be wiped.
	WipeStorage bool `json:"wipe_storage"`
}

RestartRequest is an instance restart request.

type StdAuthBody added in v0.14.0

type StdAuthBody struct {
	Version   uint16          `json:"v"`
	Domain    string          `json:"domain"`
	Provider  types.Address   `json:"provider"`
	Signer    types.PublicKey `json:"signer"`
	Nonce     string          `json:"nonce"`
	NotBefore uint64          `json:"not_before"`
	NotAfter  uint64          `json:"not_after"`
}

StdAuthBody is the standard authentication body.

type StdAuthLoginRequest added in v0.14.0

type StdAuthLoginRequest struct {
	Body      string `json:"body"`
	Signature string `json:"signature"`
}

StdAuthLoginRequest is the body for the standard authentication method.

type TerminateRequest

type TerminateRequest struct {
	// WipeStorage is a flag indicating whether persistent storage should be wiped.
	WipeStorage bool `json:"wipe_storage"`
}

TerminateRequest is an instance termination request.

Jump to

Keyboard shortcuts

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