types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package types contains the types for the storctl tool. It includes the types for the server, volume, lab, and SSH key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError added in v0.1.2

func NewError(code, message string) error

NewError creates a new ProviderError

Types

type AnsibleSpec added in v0.1.2

type AnsibleSpec struct {
	ConfigFile string `json:"configFile"`
	Inventory  string `json:"inventory"`
	Playbook   string `json:"playbook"`
	User       string `json:"user"`
}

type IPv4

type IPv4 struct {
	IP string `json:"ip"`
}

type Lab

type Lab struct {
	TypeMeta   `json:",inline"`
	ObjectMeta `json:"metadata,omitempty"`
	Spec       LabSpec   `json:"spec"`
	Status     LabStatus `json:"status,omitempty"`
}

type LabDeleteStatus

type LabDeleteStatus struct {
	Deleted     bool      `json:"deleted"`
	DeleteAfter time.Time `json:"deleteAfter"`
	Error       error     `json:"error"`
}

type LabServerSpec

type LabServerSpec struct {
	Name       string `json:"name"`
	Role       string `json:"role"`
	ServerType string `json:"type"`
	Image      string `json:"image"`
}

type LabSpec

type LabSpec struct {
	Servers     []*LabServerSpec `json:"servers"`
	Volumes     []*LabVolumeSpec `json:"volumes"`
	TTL         string           `json:"ttl"`
	Provider    string           `json:"provider"`
	Location    string           `json:"location"`
	Ansible     AnsibleSpec      `json:"ansible"`
	CertManager bool             `json:"certManager"`
	LetsEncrypt string           `json:"letsEncrypt"` // prod or staging
}

type LabStatus

type LabStatus struct {
	State       string    `json:"state"`
	Owner       string    `json:"owner"`
	Servers     []*Server `json:"servers"`
	Volumes     []*Volume `json:"volumes"`
	Created     time.Time `json:"created"`
	DeleteAfter time.Time `json:"deleteAfter"`
}

type LabVolumeSpec

type LabVolumeSpec struct {
	Name      string `json:"name"`
	Server    string `json:"server"`
	Size      int    `json:"size"`
	Format    string `json:"format"`
	Automount bool   `json:"automount"`
}

type ObjectMeta

type ObjectMeta struct {
	Name   string            `json:"name,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
}

type ProviderError added in v0.1.2

type ProviderError struct {
	Code    string
	Message string
}

ProviderError represents an error from a cloud provider

func (*ProviderError) Error added in v0.1.2

func (e *ProviderError) Error() string

type PublicNet

type PublicNet struct {
	IPv4 *struct {
		IP string `json:"ip"`
	} `json:"ipv4"`
	FQDN string `json:"fqdn"`
}

type Resource

type Resource struct {
	TypeMeta   `json:",inline"`
	ObjectMeta `json:"metadata,omitempty"`
	Spec       map[string]interface{} `json:"spec"`
}

Resource represents the common fields for all resources

type SSHKey

type SSHKey struct {
	TypeMeta   `json:",inline"`
	ObjectMeta `json:"metadata,omitempty"`
	Spec       SSHKeySpec   `json:"spec"`
	Status     SSHKeyStatus `json:"status,omitempty"`
}

type SSHKeyDeleteStatus

type SSHKeyDeleteStatus struct {
	Deleted     bool      `json:"deleted"`
	DeleteAfter time.Time `json:"deleteAfter"`
	Error       error     `json:"error"`
}

type SSHKeyExistsStatus added in v0.1.2

type SSHKeyExistsStatus struct {
	LocalExists  bool      `json:"localExists"`
	CloudExists  bool      `json:"cloudExists"`
	CloudExpired bool      `json:"cloudExpired"`
	DeleteAfter  time.Time `json:"deleteAfter"`
	Error        error     `json:"error"`
}

type SSHKeySpec

type SSHKeySpec struct {
	PublicKey string            `json:"publicKey"`
	Labels    map[string]string `json:"labels"`
	TTL       string            `json:"ttl"`
}

type SSHKeyStatus

type SSHKeyStatus struct {
	Status      string    `json:"status"`
	Owner       string    `json:"owner"`
	Created     time.Time `json:"created"`
	DeleteAfter time.Time `json:"deleteAfter"`
}

type Server

type Server struct {
	TypeMeta   `json:",inline"`
	ObjectMeta `json:"metadata,omitempty"`
	Spec       ServerSpec   `json:"spec"`
	Status     ServerStatus `json:"status,omitempty"`
}

type ServerDeleteStatus

type ServerDeleteStatus struct {
	Deleted     bool      `json:"deleted"`
	DeleteAfter time.Time `json:"deleteAfter"`
	Error       error     `json:"error"`
}

type ServerSpec

type ServerSpec struct {
	ServerType  string            `json:"type"`
	Image       string            `json:"image"`
	Location    string            `json:"location"`
	Provider    string            `json:"provider"`
	Labels      map[string]string `json:"labels"`
	Volumes     []*Volume         `json:"volumes"`
	SSHKeyNames []string          `json:"sshKeyNames"`
	TTL         string            `json:"ttl"`
}

Server represents a generic server across providers

type ServerStatus

type ServerStatus struct {
	Status      string     `json:"status"`
	Owner       string     `json:"owner"`
	Cores       int        `json:"cores"`
	Memory      float32    `json:"memory"`
	Disk        int        `json:"disk"`
	PublicNet   *PublicNet `json:"publicNet"`
	Created     time.Time  `json:"created"`
	DeleteAfter time.Time  `json:"deleteAfter"`
}

type TypeMeta

type TypeMeta struct {
	APIVersion string `json:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty"`
}

type Volume

type Volume struct {
	TypeMeta   `json:",inline"`
	ObjectMeta `json:"metadata,omitempty"`
	Spec       VolumeSpec   `json:"spec"`
	Status     VolumeStatus `json:"status,omitempty"`
}

type VolumeDeleteStatus

type VolumeDeleteStatus struct {
	Deleted     bool      `json:"deleted"`
	DeleteAfter time.Time `json:"deleteAfter"`
	Error       error     `json:"error"`
}

type VolumeSpec

type VolumeSpec struct {
	ServerID   string            `json:"serverID"`
	ServerName string            `json:"serverName"`
	Location   string            `json:"location"`
	Provider   string            `json:"provider"`
	Size       int               `json:"size"`
	Automount  bool              `json:"automount"`
	Format     string            `json:"format"`
	Labels     map[string]string `json:"labels"`
	TTL        string            `json:"ttl"`
}

type VolumeStatus

type VolumeStatus struct {
	Status      string    `json:"status"`
	Owner       string    `json:"owner"`
	Created     time.Time `json:"created"`
	DeleteAfter time.Time `json:"deleteAfter"`
}

Jump to

Keyboard shortcuts

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