mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 13:03:41 +00:00
feat: firecracker mmds identity
This commit is contained in:
parent
500354cd9b
commit
3eb610b703
23 changed files with 1813 additions and 263 deletions
|
|
@ -27,10 +27,12 @@ type bootSourceRequest struct {
|
|||
}
|
||||
|
||||
type driveRequest struct {
|
||||
DriveID string `json:"drive_id"`
|
||||
IsReadOnly bool `json:"is_read_only"`
|
||||
IsRootDevice bool `json:"is_root_device"`
|
||||
PathOnHost string `json:"path_on_host"`
|
||||
DriveID string `json:"drive_id"`
|
||||
IsReadOnly bool `json:"is_read_only"`
|
||||
IsRootDevice bool `json:"is_root_device"`
|
||||
PathOnHost string `json:"path_on_host"`
|
||||
CacheType DriveCacheType `json:"cache_type,omitempty"`
|
||||
IOEngine DriveIOEngine `json:"io_engine,omitempty"`
|
||||
}
|
||||
|
||||
type entropyRequest struct{}
|
||||
|
|
@ -58,6 +60,13 @@ type networkInterfaceRequest struct {
|
|||
IfaceID string `json:"iface_id"`
|
||||
}
|
||||
|
||||
type mmdsConfigRequest struct {
|
||||
IPv4Address string `json:"ipv4_address,omitempty"`
|
||||
NetworkInterfaces []string `json:"network_interfaces"`
|
||||
Version MMDSVersion `json:"version,omitempty"`
|
||||
IMDSCompat bool `json:"imds_compat,omitempty"`
|
||||
}
|
||||
|
||||
type serialRequest struct {
|
||||
SerialOutPath string `json:"serial_out_path"`
|
||||
}
|
||||
|
|
@ -127,6 +136,24 @@ func (c *apiClient) PutNetworkInterface(ctx context.Context, network NetworkAllo
|
|||
return c.do(ctx, http.MethodPut, endpoint, body, nil, http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (c *apiClient) PutMMDSConfig(ctx context.Context, spec MMDSSpec) error {
|
||||
body := mmdsConfigRequest{
|
||||
IPv4Address: strings.TrimSpace(spec.IPv4Address),
|
||||
NetworkInterfaces: append([]string(nil), spec.NetworkInterfaces...),
|
||||
Version: spec.Version,
|
||||
IMDSCompat: spec.IMDSCompat,
|
||||
}
|
||||
return c.do(ctx, http.MethodPut, "/mmds/config", body, nil, http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (c *apiClient) PutMMDS(ctx context.Context, data any) error {
|
||||
return c.do(ctx, http.MethodPut, "/mmds", data, nil, http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (c *apiClient) PatchMMDS(ctx context.Context, data any) error {
|
||||
return c.do(ctx, http.MethodPatch, "/mmds", data, nil, http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (c *apiClient) PutSerial(ctx context.Context, serialOutPath string) error {
|
||||
return c.do(
|
||||
ctx,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue