cloud

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServerAddresses

func GetServerAddresses(server *cloudsigma.Server) []clusterv1.MachineAddress

GetServerAddresses extracts network addresses from a CloudSigma Server Returns addresses in CAPI MachineAddress format for node registration Note: For DHCP/NAT configurations, the IP is assigned by CloudSigma but may not appear in the API until the server is fully booted. Use GetServerAddressesWithClient to fetch IPs from the API if needed.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps the CloudSigma SDK client with CAPI-specific functionality

func NewClient

func NewClient(username, password, region string) (*Client, error)

NewClient creates a new CloudSigma client wrapper

func (*Client) AllocatePublicIP

func (c *Client) AllocatePublicIP(ctx context.Context, name string) (*cloudsigma.IP, error)

AllocatePublicIP allocates a new public IP address

func (*Client) CloneDrive

func (c *Client) CloneDrive(ctx context.Context, sourceUUID, name string, size int64) (*cloudsigma.Drive, error)

CloneDrive clones a drive (typically a library image) to create a new drive

func (*Client) CreateServer

func (c *Client) CreateServer(ctx context.Context, spec ServerSpec) (*cloudsigma.Server, error)

CreateServer creates a new CloudSigma server

func (*Client) CreateVLAN

func (c *Client) CreateVLAN(ctx context.Context, name string, meta map[string]string) (*cloudsigma.VLAN, error)

CreateVLAN creates a new VLAN Note: CloudSigma VLAN creation is typically done through the web UI or requires special permissions This is a placeholder for future implementation

func (*Client) DeleteDrive

func (c *Client) DeleteDrive(ctx context.Context, uuid string) error

DeleteDrive deletes a drive

func (*Client) DeleteIP

func (c *Client) DeleteIP(ctx context.Context, uuid string) error

DeleteIP releases a public IP address (returns it to pool)

func (*Client) DeleteServer

func (c *Client) DeleteServer(ctx context.Context, uuid string) error

DeleteServer deletes a server and its associated drives

func (*Client) DeleteVLAN

func (c *Client) DeleteVLAN(ctx context.Context, uuid string) error

DeleteVLAN deletes a VLAN Note: CloudSigma VLAN deletion is typically done through the web UI This is a placeholder for future implementation

func (*Client) GetDrive

func (c *Client) GetDrive(ctx context.Context, uuid string) (*cloudsigma.Drive, error)

GetDrive retrieves a drive by UUID

func (*Client) GetIP

func (c *Client) GetIP(ctx context.Context, uuid string) (*cloudsigma.IP, error)

GetIP retrieves an IP by UUID

func (*Client) GetServer

func (c *Client) GetServer(ctx context.Context, uuid string) (*cloudsigma.Server, error)

GetServer retrieves a server by UUID

func (*Client) GetServerAddressesWithClient

func (c *Client) GetServerAddressesWithClient(ctx context.Context, server *cloudsigma.Server) ([]clusterv1.MachineAddress, error)

GetServerAddressesWithClient fetches server addresses by retrieving IP resources from CloudSigma API This is needed because Server objects contain IP UUIDs but not the actual IP address strings

func (*Client) GetVLAN

func (c *Client) GetVLAN(ctx context.Context, uuid string) (*cloudsigma.VLAN, error)

GetVLAN retrieves a VLAN by UUID

func (*Client) ListServers

func (c *Client) ListServers(ctx context.Context) ([]cloudsigma.Server, error)

ListServers lists all servers

func (*Client) ListVLANs

func (c *Client) ListVLANs(ctx context.Context) ([]cloudsigma.VLAN, error)

ListVLANs lists all VLANs

func (*Client) Region

func (c *Client) Region() string

Region returns the configured region

func (*Client) StartServer

func (c *Client) StartServer(ctx context.Context, uuid string) error

StartServer starts a stopped server

func (*Client) StopServer

func (c *Client) StopServer(ctx context.Context, uuid string) error

StopServer stops a running server

func (*Client) Username

func (c *Client) Username() string

Username returns the configured username

func (*Client) VerifyConnection

func (c *Client) VerifyConnection(ctx context.Context) error

VerifyConnection tests the connection to CloudSigma API

func (*Client) WaitForDriveReady

func (c *Client) WaitForDriveReady(ctx context.Context, uuid string, timeout time.Duration) (*cloudsigma.Drive, error)

WaitForDriveReady waits for a drive to reach "mounted" or "unmounted" status

type CustomIPRef

type CustomIPRef struct {
	UUID string `json:"uuid"` // IP UUID string
}

CustomIPRef represents an IP address reference

type CustomIPv4Conf

type CustomIPv4Conf struct {
	Conf string       `json:"conf"`         // dhcp, static, or manual
	IP   *CustomIPRef `json:"ip,omitempty"` // IP reference for static config
}

CustomIPv4Conf represents IPv4 configuration for a NIC

type CustomServer

type CustomServer struct {
	Name        string              `json:"name"`
	CPU         int                 `json:"cpu"`
	Memory      int                 `json:"mem"`
	VNCPassword string              `json:"vnc_password"`
	Drives      []CustomServerDrive `json:"drives"`
	NICs        []CustomServerNIC   `json:"nics,omitempty"` // Omit if empty - CloudSigma auto-assigns public IP
	Meta        map[string]string   `json:"meta,omitempty"`
}

CustomServer represents a server for creation

type CustomServerCreateRequest

type CustomServerCreateRequest struct {
	Servers []CustomServer `json:"objects"`
}

CustomServerCreateRequest wraps servers for creation

type CustomServerDrive

type CustomServerDrive struct {
	BootOrder  int    `json:"boot_order,omitempty"`
	DevChannel string `json:"dev_channel,omitempty"`
	Device     string `json:"device,omitempty"`
	Drive      string `json:"drive"` // UUID string instead of object
}

CustomServerDrive represents a server drive with string drive reference

type CustomServerNIC

type CustomServerNIC struct {
	VLAN     string          `json:"vlan,omitempty"`       // UUID string
	IPv4Conf *CustomIPv4Conf `json:"ip_v4_conf,omitempty"` // IPv4 configuration (CloudSigma uses ip_v4_conf with underscores)
}

CustomServerNIC represents a server NIC with string VLAN reference

type ServerSpec

type ServerSpec struct {
	Name          string
	CPU           int
	Memory        int
	Disks         []infrav1.CloudSigmaDisk
	NICs          []infrav1.CloudSigmaNIC
	Tags          []string
	Meta          map[string]string
	BootstrapData string // Cloud-init user data
}

ServerSpec defines the specifications for creating a server

Jump to

Keyboard shortcuts

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