types

package
v0.0.19 Latest Latest
Warning

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

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

Documentation

Overview

Package types provides interface definitions for compute providers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOClient

type DOClient interface {
	Droplets() DropletService
	Keys() KeyService
	Storage() StorageService
	ValidateCredentials() error
	GetEnvironmentVars() map[string]string
	ConfigureProvider(stack interface{}) error
	CreateInstance(ctx context.Context, config *types.InstanceRequest) error
	DeleteInstance(ctx context.Context, dropletID int) error
}

DOClient defines the interface for Digital Ocean client operations

type DropletService

type DropletService interface {
	Create(ctx context.Context, createRequest *godo.DropletCreateRequest) (*godo.Droplet, *godo.Response, error)
	Get(ctx context.Context, id int) (*godo.Droplet, *godo.Response, error)
	Delete(ctx context.Context, id int) (*godo.Response, error)
	List(ctx context.Context, opt *godo.ListOptions) ([]godo.Droplet, *godo.Response, error)
}

DropletService defines the interface for droplet operations

type KeyService

type KeyService interface {
	List(ctx context.Context, opt *godo.ListOptions) ([]godo.Key, *godo.Response, error)
}

KeyService defines the interface for SSH key operations

type StorageService

type StorageService interface {
	CreateVolume(ctx context.Context, request *godo.VolumeCreateRequest) (*godo.Volume, *godo.Response, error)
	DeleteVolume(ctx context.Context, id string) (*godo.Response, error)
	ListVolumes(ctx context.Context, opt *godo.ListVolumeParams) ([]godo.Volume, *godo.Response, error)
	GetVolume(ctx context.Context, id string) (*godo.Volume, *godo.Response, error)
	GetVolumeAction(ctx context.Context, volumeID string, actionID int) (*godo.Action, *godo.Response, error)
	AttachVolume(ctx context.Context, volumeID string, dropletID int) (*godo.Response, error)
	DetachVolume(ctx context.Context, volumeID string, dropletID int) (*godo.Response, error)
}

StorageService is the interface for volume operations

type XimeraConfiguration added in v0.0.16

type XimeraConfiguration struct {
	APIURL       string
	APIToken     string
	UserID       int
	HypervisorID int
	PackageID    int // Default package ID to use when creating servers
}

XimeraConfiguration holds the API configuration

func (*XimeraConfiguration) Validate added in v0.0.16

func (c *XimeraConfiguration) Validate() error

Validate validates the XimeraConfiguration struct

type XimeraServerBuildRequest added in v0.0.16

type XimeraServerBuildRequest struct {
	OperatingSystemID int    `json:"operatingSystemId"`
	Name              string `json:"name,omitempty"`
	Hostname          string `json:"hostname,omitempty"`
	SSHKeys           []int  `json:"sshKeys,omitempty"`
}

XimeraServerBuildRequest represents the request to build a server

func (*XimeraServerBuildRequest) Validate added in v0.0.16

func (s *XimeraServerBuildRequest) Validate() error

Validate validates the XimeraServerBuildRequest struct

type XimeraServerConfig added in v0.0.16

type XimeraServerConfig struct {
	Name       string `json:"name"`
	Package    int    `json:"package"`
	Hypervisor int    `json:"hypervisor"`
	Memory     int    `json:"memory"`
	CPU        int    `json:"cpu"`
	Storage    int    `json:"storage"`
	Traffic    int    `json:"traffic"`
	Build      bool   `json:"build"`
	OS         int    `json:"os"`
	Hostname   string `json:"hostname"`
	Delete     bool   `json:"delete,omitempty"`
}

XimeraServerConfig represents a server configuration in the batch file

func (*XimeraServerConfig) Validate added in v0.0.16

func (s *XimeraServerConfig) Validate() error

Validate validates the XimeraServerConfig struct

type XimeraServerCreateRequest added in v0.0.16

type XimeraServerCreateRequest struct {
	PackageID    int    `json:"packageId"`
	UserID       int    `json:"userId"`
	HypervisorID int    `json:"hypervisorId"`
	IPv4         int    `json:"ipv4"`
	Name         string `json:"name,omitempty"`
	Storage      int    `json:"storage,omitempty"`
	Traffic      int    `json:"traffic,omitempty"`
	Memory       int    `json:"memory,omitempty"`
	CPUCores     int    `json:"cpuCores,omitempty"`
}

XimeraServerCreateRequest represents the request to create a server

func (*XimeraServerCreateRequest) Validate added in v0.0.16

func (s *XimeraServerCreateRequest) Validate() error

Validate validates the XimeraServerCreateRequest struct

type XimeraServerResponse added in v0.0.16

type XimeraServerResponse struct {
	Data struct {
		ID               int    `json:"id"`
		OwnerID          int    `json:"ownerId"`
		HypervisorID     int    `json:"hypervisorId"`
		Name             string `json:"name"`
		Hostname         string `json:"hostname"`
		UUID             string `json:"uuid"`
		State            string `json:"state"`
		CommissionStatus int    `json:"commissionStatus"`
		PublicIP         string `json:"publicIp,omitempty"`
		Created          string `json:"created"`
		Updated          string `json:"updated"`

		Network struct {
			Interfaces []struct {
				IPv4 []struct {
					Address string `json:"address"`
				} `json:"ipv4"`
			} `json:"interfaces"`
		} `json:"network"`
	} `json:"data"`
}

XimeraServerResponse represents the response from the API Refactored to include nested structs for network and interfaces so that the public IP can be unmarshalled directly.

type XimeraServersListResponse added in v0.0.16

type XimeraServersListResponse struct {
	Data []struct {
		ID           int    `json:"id"`
		OwnerID      int    `json:"ownerId"`
		HypervisorID int    `json:"hypervisorId"`
		Name         string `json:"name"`
		Hostname     string `json:"hostname"`
		UUID         string `json:"uuid"`
		State        string `json:"state"`
	} `json:"data"`
}

XimeraServersListResponse represents the response from listing servers

type XimeraTemplate added in v0.0.16

type XimeraTemplate struct {
	ID          int    `json:"id"`          // Unique identifier for the template
	Name        string `json:"name"`        // Name of the OS template
	Version     string `json:"version"`     // Version of the OS
	Variant     string `json:"variant"`     // Variant of the OS (e.g., Desktop, Server)
	Arch        int    `json:"arch"`        // Architecture type (e.g., 1 for x86_64)
	Description string `json:"description"` // Description of the template
	Icon        string `json:"icon"`        // Icon identifier for the template
	EOL         bool   `json:"eol"`         // End of Life flag
	EOLDate     string `json:"eol_date"`    // End of Life date in ISO format
	EOLWarning  bool   `json:"eol_warning"` // Whether to show EOL warning
	DeployType  int    `json:"deploy_type"` // Deployment type identifier
	VNC         bool   `json:"vnc"`         // Whether VNC is supported
	Type        string `json:"type"`        // Template type identifier
}

XimeraTemplate represents an OS template in the API response

func (*XimeraTemplate) Validate added in v0.0.16

func (t *XimeraTemplate) Validate() error

Validate validates the XimeraTemplate struct

type XimeraTemplateGroup added in v0.0.16

type XimeraTemplateGroup struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Icon        string           `json:"icon"`
	Templates   []XimeraTemplate `json:"templates"`
	ID          int              `json:"id"`
}

XimeraTemplateGroup represents a group of templates in the API response

type XimeraTemplatesResponse added in v0.0.16

type XimeraTemplatesResponse struct {
	Data []XimeraTemplateGroup `json:"data"`
}

XimeraTemplatesResponse represents the response from the API for OS templates

Jump to

Keyboard shortcuts

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