Documentation
¶
Index ¶
- Variables
- func NewParser(cli *UnikraftCLI) (*kong.Kong, error)
- func NewTUIModel(ctx context.Context, resourceArg, nameArg string) (tea.Model, error)
- type AnyResource
- func (a AnyResource) Create(ctx context.Context, fields []resource.Field) ([]resource.Resource, error)
- func (a AnyResource) Delete(ctx context.Context, targets []resource.Resource) error
- func (a AnyResource) Edit(ctx context.Context, target resource.Resource, fields []resource.Field) (resource.Resource, error)
- func (a AnyResource) Fields() ([]resource.Field, error)
- func (a AnyResource) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (a AnyResource) Key() resource.Key
- func (a AnyResource) List(ctx context.Context) ([]resource.Resource, error)
- func (a AnyResource) Raw() any
- func (a AnyResource) Type() resource.Type
- func (a AnyResource) WithType(typ string) resource.Resource
- type AnyResourceCmd
- type AnyResourceCreateCmd
- type AnyResourceEditCmd
- type BuildCmd
- type Certificate
- func (Certificate) Create(ctx context.Context, fields []resource.Field) ([]resource.Resource, error)
- func (Certificate) Delete(ctx context.Context, targets []resource.Resource) error
- func (Certificate) Examples() map[cmd.CmdType][]kingkong.Example
- func (c Certificate) Fields() ([]resource.Field, error)
- func (Certificate) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (c Certificate) Key() resource.Key
- func (Certificate) List(ctx context.Context) ([]resource.Resource, error)
- func (c Certificate) Raw() any
- func (Certificate) Type() resource.Type
- type CertificateCreateCmd
- type CertificatesCmd
- type Config
- func (c Config) Default(ctx context.Context) (resource.Resource, error)
- func (Config) Examples() map[cmd.CmdType][]kingkong.Example
- func (c Config) Fields() ([]resource.Field, error)
- func (Config) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (c Config) Key() resource.Key
- func (c Config) Raw() any
- func (Config) Type() resource.Type
- type ConfigCmd
- type Domain
- type Image
- func (Image) Delete(ctx context.Context, targets []resource.Resource) error
- func (Image) Examples() map[cmd.CmdType][]kingkong.Example
- func (i Image) Fields() ([]resource.Field, error)
- func (Image) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (i Image) Key() resource.Key
- func (i Image) Raw() any
- func (Image) Type() resource.Type
- type ImageConfig
- type ImageEntry
- func (ImageEntry) Examples() map[cmd.CmdType][]kingkong.Example
- func (i ImageEntry) Fields() ([]resource.Field, error)
- func (ImageEntry) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (i ImageEntry) Key() resource.Key
- func (ImageEntry) List(ctx context.Context) ([]resource.Resource, error)
- func (i ImageEntry) Raw() any
- func (ImageEntry) Type() resource.Type
- type ImageFile
- type ImageMetadata
- type ImagesCmd
- type ImagesCopyCmd
- type ImagesListCmd
- type Instance
- func (Instance) Create(ctx context.Context, fields []resource.Field) ([]resource.Resource, error)
- func (Instance) Delete(ctx context.Context, targets []resource.Resource) error
- func (Instance) Edit(ctx context.Context, target resource.Resource, fields []resource.Field) (resource.Resource, error)
- func (Instance) Examples() map[cmd.CmdType][]kingkong.Example
- func (i Instance) Fields() ([]resource.Field, error)
- func (Instance) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (i Instance) Key() resource.Key
- func (Instance) List(ctx context.Context) ([]resource.Resource, error)
- func (i Instance) Raw() any
- func (Instance) Subpanels(ctx context.Context, key string) []tea.Model
- func (Instance) Type() resource.Type
- type InstanceCreateCmd
- type InstanceEditCmd
- type InstanceScaleToZero
- type InstanceService
- type InstanceVolume
- type InstancesCmd
- type InstancesLogsCmd
- type InstancesRestartCmd
- type InstancesStartCmd
- type InstancesStopCmd
- type Metro
- func (Metro) Examples() map[cmd.CmdType][]kingkong.Example
- func (i Metro) Fields() ([]resource.Field, error)
- func (Metro) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (i Metro) Key() resource.Key
- func (Metro) List(ctx context.Context) ([]resource.Resource, error)
- func (i Metro) Raw() any
- func (Metro) Type() resource.Type
- type MetrosCmd
- type Profile
- func (Profile) Examples() map[cmd.CmdType][]kingkong.Example
- func (i Profile) Fields() ([]resource.Field, error)
- func (Profile) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (i Profile) Key() resource.Key
- func (Profile) List(ctx context.Context) ([]resource.Resource, error)
- func (i Profile) Raw() any
- func (Profile) Type() resource.Type
- type ProfileCmd
- type RunCmd
- type SendAnalyticsCmd
- type Service
- type ServiceCreateCmd
- type ServiceEditCmd
- type ServiceGroup
- func (ServiceGroup) Create(ctx context.Context, fields []resource.Field) ([]resource.Resource, error)
- func (ServiceGroup) Delete(ctx context.Context, targets []resource.Resource) error
- func (ServiceGroup) Edit(ctx context.Context, target resource.Resource, fields []resource.Field) (resource.Resource, error)
- func (ServiceGroup) Examples() map[cmd.CmdType][]kingkong.Example
- func (s ServiceGroup) Fields() ([]resource.Field, error)
- func (ServiceGroup) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (s ServiceGroup) Key() resource.Key
- func (ServiceGroup) List(ctx context.Context) ([]resource.Resource, error)
- func (s ServiceGroup) Raw() any
- func (ServiceGroup) Type() resource.Type
- type ServicesCmd
- type StopOpts
- type TUICmd
- type UnikraftCLI
- type UpgradeCmd
- type UseCmd
- type Volume
- func (Volume) Create(ctx context.Context, fields []resource.Field) ([]resource.Resource, error)
- func (Volume) Delete(ctx context.Context, targets []resource.Resource) error
- func (Volume) Edit(ctx context.Context, target resource.Resource, fields []resource.Field) (resource.Resource, error)
- func (Volume) Examples() map[cmd.CmdType][]kingkong.Example
- func (i Volume) Fields() ([]resource.Field, error)
- func (Volume) Get(ctx context.Context, keys []string) ([]resource.Resource, error)
- func (i Volume) Key() resource.Key
- func (Volume) List(ctx context.Context) ([]resource.Resource, error)
- func (i Volume) Raw() any
- func (Volume) Type() resource.Type
- type VolumeCreateCmd
- type VolumeEditCmd
- type VolumesCloneCmd
- type VolumesCmd
Constants ¶
This section is empty.
Variables ¶
var ErrChecksumNotAvailable = errors.New("checksum file not available")
ErrChecksumNotAvailable indicates the checksum file could not be fetched.
var SandboxedResources = []resource.Resource{ Instance{}, Volume{}, ServiceGroup{}, Certificate{}, }
Functions ¶
Types ¶
type AnyResource ¶ added in v0.2.0
type AnyResource struct {
Type_ string `field:"type,short" create:"set,required"`
Key_ string `field:"key,short"`
// contains filtered or unexported fields
}
AnyResource is a special resource that multiplexes to different backend resources based on the key prefix (e.g., "instance:", "volume:", etc.). When populated, resources have their full fields. When empty (header field), it only has "type" and "key" fields.
func (AnyResource) Key ¶ added in v0.2.0
func (a AnyResource) Key() resource.Key
func (AnyResource) Raw ¶ added in v0.2.0
func (a AnyResource) Raw() any
func (AnyResource) Type ¶ added in v0.2.0
func (a AnyResource) Type() resource.Type
type AnyResourceCmd ¶ added in v0.2.0
type AnyResourceCmd struct {
cmd.ResourceCmd[AnyResource]
cmd.GettableResourceCmd[AnyResource]
cmd.ListableResourceCmd[AnyResource]
Create AnyResourceCreateCmd `cmd:"" help:"Create a resource."`
Edit AnyResourceEditCmd `cmd:"" help:"Edit a resource."`
cmd.BulkDeletableResourceCmd[AnyResource]
}
type AnyResourceCreateCmd ¶ added in v0.2.2
type AnyResourceCreateCmd struct {
cmd.ResourceCreateCmd[AnyResource]
Type string `group:"flag-create" shortcut:"type" help:"Resource type." placeholder:"type" example:"instance,volume,service,certificate"`
}
AnyResourceCreateCmd extends the generic resource create command with shortcut flags for commonly used resource fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard create pipeline runs.
type AnyResourceEditCmd ¶ added in v0.2.2
type AnyResourceEditCmd struct {
cmd.ResourceEditCmd[AnyResource]
}
AnyResourceEditCmd extends the generic resource edit command to enable shortcut flag handling.
type BuildCmd ¶ added in v0.2.0
type BuildCmd struct {
Input string `arg:"" default:"." help:"Path to the input directory."`
Output string `short:"o" help:"Output destination"`
// similar to docker compose build
BuildArg []string `help:"Set build-time variables."`
NoCache bool `help:"Do not use cache when building the image."`
Secret []string `help:"Secret to expose to the build (format: \"id=mysecret[,src=/local/secret]\")."`
SSH []string `help:"SSH agent socket or keys to expose to the build (format: \"default|<id>[=<socket>|<key>[,<key>]]\")."`
}
type Certificate ¶
type Certificate struct {
MetroName string `mirror:"metro.name" field:"metro,short" create:"set,required"`
Name string `mirror:"certificate.name" field:",short" create:"set"`
UUID string `mirror:"certificate.uuid" field:",long"`
CommonName string `mirror:"certificate.common_name" field:",short"`
Subject string `mirror:"certificate.subject" field:",long"`
Issuer string `mirror:"certificate.issuer" field:",long"`
SerialNumber string `mirror:"certificate.serial_number" field:",long"`
State types.CertificateState `mirror:"certificate.state" field:",short"`
CN string `field:"cn,invisible,valueless" create:"set,required"`
Chain string `field:"chain,invisible,valueless" create:"set,required"`
Pkey string `field:"pkey,invisible,valueless" create:"set,required"`
Timestamps struct {
Created types.RelativeTime `mirror:"certificate.created_at" field:",short"`
NotBefore types.RelativeTime `mirror:"certificate.not_before" field:",long"`
NotAfter types.RelativeTime `mirror:"certificate.not_after" field:",short"`
}
Certificate platform.Certificate `field:"-" json:"certificate"`
Metro *config.Metro `field:"-" json:"metro"`
// contains filtered or unexported fields
}
func (Certificate) Key ¶
func (c Certificate) Key() resource.Key
func (Certificate) Raw ¶
func (c Certificate) Raw() any
func (Certificate) Type ¶
func (Certificate) Type() resource.Type
type CertificateCreateCmd ¶ added in v0.2.2
type CertificateCreateCmd struct {
cmd.ResourceCreateCmd[Certificate]
Metro string `group:"flag-create" shortcut:"metro" help:"Metro to create in." placeholder:"metro" example:"fra,sfo,nyc"`
Name string `group:"flag-create" shortcut:"name" help:"Certificate name." placeholder:"name"`
CommonName string `` /* 126-byte string literal not displayed */
Chain string `group:"flag-create" shortcut-file:"chain" help:"Certificate chain file." placeholder:"file"`
PrivateKey string `group:"flag-create" shortcut-file:"pkey" help:"Certificate private key file." placeholder:"file" aliases:"pkey"`
}
CertificateCreateCmd extends the generic resource create command with shortcut flags for commonly used certificate fields. Each field tagged with `shortcut:"<path>"` or `shortcut-file:"<path>"` is translated into a --set or --set-file entry before the standard create pipeline runs.
type CertificatesCmd ¶
type CertificatesCmd struct {
cmd.ResourceCmd[Certificate]
cmd.GettableResourceCmd[Certificate]
cmd.WaitableResourceCmd[Certificate]
cmd.ListableResourceCmd[Certificate]
cmd.BulkDeletableResourceCmd[Certificate]
Create CertificateCreateCmd `cmd:"" help:"Create a certificate."`
}
type Config ¶ added in v0.2.0
Config wraps config.Config to implement the resource interfaces.
type ConfigCmd ¶ added in v0.2.0
type ConfigCmd struct {
cmd.ResourceCmd[Config]
cmd.GettableResourceCmd[Config]
}
type Domain ¶
type Domain struct {
// TODO: consolidate these and make easier to parse
FQDN string `name:"fqdn" json:"fqdn" mirror:"fqdn" field:",short"`
Name string `name:"name" json:"name,omitempty" field:"-"` // field:"-" excludes from field system, name:"name" allows --set parsing
Certificate struct {
Name string `name:"name" json:"name" mirror:"name" field:",long"`
UUID string `name:"uuid" json:"uuid" mirror:"uuid" field:",long"`
} `name:"certificate" json:"certificate,omitzero" mirror:"certificate"`
}
func (*Domain) UnmarshalJSON ¶ added in v0.2.2
func (*Domain) UnmarshalText ¶ added in v0.2.2
type Image ¶
type Image struct {
Ref types.ImageRef[reference.Named] `field:",short"`
Digest digest.Digest `field:",long"`
Config ImageConfig `field:",embed"`
Metadata ImageMetadata `field:",long,embed"`
Kernel *ImageFile `field:",long,embed"`
KernelDebug *ImageFile `field:"kernel.dbg,long,embed"`
Initrd *ImageFile `field:",long,embed"`
Roms []ImageFile `field:",long,embed"`
Image imagespec.Image `field:"-" json:"image"`
}
type ImageConfig ¶
type ImageEntry ¶
type ImageEntry struct {
Ref types.ImageRef[reference.NamedTagged] `field:",short"`
Digest digest.Digest `field:",short"`
Namespace string
Canonical reference.Canonical `field:"-"`
Image controlplane.Image `field:"-" json:"image"`
}
func (ImageEntry) Key ¶
func (i ImageEntry) Key() resource.Key
func (ImageEntry) Raw ¶
func (i ImageEntry) Raw() any
func (ImageEntry) Type ¶
func (ImageEntry) Type() resource.Type
type ImageMetadata ¶ added in v0.2.2
type ImagesCmd ¶
type ImagesCmd struct {
cmd.ResourceCmd[ImageEntry]
cmd.GettableResourceCmd[Image]
cmd.DeletableResourceCmd[Image]
List ImagesListCmd `cmd:"" help:"List images." aliases:"ls"`
Copy ImagesCopyCmd `cmd:"" help:"Copy images."`
}
type ImagesCopyCmd ¶
type ImagesCopyCmd struct {
Source string `arg:"" help:"Source image reference."`
Dest string `arg:"" help:"Destination image reference."`
}
func (ImagesCopyCmd) Examples ¶
func (cmd ImagesCopyCmd) Examples() []kingkong.Example
type ImagesListCmd ¶ added in v0.2.0
type ImagesListCmd struct {
cmd.ResourceListCmd[ImageEntry]
}
type Instance ¶
type Instance struct {
MetroName string `mirror:"metro.name" field:"metro,short" create:"set,required"`
Name string `mirror:"instance.name" field:",short" create:"set"`
UUID string `mirror:"instance.uuid" field:",long"`
Tags []string `mirror:"instance.tags"`
State types.InstanceState `mirror:"instance.state" field:",short" edit:"set"`
Image types.ImageRef[reference.Named] `mirror:"instance.image" field:",short" create:"set,required" edit:"set"`
Runtime struct {
Args []string `mirror:"instance.args" field:",short" create:"set" edit:"set"`
Env map[string]string `mirror:"instance.env" field:",long" create:"set" edit:"set,add,del=keys"`
}
Resources struct {
Memory types.SizeMebibytes `mirror:"instance.memory_mb" field:",short" create:"set" edit:"set"`
VCPUs int `mirror:"instance.vcpus" field:"vcpus,short" create:"set" edit:"set"`
}
Service *InstanceService `mirror:"instance.service_group" field:",embed" create:"set"`
Volumes []*InstanceVolume `mirror:"instance.volumes" field:",embed" create:"set"`
Networks []struct {
UUID string `mirror:"uuid" field:",long"`
PrivateIP string `mirror:"private_ip" field:",long"`
MAC string `mirror:"mac" field:",long"`
} `mirror:"instance.network_interfaces"`
Timestamps struct {
Created types.RelativeTime `mirror:"instance.created_at" field:",short"`
Started types.RelativeTime `mirror:"instance.started_at"`
Stopped types.RelativeTime `mirror:"instance.stopped_at"`
}
ScaleToZero InstanceScaleToZero `field:",embed" mirror:"instance.scale_to_zero" create:"set" edit:"set"`
Timing struct {
Uptime types.DurationMS `mirror:"instance.uptime_ms"`
BootTime types.DurationUS `mirror:"instance.boot_time_us"`
NetTime types.DurationUS `mirror:"instance.net_time_us"`
}
Restart struct {
Policy string `mirror:"instance.restart_policy" create:"set"`
StartCount int `mirror:"instance.start_count"`
RestartCount int `mirror:"instance.restart_count"`
}
Autostart bool `field:"autostart,invisible,valueless" create:"set"`
Replicas int64 `field:"replicas,invisible,valueless" create:"set"`
WaitTimeout types.DurationS `field:"wait-timeout,invisible,valueless" create:"set"`
Features []string `field:"features,invisible,valueless" create:"set"`
Vsock bool `field:"vsock,invisible,valueless" create:"set" edit:"set"`
Stop struct {
Reason string `field:",long"`
Origin string `field:"origin,hidden"`
Errno stop.Errno `field:"errno,hidden"`
ExitCode *uint32 `mirror:"instance.exit_code" field:"exit-code,long"`
} `field:",long"`
Instance platform.Instance `field:"-" json:"instance"`
Metro *config.Metro `field:"-" json:"metro"`
Profile *config.Profile `field:"-" json:"profile"`
// contains filtered or unexported fields
}
type InstanceCreateCmd ¶ added in v0.2.2
type InstanceCreateCmd struct {
cmd.ResourceCreateCmd[Instance]
// Shortcut flags - ordered to match Instance struct layout.
Metro string `group:"flag-create" shortcut:"metro" help:"Metro to deploy in." placeholder:"metro" example:"fra,sfo,nyc"`
Name string `group:"flag-create" shortcut:"name" short:"n" help:"Instance name." placeholder:"name"`
Image string `group:"flag-create" shortcut:"image" help:"Image to deploy." placeholder:"<name>:<tag>" example:"nginx:latest,my-app:v1.2.3"`
Args []string `group:"flag-create" shortcut:"runtime.args" help:"Arguments to pass to the instance." placeholder:"arg"`
Env []string `` /* 141-byte string literal not displayed */
Memory types.SizeMebibytes `group:"flag-create" shortcut:"resources.memory" short:"m" help:"Memory allocation." placeholder:"size" example:"128MiB,1GiB"`
Vcpus int `group:"flag-create" shortcut:"resources.vcpus" help:"Number of vCPUs." placeholder:"n" example:"1,2,4"`
Volume []InstanceVolume `` /* 142-byte string literal not displayed */
Service InstanceService `group:"flag-create" shortcut:"service" help:"Service group name or key." placeholder:"name"`
Publish []Service `` /* 159-byte string literal not displayed */
Domain []Domain `` /* 126-byte string literal not displayed */
ScaleToZero InstanceScaleToZero `` /* 142-byte string literal not displayed */
Restart string `group:"flag-create" shortcut:"restart.policy" help:"Restart policy." placeholder:"policy" example:"always,on-failure,never"`
Autostart *bool `group:"flag-create" shortcut:"autostart" help:"Start instance automatically."`
Replicas int64 `group:"flag-create" shortcut:"replicas" help:"Number of replicas." placeholder:"n" example:"1,3"`
Features []string `group:"flag-create" shortcut:"features" help:"Instance features." placeholder:"feature"`
}
InstanceCreateCmd extends the generic resource create command with shortcut flags for commonly used instance fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard create pipeline runs.
type InstanceEditCmd ¶ added in v0.2.2
type InstanceEditCmd struct {
cmd.ResourceEditCmd[Instance]
// Shortcut flags - only fields that support editing.
Image string `group:"flag-edit" shortcut:"image" help:"Image to deploy." placeholder:"<name>:<tag>" example:"nginx:latest,my-app:v1.2.3"`
Args []string `group:"flag-edit" shortcut:"runtime.args" help:"Arguments to pass to the instance." placeholder:"arg"`
Env []string `` /* 139-byte string literal not displayed */
Memory types.SizeMebibytes `group:"flag-edit" shortcut:"resources.memory" short:"m" help:"Memory allocation." placeholder:"size" example:"128MiB,1GiB"`
Vcpus int `group:"flag-edit" shortcut:"resources.vcpus" help:"Number of vCPUs." placeholder:"n" example:"1,2,4"`
ScaleToZero InstanceScaleToZero `` /* 140-byte string literal not displayed */
}
InstanceEditCmd extends the generic resource edit command with shortcut flags for commonly used editable instance fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard edit pipeline runs.
type InstanceScaleToZero ¶
type InstanceScaleToZero struct {
Enabled bool `name:"-" json:"-" mirror:"enabled" field:",long"`
Policy string `name:"policy" json:"policy,omitempty" mirror:"policy" field:",long"`
Stateful bool `name:"stateful" json:"stateful,omitempty" mirror:"stateful" field:",long"`
CooldownTime types.DurationMS `name:"cooldown-time" json:"cooldown-time,omitempty" mirror:"cooldown_time_ms" field:",long"`
NotifyTime types.DurationMS `name:"notify-time" json:"notify-time,omitempty" mirror:"notify_time_ms" field:",long"`
}
func (InstanceScaleToZero) MarshalJSON ¶ added in v0.2.2
func (s InstanceScaleToZero) MarshalJSON() ([]byte, error)
func (InstanceScaleToZero) MarshalText ¶ added in v0.2.2
func (s InstanceScaleToZero) MarshalText() ([]byte, error)
func (*InstanceScaleToZero) UnmarshalJSON ¶ added in v0.2.2
func (s *InstanceScaleToZero) UnmarshalJSON(data []byte) error
func (*InstanceScaleToZero) UnmarshalText ¶ added in v0.2.2
func (s *InstanceScaleToZero) UnmarshalText(data []byte) error
type InstanceService ¶ added in v0.2.2
type InstanceService struct {
Metro string `field:"-"`
UUID string `mirror:"uuid" field:",long"`
Name string `mirror:"name" field:",long"`
Services []*Service `mirror:"services" field:",invisible,valueless" create:"set"`
Domains []Domain `mirror:"domains" field:",short,embed" create:"set"`
SoftLimit uint32 `field:"soft-limit,invisible,valueless" create:"set"`
HardLimit uint32 `field:"hard-limit,invisible,valueless" create:"set"`
}
func (*InstanceService) UnmarshalJSON ¶ added in v0.2.2
func (i *InstanceService) UnmarshalJSON(data []byte) error
func (*InstanceService) UnmarshalText ¶ added in v0.2.2
func (i *InstanceService) UnmarshalText(data []byte) error
type InstanceVolume ¶
type InstanceVolume struct {
UUID string `name:"uuid" mirror:"uuid" json:"uuid,omitempty" field:",long"`
Name string `name:"name" mirror:"name" json:"name,omitempty" field:",long"`
At string `name:"at" mirror:"at" json:"at" field:",long"`
Readonly bool `name:"readonly" mirror:"readonly" json:"readonly,omitempty" field:",long"`
Size types.SizeMebibytes `name:"size" field:"size,invisible,valueless" create:"set"`
}
func (*InstanceVolume) MarshalJSON ¶ added in v0.2.0
func (v *InstanceVolume) MarshalJSON() ([]byte, error)
MarshalJSON outputs the struct form (not the short text form). This takes precedence over MarshalText for JSON/YAML serialization.
func (*InstanceVolume) MarshalText ¶
func (v *InstanceVolume) MarshalText() ([]byte, error)
func (*InstanceVolume) UnmarshalJSON ¶ added in v0.2.0
func (v *InstanceVolume) UnmarshalJSON(data []byte) error
UnmarshalJSON parses both the struct form and the short text form. This takes precedence over UnmarshalText for JSON/YAML deserialization.
func (*InstanceVolume) UnmarshalText ¶
func (v *InstanceVolume) UnmarshalText(data []byte) error
type InstancesCmd ¶
type InstancesCmd struct {
cmd.ResourceCmd[Instance]
cmd.GettableResourceCmd[Instance]
cmd.WaitableResourceCmd[Instance]
cmd.ListableResourceCmd[Instance]
cmd.BulkDeletableResourceCmd[Instance]
Create InstanceCreateCmd `cmd:"" help:"Create an instance."`
Edit InstanceEditCmd `cmd:"" help:"Edit an instance."`
Logs InstancesLogsCmd `cmd:"" help:"Fetch and display instance logs."`
Start InstancesStartCmd `cmd:"" help:"Start one or more instances."`
Stop InstancesStopCmd `cmd:"" help:"Stop one or more instances."`
Restart InstancesRestartCmd `cmd:"" help:"Restart one or more instances."`
}
type InstancesLogsCmd ¶
type InstancesLogsCmd struct {
Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance" help:"Target instances to fetch logs for."`
Prefix bool `help:"Prefix log lines with instance name." negatable:"" default:"true"`
Tail int `help:"Number of lines to show from the end of the logs."`
Follow bool `short:"f" help:"Follow log output."`
}
func (InstancesLogsCmd) Examples ¶
func (cmd InstancesLogsCmd) Examples() []kingkong.Example
type InstancesRestartCmd ¶
type InstancesRestartCmd struct {
Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance" help:"Target instances to restart."`
StopOpts
cmd.FormatOpts
}
func (InstancesRestartCmd) Examples ¶
func (cmd InstancesRestartCmd) Examples() []kingkong.Example
type InstancesStartCmd ¶
type InstancesStartCmd struct {
Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance" help:"Target instances to start."`
cmd.FormatOpts
}
func (InstancesStartCmd) Examples ¶
func (cmd InstancesStartCmd) Examples() []kingkong.Example
type InstancesStopCmd ¶
type InstancesStopCmd struct {
Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance" help:"Target instances to stop."`
StopOpts
cmd.FormatOpts
}
func (InstancesStopCmd) Examples ¶
func (cmd InstancesStopCmd) Examples() []kingkong.Example
type Metro ¶
type Metro struct {
Name string `field:",short" json:"name"`
Country string `field:",short" json:"country"`
Endpoint string `field:",short" json:"endpoint"`
Insecure *bool `field:",long" json:"insecure"`
}
type MetrosCmd ¶
type MetrosCmd struct {
cmd.ResourceCmd[Metro]
cmd.GettableResourceCmd[Metro]
cmd.ListableResourceCmd[Metro]
}
type Profile ¶
type Profile struct {
Name string `field:",short" json:"name"`
Active bool `field:",short" json:"active"`
Metros []string `field:",short" json:"metros"`
}
type ProfileCmd ¶
type ProfileCmd struct {
cmd.ResourceCmd[Profile]
cmd.GettableResourceCmd[Profile]
cmd.ListableResourceCmd[Profile]
Use UseCmd `cmd:"" help:"Switch between profiles."`
}
type RunCmd ¶
type RunCmd struct {
InstanceCreateCmd
// Follow is the only run-specific flag; it tails logs after creation.
Follow bool `help:"Follow instance logs after creation."`
}
RunCmd is a convenience wrapper around `instance create` that adds log following capability. All instance creation flags are inherited from InstanceCreateCmd via embedding.
type SendAnalyticsCmd ¶ added in v0.1.1
type SendAnalyticsCmd struct {
Payload string `arg:"" help:"Analytics payload to send."`
}
type Service ¶
type Service struct {
Source uint32 `mirror:"port" json:"source" field:",short"`
Destination uint32 `mirror:"destination_port" json:"destination" field:",short"`
Handlers []platform.ServiceHandlers `mirror:"handlers" json:"handlers" field:",short"`
}
func (*Service) MarshalJSON ¶ added in v0.2.0
MarshalJSON outputs the struct form (not the short text form). This takes precedence over MarshalText for JSON/YAML serialization.
func (*Service) MarshalText ¶
func (*Service) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON parses both the struct form and the short text form. This takes precedence over UnmarshalText for JSON/YAML deserialization.
func (*Service) UnmarshalText ¶
type ServiceCreateCmd ¶ added in v0.2.2
type ServiceCreateCmd struct {
cmd.ResourceCreateCmd[ServiceGroup]
Metro string `group:"flag-create" shortcut:"metro" help:"Metro to create in." placeholder:"metro" example:"fra,sfo,nyc"`
Name string `group:"flag-create" shortcut:"name" help:"Service group name." placeholder:"name"`
SoftLimit uint64 `group:"flag-create" shortcut:"limits.soft" help:"Soft limit." placeholder:"n" example:"1,5"`
HardLimit uint64 `group:"flag-create" shortcut:"limits.hard" help:"Hard limit." placeholder:"n" example:"10,100"`
Domains []Domain `group:"flag-create" shortcut:"domains" help:"Service domains." placeholder:"fqdn" example:"example.com,api.example.com"`
Services []Service `` /* 142-byte string literal not displayed */
}
ServiceCreateCmd extends the generic resource create command with shortcut flags for commonly used service group fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard create pipeline runs.
type ServiceEditCmd ¶ added in v0.2.2
type ServiceEditCmd struct {
cmd.ResourceEditCmd[ServiceGroup]
SoftLimit uint64 `group:"flag-edit" shortcut:"limits.soft" help:"Soft limit." placeholder:"n" example:"1,5"`
HardLimit uint64 `group:"flag-edit" shortcut:"limits.hard" help:"Hard limit." placeholder:"n" example:"10,100"`
Domains []Domain `group:"flag-edit" shortcut:"domains" help:"Service domains." placeholder:"fqdn" example:"example.com,api.example.com"`
Services []Service `` /* 140-byte string literal not displayed */
}
ServiceEditCmd extends the generic resource edit command with shortcut flags for commonly used editable service group fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard edit pipeline runs.
type ServiceGroup ¶
type ServiceGroup struct {
MetroName string `mirror:"metro.name" field:"metro,short" create:"set,required"`
Name string `mirror:"service_group.name" field:",short" create:"set"`
UUID string `mirror:"service_group.uuid" field:",long"`
Persistent bool `mirror:"service_group.persistent" field:",long"`
Autoscale bool `mirror:"service_group.autoscale" field:",short"`
Limits struct {
Soft uint64 `mirror:"service_group.soft_limit" field:",long" create:"set" edit:"set"`
Hard uint64 `mirror:"service_group.hard_limit" field:",long" create:"set" edit:"set"`
}
Timestamps struct {
Created types.RelativeTime `mirror:"service_group.created_at" field:",short"`
}
Domains []Domain `mirror:"service_group.domains" field:",embed" create:"set" edit:"set,add,del"`
Instances []struct {
Name string `mirror:"name" field:",long"`
UUID string `mirror:"uuid" field:",long"`
} `mirror:"service_group.instances"`
Services []*Service `mirror:"service_group.services" field:",embed" create:"set,required" edit:"set,add,del"`
ServiceGroup platform.ServiceGroup `field:"-" json:"service_group"`
Metro *config.Metro `field:"-" json:"metro"`
// contains filtered or unexported fields
}
func (ServiceGroup) Key ¶
func (s ServiceGroup) Key() resource.Key
func (ServiceGroup) Raw ¶
func (s ServiceGroup) Raw() any
func (ServiceGroup) Type ¶
func (ServiceGroup) Type() resource.Type
type ServicesCmd ¶
type ServicesCmd struct {
cmd.ResourceCmd[ServiceGroup]
cmd.GettableResourceCmd[ServiceGroup]
cmd.WaitableResourceCmd[ServiceGroup]
cmd.ListableResourceCmd[ServiceGroup]
cmd.BulkDeletableResourceCmd[ServiceGroup]
Create ServiceCreateCmd `cmd:"" help:"Create a service group."`
Edit ServiceEditCmd `cmd:"" help:"Edit a service group."`
}
type StopOpts ¶
type StopOpts struct {
Force bool `help:"Force stop the instance immediately."`
DrainTimeout types.DurationMS `help:"Timeout in milliseconds for draining connections before stopping." default:"-1"`
}
type TUICmd ¶ added in v0.2.0
type UnikraftCLI ¶
type UnikraftCLI struct {
Run RunCmd `cmd:"" group:"cmd-commands" help:"Run an image as an instance." set:"name=instance" set:"names=instances"`
Build BuildCmd `cmd:"" group:"cmd-commands" help:"Build a Unikraft project into a container image."`
TUI TUICmd `cmd:"" group:"cmd-commands" help:"Browse resources in a TUI."`
Metros MetrosCmd `cmd:"" group:"cmd-resources" help:"Manage Unikraft Cloud metros." aliases:"metro,metros" set:"name=metro" set:"names=metros"`
Instances InstancesCmd `` /* 146-byte string literal not displayed */
Volumes VolumesCmd `` /* 138-byte string literal not displayed */
Services ServicesCmd `` /* 143-byte string literal not displayed */
Certificates CertificatesCmd `` /* 174-byte string literal not displayed */
Images ImagesCmd `` /* 133-byte string literal not displayed */
Resources AnyResourceCmd `` /* 152-byte string literal not displayed */
Login login.LoginCmd `cmd:"" group:"cmd-config" help:"Login to Unikraft Cloud."`
Logout login.LogoutCmd `cmd:"" group:"cmd-config" help:"Logout from Unikraft Cloud."`
Profile ProfileCmd `` /* 131-byte string literal not displayed */
Config ConfigCmd `cmd:"" group:"cmd-config" help:"Manage CLI configuration." aliases:"config,conf,cfg" set:"name=path" set:"names=paths"`
Completion kongcompletion.Completion `cmd:"" group:"cmd-utilities" completion-shell-default:"false" help:"Outputs shell code for initialising tab completions."`
Version version.VersionCmd `cmd:"" group:"cmd-utilities" help:"Show version information." aliases:"version,ver,v"`
Upgrade UpgradeCmd `cmd:"" group:"cmd-utilities" help:"Upgrade the Unikraft CLI to the latest version."`
SendAnalytics SendAnalyticsCmd `` /* 133-byte string literal not displayed */
// contains filtered or unexported fields
}
func NewRootCmd ¶
func (UnikraftCLI) Examples ¶
func (cli UnikraftCLI) Examples() []kingkong.Example
type UpgradeCmd ¶ added in v0.2.0
type UpgradeCmd struct {
Channel string `help:"Release channel to upgrade from." default:"stable" enum:"stable,staging"`
Force bool `short:"f" help:"Force upgrade even if already at latest version."`
Version string `short:"v" help:"Upgrade to a specific version."`
BinDir string `help:"Directory where to install the binary. If empty, uses the current binary location."`
BaseUrl string `help:"Base URL for fetching releases." env:"UNIKRAFT_CLI_INSTALL_URL" default:"https://pkg.unikraft.com" hidden:"true"`
}
type UseCmd ¶
type UseCmd struct {
Name string `arg:"" optional:"" help:"Target profile to switch to."`
}
type Volume ¶
type Volume struct {
MetroName string `mirror:"metro.name" field:"metro,short" create:"set,required"`
Name string `mirror:"volume.name" field:",short" create:"set"`
UUID string `mirror:"volume.uuid" field:",long"`
Tags []string `mirror:"volume.tags"`
State types.VolumeState `mirror:"volume.state" field:",short"`
Size types.SizeMebibytes `mirror:"volume.size_mb" field:",short" create:"set,required" edit:"set"`
Filesystem string `mirror:"volume.filesystem" field:",long" create:"set"`
QuotaPolicy string `mirror:"volume.quota_policy" field:"quota-policy,long" create:"set" edit:"set"`
Persistent bool `mirror:"volume.persistent" field:",long"`
Timestamps struct {
Created types.RelativeTime `mirror:"volume.created_at" field:",short"`
}
AttachedTo []struct {
Name string `mirror:"name" field:",long"`
UUID string `mirror:"uuid" field:",long"`
} `mirror:"volume.attached_to"`
MountedBy []struct {
Name string `mirror:"name" field:",long"`
UUID string `mirror:"uuid" field:",long"`
ReadOnly bool `mirror:"read_only" field:",long"`
} `mirror:"volume.mounted_by"`
Volume platform.Volume `field:"-" json:"volume"`
Metro *config.Metro `field:"-" json:"metro"`
// contains filtered or unexported fields
}
type VolumeCreateCmd ¶ added in v0.2.2
type VolumeCreateCmd struct {
cmd.ResourceCreateCmd[Volume]
Metro string `group:"flag-create" shortcut:"metro" help:"Metro to create in." placeholder:"metro" example:"fra,sfo,nyc"`
Name string `group:"flag-create" shortcut:"name" short:"n" help:"Volume name." placeholder:"name"`
Size types.SizeMebibytes `group:"flag-create" shortcut:"size" help:"Volume size." placeholder:"size" example:"10GiB,100MiB"`
Filesystem string `group:"flag-create" shortcut:"filesystem" help:"Volume filesystem." placeholder:"filesystem" example:"ext4"`
QuotaPolicy string `group:"flag-create" shortcut:"quota-policy" help:"Volume quota policy." placeholder:"quota-policy" example:"static,dynamic"`
}
VolumeCreateCmd extends the generic resource create command with shortcut flags for commonly used volume fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard create pipeline runs.
type VolumeEditCmd ¶ added in v0.2.2
type VolumeEditCmd struct {
cmd.ResourceEditCmd[Volume]
Size types.SizeMebibytes `group:"flag-edit" shortcut:"size" help:"Volume size." placeholder:"size" example:"20GiB,100MiB"`
QuotaPolicy string `group:"flag-edit" shortcut:"quota-policy" help:"Volume quota policy." placeholder:"quota-policy" example:"static,dynamic"`
}
VolumeEditCmd extends the generic resource edit command with shortcut flags for commonly used editable volume fields. Each field tagged with `shortcut:"<path>"` is translated into a --set <path>=<value> entry before the standard edit pipeline runs.
type VolumesCloneCmd ¶ added in v0.1.1
type VolumesCloneCmd struct {
Source string `arg:"" completion-predictor:"resource-key-volume" help:"Name or UUID of the volume to clone."`
Name string `group:"flag-clone" shortcut:"name" short:"n" help:"New volume name." placeholder:"name"`
Tags []string `group:"flag-clone" shortcut:"tags" help:"Volume tags." placeholder:"tag" example:"env=prod,team=platform"`
cmd.SetArgs
cmd.FormatOpts
}
func (VolumesCloneCmd) Examples ¶ added in v0.1.1
func (VolumesCloneCmd) Examples() []kingkong.Example
type VolumesCmd ¶
type VolumesCmd struct {
cmd.ResourceCmd[Volume]
cmd.GettableResourceCmd[Volume]
cmd.WaitableResourceCmd[Volume]
cmd.ListableResourceCmd[Volume]
cmd.BulkDeletableResourceCmd[Volume]
Create VolumeCreateCmd `cmd:"" help:"Create a volume."`
Edit VolumeEditCmd `cmd:"" help:"Edit a volume."`
Clone VolumesCloneCmd `cmd:"" help:"Clone a volume."`
}