shadow

package
v0.0.0-...-47d8c88 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockDeviceAllocated = 2
)

Variables

This section is empty.

Functions

func GenerateCloudConfig

func GenerateCloudConfig(options *CloudConfigOpts) ([]byte, error)

Types

type BlockDevice

type BlockDevice struct {
	UUID string `json:"uuid"`
}

BlockDevice is the Block Device field in the response from the /vm/list endpoint

type BlockDeviceList

type BlockDeviceList struct {
	AllocatedOn     *time.Time `json:"allocated_on"`
	Cost            int        `json:"cost"`
	DatacenterLabel string     `json:"datacenter_label"`
	ID              int        `json:"id"`
	InsertedOn      time.Time  `json:"inserted_on"`
	Mount           bool       `json:"mount"`
	ReleasedOn      *time.Time `json:"released_on"`
	SizeGiB         int        `json:"size_gib"`
	Status          int        `json:"status"`
	StatusStr       string     `json:"status_str"`
	UUID            string     `json:"uuid"`
}

BlockDeviceList is the Block Device field in the response from the /block_device/list endpoint

type BlockDeviceListResponse

type BlockDeviceListResponse struct {
	BlockDevices []BlockDeviceList `json:"block_devices"`
	Filters      struct{}          `json:"filters"`
}

BlockDeviceListResponse is the response from the /block_device/list endpoint

type CloudConfigOpts

type CloudConfigOpts struct {
	PostScripts config.PostScriptsOpts
	Hostname    string
}

type DataSource

type DataSource struct {
	http.Client
	// contains filtered or unexported fields
}

func New

func New(
	username string,
	password string,
	zone string,
	sshKey string,
) *DataSource

func (*DataSource) Create

func (s *DataSource) Create(
	ctx context.Context,
	host *config.Host,
	cloud *config.Cloud,
) error

Create a shadow instance

func (*DataSource) CreateBlockDevice

func (s *DataSource) CreateBlockDevice(ctx context.Context, host *config.Host) (string, error)

CreateBlockDevice creates a storage volume and returns its UUID

func (*DataSource) CreateVM

func (s *DataSource) CreateVM(
	ctx context.Context,
	host *config.Host,
	cloud *config.Cloud,
	blockDeviceUUID string,
) (string, error)

CreateVM spawns a VM attached to a storage volume and returns its UUID

func (*DataSource) Delete

func (s *DataSource) Delete(ctx context.Context, name string) error

Delete a server

func (*DataSource) DeleteBlockDevice

func (s *DataSource) DeleteBlockDevice(ctx context.Context, block DeleteBlockDeviceRequest) error

func (*DataSource) ExecutePostcript

func (s *DataSource) ExecutePostcript(
	ctx context.Context,
	host *config.Host,
	instance VM,
	userData []byte,
) error

func (*DataSource) FindVM

func (s *DataSource) FindVM(ctx context.Context, name string) (VM, error)

func (*DataSource) InterrogateAPI

func (s *DataSource) InterrogateAPI(
	ctx context.Context,
	endpoint string,
	jsonBody []byte,
) (*http.Response, error)

type DatacenterLabel

type DatacenterLabel string

type DeleteBlockDeviceRequest

type DeleteBlockDeviceRequest struct {
	UUID string `json:"uuid"`
}

type StatusStr

type StatusStr string

type VM

type VM struct {
	Image            string           `json:"image"`
	UUID             string           `json:"uuid"`
	Uptime           int64            `json:"uptime"`
	VMRAM            int64            `json:"vm_ram"`
	VMCore           int64            `json:"vm_core"`
	VMGPU            int64            `json:"vm_gpu"`
	VMCost           int64            `json:"vm_cost"`
	VNC              bool             `json:"vnc"`
	Interruptible    bool             `json:"interruptible"`
	VNCPassword      *string          `json:"vnc_password"`
	Status           int64            `json:"status"`
	StatusStr        StatusStr        `json:"status_str"`
	InsertedOn       string           `json:"inserted_on"`
	AffectedOn       *string          `json:"affected_on"`
	MaxUptime        int64            `json:"max_uptime"`
	RequestTimeout   int64            `json:"request_timeout"`
	StartedOn        *string          `json:"started_on"`
	KillRequestedOn  *string          `json:"kill_requested_on"`
	LaunchBashScript string           `json:"launch_bash_script"`
	VMSku            VMSku            `json:"vm_sku"`
	VMPublicIPv4     *VMPublicIPv4    `json:"vm_public_ipv4"`
	VMPublicSSHPort  *int64           `json:"vm_public_sshport"`
	DatacenterLabel  *DatacenterLabel `json:"datacenter_label"`
	BlockDevices     []BlockDevice    `json:"block_devices"`
}

VM is the VM field from the /vm/list endpoint

type VMListResponse

type VMListResponse struct {
	Filters struct{} `json:"filters"`
	VMs     []VM     `json:"vms"`
}

VMListResponse is the response from the /vm/list endpoint

type VMPublicIPv4

type VMPublicIPv4 string

type VMSku

type VMSku string

Jump to

Keyboard shortcuts

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